@pushpalsdev/cli 1.0.25 → 1.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1743,6 +1743,21 @@ function writeTextFileIfMissing(pathValue, text) {
1743
1743
  mkdirSync(dirname(pathValue), { recursive: true });
1744
1744
  writeFileSync(pathValue, text, "utf8");
1745
1745
  }
1746
+ function migrateEmbeddedRuntimeLocalToml(localTomlPath) {
1747
+ if (!existsSync4(localTomlPath))
1748
+ return;
1749
+ let original;
1750
+ try {
1751
+ original = readFileSync4(localTomlPath, "utf8");
1752
+ } catch {
1753
+ return;
1754
+ }
1755
+ const updated = original.replace(/^(\[remotebuddy\.autonomy\]\r?\n)(enabled\s*=\s*false\s*\r?\n)/m, `$1enabled = true
1756
+ `);
1757
+ if (updated !== original) {
1758
+ writeFileSync(localTomlPath, updated, "utf8");
1759
+ }
1760
+ }
1746
1761
  function copyRuntimeAssetBundle(source, runtimeRoot, force) {
1747
1762
  mkdirSync(runtimeRoot, { recursive: true });
1748
1763
  cpSync(source.envExamplePath, join2(runtimeRoot, ".env.example"), {
@@ -1782,12 +1797,14 @@ function seedRuntimePreflightAssets(runtimeRoot) {
1782
1797
  writeTextFileIfMissing(join2(runtimeRoot, ".env"), `# Local PushPals runtime environment
1783
1798
  `);
1784
1799
  const localExamplePath = join2(runtimeRoot, "configs", "local.example.toml");
1800
+ const localTomlPath = join2(runtimeRoot, "configs", "local.toml");
1785
1801
  if (existsSync4(localExamplePath)) {
1786
- writeTextFileIfMissing(join2(runtimeRoot, "configs", "local.toml"), readFileSync4(localExamplePath, "utf8"));
1802
+ writeTextFileIfMissing(localTomlPath, readFileSync4(localExamplePath, "utf8"));
1787
1803
  } else {
1788
- writeTextFileIfMissing(join2(runtimeRoot, "configs", "local.toml"), `# Local PushPals runtime overrides
1804
+ writeTextFileIfMissing(localTomlPath, `# Local PushPals runtime overrides
1789
1805
  `);
1790
1806
  }
1807
+ migrateEmbeddedRuntimeLocalToml(localTomlPath);
1791
1808
  }
1792
1809
  async function fetchTextFromUrl(url, timeoutMs = 20000) {
1793
1810
  const response = await fetchWithTimeout(url, { headers: GITHUB_HEADERS }, timeoutMs);
@@ -1845,12 +1862,14 @@ async function ensureRuntimeAssets(runtimeRoot, runtimeTag) {
1845
1862
  writeTextFileIfMissing(join2(runtimeRoot, ".env"), `# Local PushPals runtime environment
1846
1863
  `);
1847
1864
  const localExamplePath = join2(runtimeRoot, "configs", "local.example.toml");
1865
+ const localTomlPath = join2(runtimeRoot, "configs", "local.toml");
1848
1866
  if (existsSync4(localExamplePath)) {
1849
- writeTextFileIfMissing(join2(runtimeRoot, "configs", "local.toml"), readFileSync4(localExamplePath, "utf8"));
1867
+ writeTextFileIfMissing(localTomlPath, readFileSync4(localExamplePath, "utf8"));
1850
1868
  } else {
1851
- writeTextFileIfMissing(join2(runtimeRoot, "configs", "local.toml"), `# Local PushPals runtime overrides
1869
+ writeTextFileIfMissing(localTomlPath, `# Local PushPals runtime overrides
1852
1870
  `);
1853
1871
  }
1872
+ migrateEmbeddedRuntimeLocalToml(localTomlPath);
1854
1873
  console.log("[pushpals] Embedded runtime assets are ready.");
1855
1874
  }
1856
1875
  function resolveDeferredRuntimeTagHint(explicitTag) {
@@ -1895,6 +1914,35 @@ function runtimeBinaryFilename(serviceName, platformKey) {
1895
1914
  const extension = platformKey.startsWith("windows-") ? ".exe" : "";
1896
1915
  return `pushpals-runtime-${serviceToken}-${platformKey}${extension}`;
1897
1916
  }
1917
+ function resolveRuntimeBinaryInstallState(runtimeRoot, platformKey) {
1918
+ const binDir = join2(runtimeRoot, "bin", platformKey);
1919
+ const tagMarkerPath = join2(binDir, ".runtime-tag");
1920
+ const installedTag = existsSync4(tagMarkerPath) ? readFileSync4(tagMarkerPath, "utf8").trim() : "";
1921
+ return { binDir, tagMarkerPath, installedTag };
1922
+ }
1923
+ function cleanupLegacyRuntimeBinaryLayouts(runtimeRoot, platformKey, activeBinDir) {
1924
+ const legacyRoot = join2(runtimeRoot, "bin");
1925
+ if (!existsSync4(legacyRoot))
1926
+ return;
1927
+ let entries;
1928
+ try {
1929
+ entries = readdirSync(legacyRoot, { withFileTypes: true });
1930
+ } catch {
1931
+ return;
1932
+ }
1933
+ for (const entry of entries) {
1934
+ if (!entry.isDirectory())
1935
+ continue;
1936
+ const candidateDir = join2(legacyRoot, entry.name);
1937
+ if (candidateDir === activeBinDir)
1938
+ continue;
1939
+ if (!entry.name.endsWith(`-${platformKey}`))
1940
+ continue;
1941
+ try {
1942
+ rmSync(candidateDir, { recursive: true, force: true });
1943
+ } catch {}
1944
+ }
1945
+ }
1898
1946
  function buildEmbeddedRuntimeEnv(baseEnv, opts) {
1899
1947
  const env = normalizeChildProcessEnv(baseEnv);
1900
1948
  const useRuntimeConfig = opts.useRuntimeConfig !== false;
@@ -2032,7 +2080,8 @@ async function downloadBinaryAsset(tag, assetName, outPath) {
2032
2080
  async function ensureRuntimeBinaries(runtimeRoot, runtimeTag) {
2033
2081
  const platformKey = resolveRuntimePlatformKey();
2034
2082
  console.log(`[pushpals] Preparing embedded runtime binaries for ${runtimeTag} (${platformKey})...`);
2035
- const binDir = join2(runtimeRoot, "bin", `${runtimeTag}-${platformKey}`);
2083
+ const installState = resolveRuntimeBinaryInstallState(runtimeRoot, platformKey);
2084
+ const { binDir, tagMarkerPath, installedTag } = installState;
2036
2085
  mkdirSync(binDir, { recursive: true });
2037
2086
  const runtimeBinaries = {
2038
2087
  server: join2(binDir, runtimeBinaryFilename("server", platformKey)),
@@ -2048,14 +2097,18 @@ async function ensureRuntimeBinaries(runtimeRoot, runtimeTag) {
2048
2097
  runtimeBinaries.workerpals,
2049
2098
  runtimeBinaries.sourceControlManager
2050
2099
  ];
2100
+ const shouldRefreshAll = installedTag !== runtimeTag;
2051
2101
  let downloadedCount = 0;
2052
2102
  for (const binaryPath of requiredAssets) {
2053
- if (existsSync4(binaryPath))
2103
+ if (!shouldRefreshAll && existsSync4(binaryPath))
2054
2104
  continue;
2055
2105
  const assetName = binaryPath.split(/[\\/]/).pop() || "";
2056
2106
  await downloadBinaryAsset(runtimeTag, assetName, binaryPath);
2057
2107
  downloadedCount++;
2058
2108
  }
2109
+ writeFileSync(tagMarkerPath, `${runtimeTag}
2110
+ `, "utf8");
2111
+ cleanupLegacyRuntimeBinaryLayouts(runtimeRoot, platformKey, binDir);
2059
2112
  if (process.platform !== "win32") {
2060
2113
  for (const binaryPath of requiredAssets) {
2061
2114
  try {
@@ -4326,6 +4379,7 @@ export {
4326
4379
  extractRemoteBuddySessionConsumerHealth,
4327
4380
  extractRemoteBuddyAutonomousEngineState,
4328
4381
  ensureWorkerpalDockerImageReady,
4382
+ ensureRuntimeBinaries,
4329
4383
  downloadRuntimeAssetsFromSourceTag,
4330
4384
  copyTrackedRepoPath,
4331
4385
  cleanupLingeringWorkerpalWarmContainers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushpalsdev/cli",
3
- "version": "1.0.25",
3
+ "version": "1.0.28",
4
4
  "description": "PushPals terminal CLI for LocalBuddy -> RemoteBuddy orchestration",
5
5
  "license": "MIT",
6
6
  "repository": {