run402-mcp 2.26.0 → 2.28.0

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.
Files changed (43) hide show
  1. package/README.md +2 -1
  2. package/core/dist/allowance.d.ts +0 -20
  3. package/core/dist/allowance.d.ts.map +1 -1
  4. package/core/dist/allowance.js +24 -1
  5. package/core/dist/allowance.js.map +1 -1
  6. package/core/dist/config.d.ts +26 -0
  7. package/core/dist/config.d.ts.map +1 -1
  8. package/core/dist/config.js +75 -3
  9. package/core/dist/config.js.map +1 -1
  10. package/core/dist/profiles.d.ts +60 -0
  11. package/core/dist/profiles.d.ts.map +1 -0
  12. package/core/dist/profiles.js +196 -0
  13. package/core/dist/profiles.js.map +1 -0
  14. package/dist/config.d.ts +2 -1
  15. package/dist/config.d.ts.map +1 -1
  16. package/dist/config.js +2 -1
  17. package/dist/config.js.map +1 -1
  18. package/dist/tools/status.d.ts.map +1 -1
  19. package/dist/tools/status.js +8 -0
  20. package/dist/tools/status.js.map +1 -1
  21. package/package.json +3 -3
  22. package/sdk/core-dist/allowance.d.ts +0 -20
  23. package/sdk/core-dist/allowance.js +24 -1
  24. package/sdk/core-dist/config.d.ts +26 -0
  25. package/sdk/core-dist/config.js +75 -3
  26. package/sdk/core-dist/profiles.d.ts +60 -0
  27. package/sdk/core-dist/profiles.js +196 -0
  28. package/sdk/dist/credentials.d.ts +16 -0
  29. package/sdk/dist/credentials.d.ts.map +1 -1
  30. package/sdk/dist/index.d.ts +24 -0
  31. package/sdk/dist/index.d.ts.map +1 -1
  32. package/sdk/dist/index.js +30 -0
  33. package/sdk/dist/index.js.map +1 -1
  34. package/sdk/dist/namespaces/deploy.js +73 -1
  35. package/sdk/dist/namespaces/deploy.js.map +1 -1
  36. package/sdk/dist/namespaces/wallets.d.ts +35 -0
  37. package/sdk/dist/namespaces/wallets.d.ts.map +1 -0
  38. package/sdk/dist/namespaces/wallets.js +50 -0
  39. package/sdk/dist/namespaces/wallets.js.map +1 -0
  40. package/sdk/dist/node/credentials.d.ts +2 -1
  41. package/sdk/dist/node/credentials.d.ts.map +1 -1
  42. package/sdk/dist/node/credentials.js +11 -1
  43. package/sdk/dist/node/credentials.js.map +1 -1
@@ -1688,6 +1688,71 @@ function validateFunctionMap(value, resource) {
1688
1688
  }
1689
1689
  }
1690
1690
  }
1691
+ /**
1692
+ * Detect a site path key that belongs to the `@run402/astro` SSR adapter's
1693
+ * build tree rather than to deployable static content. The adapter writes
1694
+ * `dist/run402/{adapter.json, server/**, client/**}`; only `client/**` is
1695
+ * servable. `adapter.json` and `server/**` are build internals — their
1696
+ * presence in a site spec means the caller rooted their file source at the
1697
+ * build root (`dist/`) instead of `dist/run402/client/`.
1698
+ */
1699
+ function isAstroAdapterTreeSitePath(path) {
1700
+ return path === "run402/adapter.json" || path.startsWith("run402/server/");
1701
+ }
1702
+ /**
1703
+ * Return the synchronously-knowable keys of a site file container. Plain
1704
+ * path-keyed `FileSet`s expose their keys directly; a `LocalDirRef`
1705
+ * (`dir(path)`) or any future source sentinel carries an `__source` marker
1706
+ * and is only knowable after expansion — those return `[]` here and are
1707
+ * re-checked post-normalization.
1708
+ */
1709
+ function siteFileSetKeysForGuard(container) {
1710
+ if (!container ||
1711
+ typeof container !== "object" ||
1712
+ Array.isArray(container) ||
1713
+ container.__source !== undefined) {
1714
+ return [];
1715
+ }
1716
+ return Object.keys(container);
1717
+ }
1718
+ /**
1719
+ * Reject a site slice that ships the `@run402/astro` adapter build tree as
1720
+ * static content. This is the mis-rooting behind kychee-com/run402#411: a
1721
+ * deploy pointed `fileSetFromDir`/`dir()` at `dist/` (not `dist/run402/client/`),
1722
+ * so every page landed under a `run402/client/` path prefix while
1723
+ * `run402/adapter.json` + `run402/server/**` leaked in as assets — producing a
1724
+ * release that 404'd every URL and exposed the SSR bundle. Fail fast, locally,
1725
+ * with the fix, before any CAS upload or plan.
1726
+ */
1727
+ function assertNoAstroAdapterTreeInSite(paths, resource) {
1728
+ const offenders = [];
1729
+ for (const p of paths) {
1730
+ if (isAstroAdapterTreeSitePath(p))
1731
+ offenders.push(p);
1732
+ if (offenders.length >= 3)
1733
+ break;
1734
+ }
1735
+ if (offenders.length === 0)
1736
+ return;
1737
+ throw new Run402DeployError(`${resource} ships the @run402/astro adapter build tree (e.g. ${offenders
1738
+ .map((p) => `\`${p}\``)
1739
+ .join(", ")}) as static content. Only \`dist/run402/client/\` is deployable; ` +
1740
+ `\`run402/adapter.json\` and \`run402/server/**\` are build internals. You likely ` +
1741
+ `rooted your file source at the build root (\`dist/\`) instead of \`dist/run402/client/\`. ` +
1742
+ `Use \`buildAstroReleaseSlice("dist")\` from @run402/astro (it roots the site and bundles ` +
1743
+ `the SSR function correctly), or point your dir at \`dist/run402/client\`.`, {
1744
+ code: "ASTRO_ADAPTER_TREE_IN_SITE",
1745
+ phase: "validate",
1746
+ resource,
1747
+ retryable: false,
1748
+ fix: {
1749
+ action: "reroot_site_to_astro_client_dir",
1750
+ path: resource,
1751
+ expected_dir: "dist/run402/client",
1752
+ },
1753
+ context: "validating spec",
1754
+ });
1755
+ }
1691
1756
  function validateSiteSpec(site) {
1692
1757
  if (site === undefined)
1693
1758
  return;
@@ -1701,12 +1766,15 @@ function validateSiteSpec(site) {
1701
1766
  }
1702
1767
  if (obj.replace !== undefined) {
1703
1768
  requireObject(obj.replace, "site.replace");
1769
+ assertNoAstroAdapterTreeInSite(siteFileSetKeysForGuard(obj.replace), "site.replace");
1704
1770
  }
1705
1771
  if (obj.patch !== undefined) {
1706
1772
  const patch = requireObject(obj.patch, "site.patch");
1707
1773
  validateKnownFields(patch, "site.patch", SITE_PATCH_FIELDS);
1708
- if (patch.put !== undefined)
1774
+ if (patch.put !== undefined) {
1709
1775
  requireObject(patch.put, "site.patch.put");
1776
+ assertNoAstroAdapterTreeInSite(siteFileSetKeysForGuard(patch.put), "site.patch.put");
1777
+ }
1710
1778
  if (patch.delete !== undefined)
1711
1779
  validateStringArray(patch.delete, "site.patch.delete");
1712
1780
  }
@@ -2399,6 +2467,9 @@ async function normalizeReleaseSpec(client, spec) {
2399
2467
  const publicPaths = "public_paths" in spec.site ? spec.site.public_paths : undefined;
2400
2468
  if ("replace" in spec.site && spec.site.replace) {
2401
2469
  const map = await normalizeFileSet(spec.site.replace, rememberRelease);
2470
+ // Re-check post-expansion so `dir("dist")` (a LocalDirRef whose keys are
2471
+ // unknown at validateSpec time) is caught too, not just literal FileSets.
2472
+ assertNoAstroAdapterTreeInSite(Object.keys(map), "site.replace");
2402
2473
  normalized.site = {
2403
2474
  replace: map,
2404
2475
  ...(publicPaths ? { public_paths: publicPaths } : {}),
@@ -2408,6 +2479,7 @@ async function normalizeReleaseSpec(client, spec) {
2408
2479
  const patch = {};
2409
2480
  if (spec.site.patch.put) {
2410
2481
  patch.put = await normalizeFileSet(spec.site.patch.put, rememberRelease);
2482
+ assertNoAstroAdapterTreeInSite(Object.keys(patch.put), "site.patch.put");
2411
2483
  }
2412
2484
  if (spec.site.patch.delete)
2413
2485
  patch.delete = spec.site.patch.delete;