@evomap/evolver-proxy 2.0.50 → 2.0.52
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/bin/evolver-proxy.d.ts +3 -1
- package/dist/bin/evolver-proxy.js +6 -0
- package/dist/daemon/backgroundCuration.d.ts +5 -2
- package/dist/daemon/backgroundCuration.js +5 -2
- package/dist/daemon/proxyDaemon.d.ts +4 -0
- package/dist/daemon/proxyDaemon.js +16 -3
- package/dist/lifecycle/claimNudge.js +1 -1
- package/dist/lifecycle/deployGuard.js +1 -1
- package/dist/lifecycle/legacyNodeId.js +1 -1
- package/dist/lifecycle/manager.js +1 -1
- package/dist/llm/index.js +1 -1
- package/dist/llm/server.js +1 -1
- package/dist/llm/traceBackfill.js +1 -1
- package/dist/llm/traceConfig.js +1 -1
- package/dist/llm/traceControl.js +1 -1
- package/dist/llm/traceEnvelope.js +1 -1
- package/dist/llm/traceSink.js +1 -1
- package/dist/llm/traceUploadPayload.js +1 -1
- package/dist/llm/upstream.js +1 -1
- package/dist/router/cachePassthrough.js +1 -1
- package/dist/router/features.js +1 -1
- package/dist/router/index.js +1 -1
- package/dist/router/messagesRoute.js +1 -1
- package/dist/router/modelRouter.js +1 -1
- package/dist/router/providerRoutes.js +1 -1
- package/dist/router/sseScan.js +1 -1
- package/dist/selfUpdate/transaction.js +108 -18
- package/dist/sync/engine.js +1 -1
- package/package.json +3 -3
|
@@ -4,9 +4,9 @@ import { constants, fstatSync, watch } from 'node:fs';
|
|
|
4
4
|
import { chmod, link, lstat, mkdir, open, realpath, rename, rm, writeFile, } from 'node:fs/promises';
|
|
5
5
|
import { basename, dirname, isAbsolute, join, resolve, win32 } from 'node:path';
|
|
6
6
|
import { promisify } from 'node:util';
|
|
7
|
-
import { assetstore, ops } from '@evomap/evolver-core';
|
|
7
|
+
import { assetstore, ops, util } from '@evomap/evolver-core';
|
|
8
8
|
import { resolveSelfUpdateTarget } from './releaseBinary.js';
|
|
9
|
-
import { SELF_UPDATE_FAILURE_CODES, selfUpdateFailure } from './failureCodes.js';
|
|
9
|
+
import { SELF_UPDATE_FAILURE_CODES, SelfUpdateFailureError, selfUpdateFailure } from './failureCodes.js';
|
|
10
10
|
import { bindWindowsManagedExecutable, prepareWindowsExecutableSwap, resolveWindowsUpdaterPaths, } from './windowsUpdater.js';
|
|
11
11
|
const execFileAsync = promisify(execFile);
|
|
12
12
|
const JOURNAL_SCHEMA_VERSION = 2;
|
|
@@ -896,10 +896,58 @@ async function captureArtifactAliasWitnesses(paths) {
|
|
|
896
896
|
}
|
|
897
897
|
return Promise.all([...names].map(captureArtifactAliasWitness));
|
|
898
898
|
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
899
|
+
function kernelAliasFailure(cause) {
|
|
900
|
+
return selfUpdateFailure(SELF_UPDATE_FAILURE_CODES.UNSAFE_UPDATE_PATH, cause instanceof util.DarwinVnodeWitnessError && cause.code === 'changed'
|
|
901
|
+
? 'state_alias_changed_during_callback' : 'state_alias_observation_unconfirmed', { cause });
|
|
902
|
+
}
|
|
903
|
+
function observeKernelAliases(aliases) {
|
|
904
|
+
let kernel;
|
|
905
|
+
try {
|
|
906
|
+
kernel = util.createDarwinVnodeWitness(aliases);
|
|
907
|
+
}
|
|
908
|
+
catch (cause) {
|
|
909
|
+
throw kernelAliasFailure(cause);
|
|
910
|
+
}
|
|
911
|
+
const assertUnchanged = () => {
|
|
912
|
+
try {
|
|
913
|
+
kernel.assertUnchanged();
|
|
914
|
+
}
|
|
915
|
+
catch (cause) {
|
|
916
|
+
throw kernelAliasFailure(cause);
|
|
917
|
+
}
|
|
918
|
+
};
|
|
919
|
+
return {
|
|
920
|
+
checkpoint: assertUnchanged,
|
|
921
|
+
settle: assertUnchanged,
|
|
922
|
+
close: async () => {
|
|
923
|
+
try {
|
|
924
|
+
kernel.close();
|
|
925
|
+
return [];
|
|
926
|
+
}
|
|
927
|
+
catch (cause) {
|
|
928
|
+
return [kernelAliasFailure(cause)];
|
|
929
|
+
}
|
|
930
|
+
},
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
async function watchAliasNames(aliases) {
|
|
934
|
+
const watchers = [];
|
|
935
|
+
const observationFailures = [];
|
|
902
936
|
let renamed = false, uncertain = false;
|
|
937
|
+
const close = async () => {
|
|
938
|
+
const failures = [], pending = [];
|
|
939
|
+
for (const { watcher, closed } of watchers) {
|
|
940
|
+
try {
|
|
941
|
+
watcher.close();
|
|
942
|
+
pending.push(closed);
|
|
943
|
+
}
|
|
944
|
+
catch (error) {
|
|
945
|
+
failures.push(error);
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
await Promise.all(pending);
|
|
949
|
+
return [...observationFailures, ...failures];
|
|
950
|
+
};
|
|
903
951
|
try {
|
|
904
952
|
for (const alias of aliases) {
|
|
905
953
|
const name = basename(alias.path);
|
|
@@ -912,28 +960,70 @@ async function observeArtifactPublicationAliases(paths, callback) {
|
|
|
912
960
|
if (event === 'rename' && (process.platform === 'win32' ? current.toLowerCase() === name.toLowerCase() : current === name))
|
|
913
961
|
renamed = true;
|
|
914
962
|
});
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
963
|
+
const closed = new Promise(resolve => {
|
|
964
|
+
watcher.once('close', resolve);
|
|
965
|
+
watcher.on('error', cause => {
|
|
966
|
+
uncertain = true;
|
|
967
|
+
observationFailures.push(selfUpdateFailure(SELF_UPDATE_FAILURE_CODES.UNSAFE_UPDATE_PATH, 'state_alias_observation_unconfirmed', { cause }));
|
|
968
|
+
// Node closes a failed native watcher without emitting its close event.
|
|
969
|
+
resolve();
|
|
970
|
+
});
|
|
971
|
+
});
|
|
972
|
+
watchers.push({ watcher, closed });
|
|
918
973
|
}
|
|
919
|
-
|
|
974
|
+
}
|
|
975
|
+
catch (error) {
|
|
976
|
+
throwAliasObservationOutcome({ failed: true, error }, await close());
|
|
977
|
+
throw error;
|
|
978
|
+
}
|
|
979
|
+
return {
|
|
980
|
+
checkpoint: () => undefined,
|
|
981
|
+
settle: () => {
|
|
982
|
+
if (renamed)
|
|
983
|
+
throw selfUpdateFailure(SELF_UPDATE_FAILURE_CODES.UNSAFE_UPDATE_PATH, 'state_alias_changed_during_callback');
|
|
984
|
+
if (uncertain)
|
|
985
|
+
throw selfUpdateFailure(SELF_UPDATE_FAILURE_CODES.UNSAFE_UPDATE_PATH, 'state_alias_observation_unconfirmed');
|
|
986
|
+
},
|
|
987
|
+
close,
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
function throwAliasObservationOutcome(outcome, failures) {
|
|
991
|
+
if (outcome.failed && !failures.length)
|
|
992
|
+
throw outcome.error;
|
|
993
|
+
if (outcome.failed) {
|
|
994
|
+
const primary = outcome.error;
|
|
995
|
+
const combined = new AggregateError([primary, ...failures], 'state_alias_observation_and_cleanup_failed', { cause: primary });
|
|
996
|
+
// Keep the primary wire classification while retaining every original failure without mutating its cause.
|
|
997
|
+
if (primary instanceof SelfUpdateFailureError)
|
|
998
|
+
throw selfUpdateFailure(primary.failureCode, primary.message, { cause: combined });
|
|
999
|
+
throw combined;
|
|
1000
|
+
}
|
|
1001
|
+
if (failures.length === 1)
|
|
1002
|
+
throw failures[0];
|
|
1003
|
+
if (failures.length)
|
|
1004
|
+
throw new AggregateError(failures, 'state_alias_observation_cleanup_failed');
|
|
1005
|
+
}
|
|
1006
|
+
async function observeArtifactPublicationAliases(paths, callback) {
|
|
1007
|
+
const aliases = await captureArtifactAliasWitnesses(paths);
|
|
1008
|
+
const observer = process.platform === 'darwin' ? observeKernelAliases(aliases) : await watchAliasNames(aliases);
|
|
1009
|
+
let outcome = { failed: false };
|
|
1010
|
+
try {
|
|
1011
|
+
// Observe only the bound names: legitimate sibling journal writes do not invalidate the callback.
|
|
920
1012
|
await assertStateRootAlias(paths);
|
|
921
1013
|
await assertArtifactAliasWitnesses(aliases);
|
|
1014
|
+
observer.checkpoint();
|
|
922
1015
|
await callback();
|
|
923
1016
|
await assertStateRootAlias(paths);
|
|
924
1017
|
await assertArtifactAliasWitnesses(aliases);
|
|
925
|
-
|
|
1018
|
+
observer.checkpoint();
|
|
1019
|
+
// Retain the original event-loop drain; Darwin queries the real kernel queue without a timed wait.
|
|
926
1020
|
await new Promise(resolve => setImmediate(resolve));
|
|
927
|
-
|
|
928
|
-
throw selfUpdateFailure(SELF_UPDATE_FAILURE_CODES.UNSAFE_UPDATE_PATH, 'state_alias_changed_during_callback');
|
|
929
|
-
if (uncertain)
|
|
930
|
-
throw selfUpdateFailure(SELF_UPDATE_FAILURE_CODES.UNSAFE_UPDATE_PATH, 'state_alias_observation_unconfirmed');
|
|
1021
|
+
observer.settle();
|
|
931
1022
|
}
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
watcher.close();
|
|
935
|
-
await Promise.all(closed);
|
|
1023
|
+
catch (error) {
|
|
1024
|
+
outcome = { failed: true, error };
|
|
936
1025
|
}
|
|
1026
|
+
throwAliasObservationOutcome(outcome, await observer.close());
|
|
937
1027
|
}
|
|
938
1028
|
async function assertArtifactAliasWitnesses(expected) {
|
|
939
1029
|
for (const witness of expected) {
|