mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 04:15:48 -06:00
6c9916a48a
* feat(runners): publish atomic node inventory # Conflicts: # docs/.generated/plugin-sdk-api-baseline/agent-harness-runtime.json # src/gateway/server-methods/environments.ts # src/gateway/worker-environments/device-provider.test.ts * fix(runners): refresh topology on inventory removal * fix(runners): resolve session host type overlap * fix(protocol): document mobile runner inventory event * fix(runners): project authoritative session host state * docs(nodes): clarify prepared session host status
29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import type { WorkerAdmissionHandshake } from "../../packages/gateway-protocol/src/schema/worker-admission.js";
|
|
|
|
export type ExpectedWorkerBuild = {
|
|
bundleHash: WorkerAdmissionHandshake["bundleHash"];
|
|
openclawVersion: WorkerAdmissionHandshake["openclawVersion"];
|
|
protocolFeatures: readonly string[];
|
|
};
|
|
|
|
export function sameWorkerProtocolFeatures(
|
|
left: readonly string[],
|
|
right: readonly string[],
|
|
): boolean {
|
|
const normalizedLeft = left.toSorted();
|
|
const normalizedRight = right.toSorted();
|
|
return (
|
|
normalizedLeft.length === normalizedRight.length &&
|
|
normalizedLeft.every((value, index) => value === normalizedRight[index])
|
|
);
|
|
}
|
|
|
|
/** Compares the exact worker build while treating protocol features as an unordered set. */
|
|
export function sameWorkerBuild(left: ExpectedWorkerBuild, right: ExpectedWorkerBuild): boolean {
|
|
return (
|
|
left.bundleHash === right.bundleHash &&
|
|
left.openclawVersion === right.openclawVersion &&
|
|
sameWorkerProtocolFeatures(left.protocolFeatures, right.protocolFeatures)
|
|
);
|
|
}
|