@foldrun/core 20.2.0 → 20.3.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.
- package/dist/src/runtime.d.ts +7 -0
- package/dist/src/runtime.js +9 -2
- package/package.json +1 -1
- package/src/runtime.ts +10 -2
package/dist/src/runtime.d.ts
CHANGED
|
@@ -39,6 +39,13 @@ export declare function parseRuntime(raw: unknown): RuntimeSpec | null;
|
|
|
39
39
|
* say so, loudly, at build time — better than one of them silently winning.
|
|
40
40
|
*/
|
|
41
41
|
export declare function mergeRuntimes(...specs: (RuntimeSpec | null | undefined)[]): RuntimeSpec | null;
|
|
42
|
+
/**
|
|
43
|
+
* The file a platform drops in a cache entry it unpacked from its object store
|
|
44
|
+
* (foldrun-platform runtime-archives.ts), naming the archive it came from. A
|
|
45
|
+
* rebuild removes it with the rest of the entry, so "ready, and no marker" is
|
|
46
|
+
* an entry built here, which is the one worth keeping for the next sandbox.
|
|
47
|
+
*/
|
|
48
|
+
export declare const RUNTIME_FROM_STORE = ".from-store";
|
|
42
49
|
export declare function fingerprint(spec: RuntimeSpec): string;
|
|
43
50
|
/**
|
|
44
51
|
* A tenant name that is safe as one path segment. Tenants come from account
|
package/dist/src/runtime.js
CHANGED
|
@@ -123,6 +123,13 @@ export function mergeRuntimes(...specs) {
|
|
|
123
123
|
merged.ignored = ignored;
|
|
124
124
|
return merged;
|
|
125
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* The file a platform drops in a cache entry it unpacked from its object store
|
|
128
|
+
* (foldrun-platform runtime-archives.ts), naming the archive it came from. A
|
|
129
|
+
* rebuild removes it with the rest of the entry, so "ready, and no marker" is
|
|
130
|
+
* an entry built here, which is the one worth keeping for the next sandbox.
|
|
131
|
+
*/
|
|
132
|
+
export const RUNTIME_FROM_STORE = ".from-store";
|
|
126
133
|
export function fingerprint(spec) {
|
|
127
134
|
const canonical = JSON.stringify({
|
|
128
135
|
python: spec.python ?? null,
|
|
@@ -1142,7 +1149,7 @@ FOLDRUN_SNAPSHOT_JS
|
|
|
1142
1149
|
$AS sh -c '${PRUNE_SH}' sh "$S" "${cacheDir}" 2>/dev/null
|
|
1143
1150
|
fi
|
|
1144
1151
|
fi
|
|
1145
|
-
printf '{"ok": %s, "exit": %s, "seconds": %s, "mode": "%s", "stale": %s, "packages": "%s", "refused": "%s", "unsaved": "%s"}\n' "$([ $RC -eq 0 ] && echo true || echo false)" "$RC" "$(( $(date +%s) - T0 ))" "$MODE" "$STALE" "$SYS" "$WHY" "$UNSAVED" > ${logDir}/system-install.json
|
|
1152
|
+
printf '{"ok": %s, "exit": %s, "seconds": %s, "mode": "%s", "stale": %s, "packages": "%s", "refused": "%s", "unsaved": "%s", "key": "%s"}\n' "$([ $RC -eq 0 ] && echo true || echo false)" "$RC" "$(( $(date +%s) - T0 ))" "$MODE" "$STALE" "$SYS" "$WHY" "$UNSAVED" "$KEY" > ${logDir}/system-install.json
|
|
1146
1153
|
[ -n "$W" ] && rm -rf "$W"
|
|
1147
1154
|
rm -rf /var/lib/apt/lists/* 2>/dev/null || true
|
|
1148
1155
|
fi`;
|
|
@@ -1287,7 +1294,7 @@ function prepareLanguageRuntime(tenant, spec) {
|
|
|
1287
1294
|
if (stale || !fs.existsSync(path.join(shared, ".ready"))) {
|
|
1288
1295
|
// A clean slate: whatever a stale or half-finished build left behind is
|
|
1289
1296
|
// exactly what must not be built on top of.
|
|
1290
|
-
for (const leftover of [".ready", "venv", "node_modules", "package.json", "package-lock.json"]) {
|
|
1297
|
+
for (const leftover of [".ready", RUNTIME_FROM_STORE, "venv", "node_modules", "package.json", "package-lock.json"]) {
|
|
1291
1298
|
fs.rmSync(path.join(shared, leftover), { recursive: true, force: true });
|
|
1292
1299
|
}
|
|
1293
1300
|
}
|
package/package.json
CHANGED
package/src/runtime.ts
CHANGED
|
@@ -141,6 +141,14 @@ export function mergeRuntimes(...specs: (RuntimeSpec | null | undefined)[]): Run
|
|
|
141
141
|
return merged;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* The file a platform drops in a cache entry it unpacked from its object store
|
|
146
|
+
* (foldrun-platform runtime-archives.ts), naming the archive it came from. A
|
|
147
|
+
* rebuild removes it with the rest of the entry, so "ready, and no marker" is
|
|
148
|
+
* an entry built here, which is the one worth keeping for the next sandbox.
|
|
149
|
+
*/
|
|
150
|
+
export const RUNTIME_FROM_STORE = ".from-store";
|
|
151
|
+
|
|
144
152
|
export function fingerprint(spec: RuntimeSpec): string {
|
|
145
153
|
const canonical = JSON.stringify({
|
|
146
154
|
python: spec.python ?? null,
|
|
@@ -1190,7 +1198,7 @@ FOLDRUN_SNAPSHOT_JS
|
|
|
1190
1198
|
$AS sh -c '${PRUNE_SH}' sh "$S" "${cacheDir}" 2>/dev/null
|
|
1191
1199
|
fi
|
|
1192
1200
|
fi
|
|
1193
|
-
printf '{"ok": %s, "exit": %s, "seconds": %s, "mode": "%s", "stale": %s, "packages": "%s", "refused": "%s", "unsaved": "%s"}\n' "$([ $RC -eq 0 ] && echo true || echo false)" "$RC" "$(( $(date +%s) - T0 ))" "$MODE" "$STALE" "$SYS" "$WHY" "$UNSAVED" > ${logDir}/system-install.json
|
|
1201
|
+
printf '{"ok": %s, "exit": %s, "seconds": %s, "mode": "%s", "stale": %s, "packages": "%s", "refused": "%s", "unsaved": "%s", "key": "%s"}\n' "$([ $RC -eq 0 ] && echo true || echo false)" "$RC" "$(( $(date +%s) - T0 ))" "$MODE" "$STALE" "$SYS" "$WHY" "$UNSAVED" "$KEY" > ${logDir}/system-install.json
|
|
1194
1202
|
[ -n "$W" ] && rm -rf "$W"
|
|
1195
1203
|
rm -rf /var/lib/apt/lists/* 2>/dev/null || true
|
|
1196
1204
|
fi`;
|
|
@@ -1338,7 +1346,7 @@ function prepareLanguageRuntime(tenant: string, spec: RuntimeSpec): PreparedRunt
|
|
|
1338
1346
|
if (stale || !fs.existsSync(path.join(shared, ".ready"))) {
|
|
1339
1347
|
// A clean slate: whatever a stale or half-finished build left behind is
|
|
1340
1348
|
// exactly what must not be built on top of.
|
|
1341
|
-
for (const leftover of [".ready", "venv", "node_modules", "package.json", "package-lock.json"]) {
|
|
1349
|
+
for (const leftover of [".ready", RUNTIME_FROM_STORE, "venv", "node_modules", "package.json", "package-lock.json"]) {
|
|
1342
1350
|
fs.rmSync(path.join(shared, leftover), { recursive: true, force: true });
|
|
1343
1351
|
}
|
|
1344
1352
|
}
|