@lark-codem/codem-cli 0.1.269-dev.100103632283.0.gfe3587a → 0.1.269-dev.100103634215.0.gf6e5ccb
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/bin/worker-runtime.js +12 -3
- package/package.json +8 -8
package/bin/worker-runtime.js
CHANGED
|
@@ -31,7 +31,7 @@ async function confinedFile(root, relative) {
|
|
|
31
31
|
|
|
32
32
|
// Only installers write these immutable pair manifests. No npm resolution or
|
|
33
33
|
// floating global/current Core lookup happens in the execution process.
|
|
34
|
-
export async function readWorkerRuntime(root, family, { version = null } = {}) {
|
|
34
|
+
export async function readWorkerRuntime(root, family, { version = null, generation = null } = {}) {
|
|
35
35
|
if (!families.includes(family)) throw new Error('invalid worker runtime');
|
|
36
36
|
const familyRoot = path.join(root, family);
|
|
37
37
|
let pointerChannel = null;
|
|
@@ -41,14 +41,23 @@ export async function readWorkerRuntime(root, family, { version = null } = {}) {
|
|
|
41
41
|
const pointer = await readJSON(path.join(familyRoot, 'current.json'));
|
|
42
42
|
if (!EXACT_RUNTIME_VERSION.test(pointer.version)) throw new Error('invalid runtime pointer');
|
|
43
43
|
pointerChannel = pointer.channel;
|
|
44
|
-
|
|
44
|
+
version = pointer.version;
|
|
45
|
+
generation = pointer.generation ?? null;
|
|
46
|
+
runtimeRoot = path.join(familyRoot, 'versions', version);
|
|
45
47
|
} catch (error) { if (error.code !== 'ENOENT') throw error; }
|
|
48
|
+
if (generation !== null) {
|
|
49
|
+
if (typeof generation !== 'string' || !/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(generation) || !version) throw new Error('invalid runtime generation');
|
|
50
|
+
runtimeRoot = path.join(familyRoot, 'generations', generation, 'versions', version);
|
|
51
|
+
}
|
|
52
|
+
const relative = path.relative(await fs.realpath(familyRoot), await fs.realpath(runtimeRoot));
|
|
53
|
+
if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) throw new Error('runtime generation escapes family');
|
|
46
54
|
const manifest = await readJSON(path.join(runtimeRoot, 'runtime-manifest.json'));
|
|
47
55
|
if (manifest.schema !== 1 || manifest.family !== family || !EXACT_RUNTIME_VERSION.test(manifest.cliVersion) || !EXACT_RUNTIME_VERSION.test(manifest.coreVersion)) throw new Error('invalid runtime manifest');
|
|
48
56
|
if (manifest.workflowPrebound !== (family === 'current')) throw new Error('runtime architecture does not match family');
|
|
57
|
+
if (version && manifest.cliVersion !== version) throw new Error('runtime pointer version does not match pair');
|
|
49
58
|
const cliEntry = await confinedFile(runtimeRoot, manifest.cliEntry);
|
|
50
59
|
const corePath = await confinedFile(runtimeRoot, manifest.coreBinaryPath);
|
|
51
|
-
return { ...manifest, ...(pointerChannel ? { channel: pointerChannel } : {}), root: runtimeRoot, cliEntry, corePath };
|
|
60
|
+
return { ...manifest, ...(pointerChannel ? { channel: pointerChannel } : {}), generation, root: runtimeRoot, cliEntry, corePath };
|
|
52
61
|
}
|
|
53
62
|
|
|
54
63
|
function routeIdentity(env) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-codem/codem-cli",
|
|
3
|
-
"version": "0.1.269-dev.
|
|
3
|
+
"version": "0.1.269-dev.100103634215.0.gf6e5ccb",
|
|
4
4
|
"codemServiceManagementProtocol": 3,
|
|
5
5
|
"codemWorkerRuntimeProtocol": 1,
|
|
6
6
|
"codemProfileProtocol": 1,
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@lark-codem/codem-core": "0.8.86-dev.
|
|
33
|
+
"@lark-codem/codem-core": "0.8.86-dev.100103634215.0.g6f69da7",
|
|
34
34
|
"zod": "3.25.76",
|
|
35
35
|
"@lark-codem/lark-cli": "0.1.1"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|
|
38
|
-
"@lark-codem/codem-cli-darwin-arm64": "0.1.269-dev.
|
|
39
|
-
"@lark-codem/codem-cli-darwin-x64": "0.1.269-dev.
|
|
40
|
-
"@lark-codem/codem-cli-linux-arm64": "0.1.269-dev.
|
|
41
|
-
"@lark-codem/codem-cli-linux-x64": "0.1.269-dev.
|
|
42
|
-
"@lark-codem/codem-cli-win32-arm64": "0.1.269-dev.
|
|
43
|
-
"@lark-codem/codem-cli-win32-x64": "0.1.269-dev.
|
|
38
|
+
"@lark-codem/codem-cli-darwin-arm64": "0.1.269-dev.100103634215.0.gf6e5ccb",
|
|
39
|
+
"@lark-codem/codem-cli-darwin-x64": "0.1.269-dev.100103634215.0.gf6e5ccb",
|
|
40
|
+
"@lark-codem/codem-cli-linux-arm64": "0.1.269-dev.100103634215.0.gf6e5ccb",
|
|
41
|
+
"@lark-codem/codem-cli-linux-x64": "0.1.269-dev.100103634215.0.gf6e5ccb",
|
|
42
|
+
"@lark-codem/codem-cli-win32-arm64": "0.1.269-dev.100103634215.0.gf6e5ccb",
|
|
43
|
+
"@lark-codem/codem-cli-win32-x64": "0.1.269-dev.100103634215.0.gf6e5ccb"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=18"
|