@tangle-network/agent-app 3.0.34 → 3.0.35
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.
- package/dist/chat-routes/index.js +2 -2
- package/dist/{chunk-3FKIGI3I.js → chunk-5DG2LO3T.js} +37 -14
- package/dist/{chunk-3FKIGI3I.js.map → chunk-5DG2LO3T.js.map} +1 -1
- package/dist/{chunk-KNVFMTC2.js → chunk-VG27P322.js} +2 -2
- package/dist/public-consultation/index.js +2 -2
- package/dist/sandbox/configuration.d.ts +14 -1
- package/dist/sandbox/existing-box.d.ts +7 -0
- package/dist/sandbox/index.js +1 -1
- package/package.json +1 -1
- /package/dist/{chunk-KNVFMTC2.js.map → chunk-VG27P322.js.map} +0 -0
|
@@ -88,14 +88,14 @@ import {
|
|
|
88
88
|
turnPromptText,
|
|
89
89
|
valueRedactor,
|
|
90
90
|
withProducerStream
|
|
91
|
-
} from "../chunk-
|
|
91
|
+
} from "../chunk-VG27P322.js";
|
|
92
92
|
import "../chunk-SBHFMDR7.js";
|
|
93
93
|
import "../chunk-H6BRJU5M.js";
|
|
94
94
|
import "../chunk-4DBHC63F.js";
|
|
95
95
|
import "../chunk-RN4WPTBH.js";
|
|
96
96
|
import "../chunk-MM6RLOXF.js";
|
|
97
97
|
import "../chunk-M4QITAQV.js";
|
|
98
|
-
import "../chunk-
|
|
98
|
+
import "../chunk-5DG2LO3T.js";
|
|
99
99
|
import "../chunk-F4TUZYMX.js";
|
|
100
100
|
import {
|
|
101
101
|
redactErrorMessage
|
|
@@ -3491,14 +3491,43 @@ async function finalizeExistingBox(shell, client, box, stage, name, workspaceId,
|
|
|
3491
3491
|
const renewed = await pushRuntimeEnv(finalBox, runtimeEnv, void 0, deadline);
|
|
3492
3492
|
if (!renewed.succeeded) throw renewed.error;
|
|
3493
3493
|
}
|
|
3494
|
-
|
|
3495
|
-
const boot = await shell.bootstrap(finalBox, scope);
|
|
3496
|
-
if (!boot.succeeded) {
|
|
3497
|
-
throw new Error(`bootstrap failed on ${stage} box ${name}`, { cause: boot.error });
|
|
3498
|
-
}
|
|
3499
|
-
}
|
|
3494
|
+
await bootstrapBox(shell, finalBox, scope, harness, stage, name, false);
|
|
3500
3495
|
return finalBox;
|
|
3501
3496
|
}
|
|
3497
|
+
var BOOTSTRAP_MARKERS = '"$HOME/.agent-app/bootstrapped"';
|
|
3498
|
+
var BOOTSTRAP_MARKER_MAX_AGE_MINUTES = 24 * 60;
|
|
3499
|
+
async function bootstrapBox(shell, box, scope, harness, stage, name, fresh) {
|
|
3500
|
+
const bootstrap = shell.bootstrap;
|
|
3501
|
+
if (!bootstrap) return;
|
|
3502
|
+
const key = await bootstrapKey(shell, scope, harness);
|
|
3503
|
+
if (key !== void 0 && !fresh && await hasBootstrapMarker(box, key)) return;
|
|
3504
|
+
const boot = await bootstrap.call(shell, box, scope);
|
|
3505
|
+
if (!boot.succeeded) {
|
|
3506
|
+
throw new Error(`bootstrap failed on ${stage} box ${name}`, { cause: boot.error });
|
|
3507
|
+
}
|
|
3508
|
+
if (key !== void 0) await writeBootstrapMarker(box, key);
|
|
3509
|
+
}
|
|
3510
|
+
async function bootstrapKey(shell, scope, harness) {
|
|
3511
|
+
if (!shell.bootstrapDigest) return void 0;
|
|
3512
|
+
const build = await shell.bootstrapDigest(scope);
|
|
3513
|
+
if (!build) return void 0;
|
|
3514
|
+
const egress = shell.egressPolicy ? normalizedEgressPolicy(shell.egressPolicy) : null;
|
|
3515
|
+
return createHash2("sha256").update(JSON.stringify([build, harness, egress, scope.workspaceId, scope.userId ?? null]), "utf8").digest("hex");
|
|
3516
|
+
}
|
|
3517
|
+
async function hasBootstrapMarker(box, key) {
|
|
3518
|
+
try {
|
|
3519
|
+
const fresh = `find ${BOOTSTRAP_MARKERS} -maxdepth 1 -name ${key} -mmin -${BOOTSTRAP_MARKER_MAX_AGE_MINUTES} 2>/dev/null`;
|
|
3520
|
+
return (await box.exec(`test -n "$(${fresh})"`)).exitCode === 0;
|
|
3521
|
+
} catch {
|
|
3522
|
+
return false;
|
|
3523
|
+
}
|
|
3524
|
+
}
|
|
3525
|
+
async function writeBootstrapMarker(box, key) {
|
|
3526
|
+
try {
|
|
3527
|
+
await box.exec(`mkdir -p ${BOOTSTRAP_MARKERS} && : > ${BOOTSTRAP_MARKERS}/${key}`);
|
|
3528
|
+
} catch {
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3502
3531
|
function canonicalizeJson(value) {
|
|
3503
3532
|
if (Array.isArray(value)) return value.map(canonicalizeJson);
|
|
3504
3533
|
if (value === null || typeof value !== "object") return value;
|
|
@@ -3944,13 +3973,7 @@ async function provisionWorkspaceSandbox(shell, options, gate, reuseOnly) {
|
|
|
3944
3973
|
throw deferredProfileWriteFailed("new", name, written.error);
|
|
3945
3974
|
}
|
|
3946
3975
|
}
|
|
3947
|
-
if (shell.bootstrap)
|
|
3948
|
-
const bootstrap = shell.bootstrap.bind(shell);
|
|
3949
|
-
const boot = await measure("bootstrap", () => bootstrap(box, scope));
|
|
3950
|
-
if (!boot.succeeded) {
|
|
3951
|
-
throw new Error(`bootstrap failed on new box ${name}`, { cause: boot.error });
|
|
3952
|
-
}
|
|
3953
|
-
}
|
|
3976
|
+
if (shell.bootstrap) await measure("bootstrap", () => bootstrapBox(shell, box, scope, harness, "new", name, true));
|
|
3954
3977
|
return rememberRunningBox(name, box);
|
|
3955
3978
|
}
|
|
3956
3979
|
async function prepareWorkspacePayload(shell, workspaceId, userId, scope, harness, name, recoveryRestore, resources, billingOwnerId, signal) {
|
|
@@ -4334,4 +4357,4 @@ export {
|
|
|
4334
4357
|
deleteSecret,
|
|
4335
4358
|
mintSandboxScopedToken
|
|
4336
4359
|
};
|
|
4337
|
-
//# sourceMappingURL=chunk-
|
|
4360
|
+
//# sourceMappingURL=chunk-5DG2LO3T.js.map
|