@tangle-network/agent-app 0.44.40 → 0.44.41
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.
|
@@ -1411,6 +1411,7 @@ async function peekWorkspaceSandbox(shell, options) {
|
|
|
1411
1411
|
return { status: "running", box: match };
|
|
1412
1412
|
}
|
|
1413
1413
|
async function finalizeExistingBox(shell, client, box, stage, name, workspaceId, userId, harness, scope) {
|
|
1414
|
+
await reconcileExistingBoxEgress(box, shell.egressPolicy, stage, name);
|
|
1414
1415
|
const written = await materializeDeferredFilesForExistingBox(
|
|
1415
1416
|
shell,
|
|
1416
1417
|
client,
|
|
@@ -1433,6 +1434,40 @@ async function finalizeExistingBox(shell, client, box, stage, name, workspaceId,
|
|
|
1433
1434
|
}
|
|
1434
1435
|
return finalBox;
|
|
1435
1436
|
}
|
|
1437
|
+
function normalizedEgressPolicy(policy) {
|
|
1438
|
+
if (policy.mode !== "strict") return policy.mode;
|
|
1439
|
+
const allowDomains = [...new Set(
|
|
1440
|
+
(policy.allowDomains ?? []).map((domain) => domain.trim().toLowerCase()).filter(Boolean)
|
|
1441
|
+
)].sort();
|
|
1442
|
+
return JSON.stringify({
|
|
1443
|
+
mode: policy.mode,
|
|
1444
|
+
allowDomains,
|
|
1445
|
+
includeImplicitDomains: policy.includeImplicitDomains !== false
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
async function reconcileExistingBoxEgress(box, desired, stage, name) {
|
|
1449
|
+
if (!desired) return;
|
|
1450
|
+
let current;
|
|
1451
|
+
try {
|
|
1452
|
+
current = await box.egress.get();
|
|
1453
|
+
} catch (cause) {
|
|
1454
|
+
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
1455
|
+
throw new Error(`egress policy read failed on ${stage} box ${name}: ${error.message}`, {
|
|
1456
|
+
cause: error
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
const matchingPolicy = normalizedEgressPolicy(current.policy) === normalizedEgressPolicy(desired);
|
|
1460
|
+
const effectiveSource = desired.mode !== "open" || current.source !== "platform";
|
|
1461
|
+
if (matchingPolicy && effectiveSource) return;
|
|
1462
|
+
try {
|
|
1463
|
+
await box.egress.update(desired);
|
|
1464
|
+
} catch (cause) {
|
|
1465
|
+
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
1466
|
+
throw new Error(`egress policy update failed on ${stage} box ${name}: ${error.message}`, {
|
|
1467
|
+
cause: error
|
|
1468
|
+
});
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1436
1471
|
async function ensureWorkspaceSandbox(shell, options) {
|
|
1437
1472
|
const { workspaceId, userId, harness, forceNew, onProgress, billingOwnerId } = options;
|
|
1438
1473
|
const resolved = await resolveWorkspaceSandboxClient(shell, workspaceId, userId);
|
|
@@ -1565,6 +1600,7 @@ async function ensureWorkspaceSandbox(shell, options) {
|
|
|
1565
1600
|
backend: { type: harness, profile, ...model ? { model } : {} },
|
|
1566
1601
|
...storage ? { storage } : {},
|
|
1567
1602
|
...restore ? restore : {},
|
|
1603
|
+
...shell.egressPolicy ? { egressPolicy: shell.egressPolicy } : {},
|
|
1568
1604
|
...shell.webTerminalEnabled ? { webTerminalEnabled: true } : {},
|
|
1569
1605
|
maxLifetimeSeconds: resources.maxLifetimeSeconds,
|
|
1570
1606
|
idleTimeoutSeconds: resources.idleTimeoutSeconds,
|
|
@@ -1978,4 +2014,4 @@ export {
|
|
|
1978
2014
|
isTerminalPromptEvent,
|
|
1979
2015
|
detectInteractiveQuestion
|
|
1980
2016
|
};
|
|
1981
|
-
//# sourceMappingURL=chunk-
|
|
2017
|
+
//# sourceMappingURL=chunk-HUBACCOP.js.map
|