@tangle-network/agent-app 0.45.20 → 0.45.21

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.
@@ -100,7 +100,7 @@ import {
100
100
  flattenHistory,
101
101
  readSandboxBinaryBytes,
102
102
  statSandboxFileSize
103
- } from "../chunk-PAB253MA.js";
103
+ } from "../chunk-7V2I3JGZ.js";
104
104
  import "../chunk-TH7L265V.js";
105
105
  import "../chunk-LWSJK546.js";
106
106
  import "../chunk-ZSGTG6PK.js";
@@ -908,6 +908,7 @@ function isWellFormedDomainPattern(pattern) {
908
908
  if (head === "*" || head === "**") return labels.length >= 2;
909
909
  return !head.includes("*");
910
910
  }
911
+ var PYPI_EGRESS_DOMAINS = ["pypi.org", "files.pythonhosted.org", "pypi.python.org"];
911
912
  function buildProductEgressPolicy(publicOrigin, extraDomains = []) {
912
913
  const origin = typeof publicOrigin === "string" ? new URL(publicOrigin) : publicOrigin;
913
914
  if (origin.protocol !== "http:" && origin.protocol !== "https:") {
@@ -1626,7 +1627,7 @@ async function peekWorkspaceSandbox(shell, options) {
1626
1627
  return { status: "running", box: match };
1627
1628
  }
1628
1629
  async function finalizeExistingBox(shell, client, box, stage, name, workspaceId, userId, harness, scope) {
1629
- await assertExistingBoxEgress(box, shell.egressPolicy, stage, name);
1630
+ await assertExistingBoxEgress(box, shell.egressPolicy, shell.migrateEgressPolicy, stage, name);
1630
1631
  const written = await materializeDeferredFilesForExistingBox(
1631
1632
  shell,
1632
1633
  client,
@@ -1666,7 +1667,7 @@ function normalizedEgressPolicy(policy) {
1666
1667
  }
1667
1668
  return JSON.stringify(canonicalizeJson(normalized));
1668
1669
  }
1669
- async function assertExistingBoxEgress(box, desired, stage, name) {
1670
+ async function assertExistingBoxEgress(box, desired, migrate, stage, name) {
1670
1671
  if (!desired) return;
1671
1672
  let current;
1672
1673
  try {
@@ -1680,6 +1681,20 @@ async function assertExistingBoxEgress(box, desired, stage, name) {
1680
1681
  const matchingPolicy = normalizedEgressPolicy(current.policy) === normalizedEgressPolicy(desired);
1681
1682
  const explicitSource = current.source !== "platform";
1682
1683
  if (matchingPolicy && explicitSource) return;
1684
+ if (migrate) {
1685
+ try {
1686
+ await box.egress.update(desired);
1687
+ const migrated = await box.egress.get();
1688
+ const migratedPolicy = normalizedEgressPolicy(migrated.policy) === normalizedEgressPolicy(desired);
1689
+ if (migratedPolicy && migrated.source !== "platform") return;
1690
+ current = migrated;
1691
+ } catch (cause) {
1692
+ const error = cause instanceof Error ? cause : new Error(String(cause));
1693
+ throw new Error(`egress policy migration failed on ${stage} box ${name}: ${error.message}`, {
1694
+ cause: error
1695
+ });
1696
+ }
1697
+ }
1683
1698
  throw new SandboxEgressPolicyMismatchError(
1684
1699
  stage,
1685
1700
  name,
@@ -2253,6 +2268,7 @@ export {
2253
2268
  PREWARM_CLAIM_TABLE_DDL,
2254
2269
  createD1PrewarmClaimStore,
2255
2270
  resolveSandboxClientCredentials,
2271
+ PYPI_EGRESS_DOMAINS,
2256
2272
  buildProductEgressPolicy,
2257
2273
  DEFAULT_SIDECAR_PROCESS_PATTERN,
2258
2274
  DEFAULT_SANDBOX_RESOURCES,
@@ -2300,4 +2316,4 @@ export {
2300
2316
  isTerminalPromptEvent,
2301
2317
  detectInteractiveQuestion
2302
2318
  };
2303
- //# sourceMappingURL=chunk-PAB253MA.js.map
2319
+ //# sourceMappingURL=chunk-7V2I3JGZ.js.map