@the-open-engine/zeroshot 6.6.0 → 6.7.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/bin/zeroshot-cluster-worker.js +16 -0
- package/cli/index.js +135 -12
- package/docs/openengine-cluster-protocol/v1/legacy-worker.md +117 -0
- package/lib/cluster-worker/contracts.js +194 -0
- package/lib/cluster-worker/engine-adapter.js +300 -0
- package/lib/cluster-worker/executable.js +229 -0
- package/lib/cluster-worker/index.d.ts +227 -0
- package/lib/cluster-worker/index.js +294 -0
- package/lib/cluster-worker/object-utils.js +17 -0
- package/lib/cluster-worker/process-stdio.js +37 -0
- package/lib/cluster-worker/profiles.js +81 -0
- package/lib/cluster-worker/runtime-engine.js +50 -0
- package/lib/cluster-worker/runtime-support.js +298 -0
- package/lib/cluster-worker/state-machine.js +147 -0
- package/lib/cluster-worker/terminal-normalizer.js +95 -0
- package/lib/cluster-worker/worker-internals.js +20 -0
- package/lib/detached-startup.js +127 -11
- package/lib/process-liveness.js +26 -0
- package/lib/start-cluster.js +93 -18
- package/package.json +8 -2
- package/protocol/openengine-cluster/v1/worker.schema.json +1174 -0
- package/scripts/assert-release-published.js +65 -11
- package/src/orchestrator.js +464 -61
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const { execFileSync } = require('child_process');
|
|
4
4
|
|
|
5
|
+
const DEFAULT_ATTEMPTS = 24;
|
|
6
|
+
const DEFAULT_DELAY_MS = 5000;
|
|
7
|
+
|
|
5
8
|
function run(command, args) {
|
|
6
9
|
return execFileSync(command, args, { encoding: 'utf8' }).trim();
|
|
7
10
|
}
|
|
@@ -22,32 +25,83 @@ function tagsPointingAtHead() {
|
|
|
22
25
|
.filter(Boolean);
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
function
|
|
28
|
+
function releaseTagParts(tag) {
|
|
29
|
+
const match = tag.match(/^v(\d+)\.(\d+)\.(\d+)$/);
|
|
30
|
+
if (!match) return null;
|
|
31
|
+
return match.slice(1).map((part) => Number(part));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function compareReleaseTags(left, right) {
|
|
35
|
+
const leftParts = releaseTagParts(left);
|
|
36
|
+
const rightParts = releaseTagParts(right);
|
|
37
|
+
for (let index = 0; index < leftParts.length; index += 1) {
|
|
38
|
+
if (leftParts[index] !== rightParts[index]) return leftParts[index] - rightParts[index];
|
|
39
|
+
}
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function latestReleaseTag(tags) {
|
|
44
|
+
const releaseTags = tags.filter((tag) => releaseTagParts(tag));
|
|
45
|
+
releaseTags.sort(compareReleaseTags);
|
|
46
|
+
return releaseTags.at(-1) || null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function sleep(ms) {
|
|
50
|
+
return new Promise((resolve) => {
|
|
51
|
+
setTimeout(resolve, ms);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function waitForNpmLatest(name, expectedVersion, options = {}) {
|
|
56
|
+
const attempts =
|
|
57
|
+
options.attempts || Number(process.env.RELEASE_ASSERT_ATTEMPTS || DEFAULT_ATTEMPTS);
|
|
58
|
+
const delayMs =
|
|
59
|
+
options.delayMs || Number(process.env.RELEASE_ASSERT_DELAY_MS || DEFAULT_DELAY_MS);
|
|
60
|
+
|
|
61
|
+
let latest = null;
|
|
62
|
+
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
63
|
+
latest = npmLatest(name);
|
|
64
|
+
if (latest === expectedVersion) return latest;
|
|
65
|
+
|
|
66
|
+
if (attempt < attempts) {
|
|
67
|
+
console.log(
|
|
68
|
+
`npm latest for ${name} is ${latest}; waiting for ${expectedVersion} (${attempt}/${attempts})`
|
|
69
|
+
);
|
|
70
|
+
await sleep(delayMs);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
throw new Error(`expected npm latest for ${name} to be ${expectedVersion}, got ${latest}`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async function main() {
|
|
26
78
|
const name = packageName();
|
|
27
|
-
const latest = npmLatest(name);
|
|
28
|
-
const expectedTag = `v${latest}`;
|
|
29
79
|
const headTags = tagsPointingAtHead();
|
|
80
|
+
const expectedTag = latestReleaseTag(headTags);
|
|
81
|
+
|
|
82
|
+
if (!expectedTag) {
|
|
83
|
+
throw new Error('expected a vX.Y.Z release tag to point at HEAD after release');
|
|
84
|
+
}
|
|
30
85
|
|
|
31
|
-
console.log(`npm latest for ${name}: ${latest}`);
|
|
32
86
|
console.log(`tags on HEAD: ${headTags.join(', ') || '(none)'}`);
|
|
87
|
+
const expectedVersion = expectedTag.slice(1);
|
|
88
|
+
const latest = await waitForNpmLatest(name, expectedVersion);
|
|
33
89
|
|
|
34
|
-
|
|
35
|
-
throw new Error(`expected ${expectedTag} to point at HEAD after release`);
|
|
36
|
-
}
|
|
90
|
+
console.log(`npm latest for ${name}: ${latest}`);
|
|
37
91
|
|
|
38
92
|
console.log(`Release publication verified: ${name}@${latest}`);
|
|
39
93
|
}
|
|
40
94
|
|
|
41
95
|
if (require.main === module) {
|
|
42
|
-
|
|
43
|
-
main();
|
|
44
|
-
} catch (error) {
|
|
96
|
+
main().catch((error) => {
|
|
45
97
|
console.error(`Release publication check failed: ${error.message}`);
|
|
46
98
|
process.exit(1);
|
|
47
|
-
}
|
|
99
|
+
});
|
|
48
100
|
}
|
|
49
101
|
|
|
50
102
|
module.exports = {
|
|
103
|
+
latestReleaseTag,
|
|
51
104
|
npmLatest,
|
|
52
105
|
tagsPointingAtHead,
|
|
106
|
+
waitForNpmLatest,
|
|
53
107
|
};
|