@adhdev/mesh-shared 1.0.58-rc.3 → 1.0.58-rc.31
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/index.d.ts +2 -0
- package/dist/index.js +94 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +87 -0
- package/dist/index.mjs.map +1 -1
- package/dist/mesh-tool-names.d.ts +2 -2
- package/dist/node-facts.d.ts +20 -1
- package/dist/semver-compare.d.ts +68 -0
- package/dist/ws-protocol.d.ts +50 -0
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/mesh-tool-names.ts +1 -0
- package/src/node-facts.ts +21 -1
- package/src/semver-compare.ts +122 -0
- package/src/ws-protocol.ts +107 -0
package/dist/index.mjs
CHANGED
|
@@ -256,6 +256,7 @@ var QUOTA_SUPPORTED_PROVIDERS = [
|
|
|
256
256
|
"antigravity-cli",
|
|
257
257
|
"claude-cli",
|
|
258
258
|
"codex-cli",
|
|
259
|
+
"cursor-cli",
|
|
259
260
|
"grok-cli",
|
|
260
261
|
"kimi",
|
|
261
262
|
"opencode"
|
|
@@ -653,6 +654,7 @@ function interpolateString(template, ctx) {
|
|
|
653
654
|
// src/mesh-tool-names.ts
|
|
654
655
|
var CANONICAL_MESH_TOOL_NAMES = [
|
|
655
656
|
"mesh_status",
|
|
657
|
+
"mesh_route_preview",
|
|
656
658
|
"mesh_list_nodes",
|
|
657
659
|
// GRAPH-ORCHESTRATION Phase F — batch before task, mirroring ALL_MESH_TOOLS.
|
|
658
660
|
"mesh_enqueue_batch",
|
|
@@ -906,10 +908,89 @@ var MeshChunkAssembler = class {
|
|
|
906
908
|
}
|
|
907
909
|
}
|
|
908
910
|
};
|
|
911
|
+
|
|
912
|
+
// src/semver-compare.ts
|
|
913
|
+
var SEMVER_PATTERN = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
914
|
+
var NUMERIC_IDENTIFIER = /^\d+$/;
|
|
915
|
+
function parseSemver(version) {
|
|
916
|
+
if (typeof version !== "string") return null;
|
|
917
|
+
const match = version.trim().replace(/^v/, "").match(SEMVER_PATTERN);
|
|
918
|
+
if (!match) return null;
|
|
919
|
+
return {
|
|
920
|
+
major: Number(match[1]),
|
|
921
|
+
minor: Number(match[2]),
|
|
922
|
+
patch: Number(match[3]),
|
|
923
|
+
prerelease: match[4] ? match[4].split(".") : []
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
function comparePrerelease(a, b) {
|
|
927
|
+
if (a.length === 0 && b.length === 0) return 0;
|
|
928
|
+
if (a.length === 0) return 1;
|
|
929
|
+
if (b.length === 0) return -1;
|
|
930
|
+
for (let i = 0; i < Math.min(a.length, b.length); i += 1) {
|
|
931
|
+
const idA = a[i];
|
|
932
|
+
const idB = b[i];
|
|
933
|
+
if (idA === idB) continue;
|
|
934
|
+
const numA = NUMERIC_IDENTIFIER.test(idA);
|
|
935
|
+
const numB = NUMERIC_IDENTIFIER.test(idB);
|
|
936
|
+
if (numA && numB) return Number(idA) < Number(idB) ? -1 : 1;
|
|
937
|
+
if (numA) return -1;
|
|
938
|
+
if (numB) return 1;
|
|
939
|
+
return idA < idB ? -1 : 1;
|
|
940
|
+
}
|
|
941
|
+
return a.length === b.length ? 0 : a.length < b.length ? -1 : 1;
|
|
942
|
+
}
|
|
943
|
+
function compareSemver(a, b) {
|
|
944
|
+
const pa = parseSemver(a);
|
|
945
|
+
const pb = parseSemver(b);
|
|
946
|
+
if (!pa || !pb) return null;
|
|
947
|
+
if (pa.major !== pb.major) return pa.major < pb.major ? -1 : 1;
|
|
948
|
+
if (pa.minor !== pb.minor) return pa.minor < pb.minor ? -1 : 1;
|
|
949
|
+
if (pa.patch !== pb.patch) return pa.patch < pb.patch ? -1 : 1;
|
|
950
|
+
return comparePrerelease(pa.prerelease, pb.prerelease);
|
|
951
|
+
}
|
|
952
|
+
function isDowngrade(current, target) {
|
|
953
|
+
const direction = compareSemver(target, current);
|
|
954
|
+
if (direction === null) return false;
|
|
955
|
+
return direction < 0;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
// src/ws-protocol.ts
|
|
959
|
+
var DAEMON_TO_SERVER_WS_MSGS = [
|
|
960
|
+
"auth",
|
|
961
|
+
"status_report",
|
|
962
|
+
"status_heartbeat",
|
|
963
|
+
"status_event",
|
|
964
|
+
"command_result",
|
|
965
|
+
"error",
|
|
966
|
+
"agent_event",
|
|
967
|
+
"log",
|
|
968
|
+
"beacon_vectors"
|
|
969
|
+
];
|
|
970
|
+
var SERVER_TO_DAEMON_WS_MSGS = [
|
|
971
|
+
"auth_ok",
|
|
972
|
+
"auth_error",
|
|
973
|
+
"machine_evicted",
|
|
974
|
+
"force_disconnect",
|
|
975
|
+
"token_revoked",
|
|
976
|
+
"version_mismatch",
|
|
977
|
+
"force_update_required",
|
|
978
|
+
"command",
|
|
979
|
+
"agent_command",
|
|
980
|
+
"resolve_action",
|
|
981
|
+
"beacon_vectors_result"
|
|
982
|
+
];
|
|
983
|
+
function isDaemonToServerWsMsg(value) {
|
|
984
|
+
return typeof value === "string" && DAEMON_TO_SERVER_WS_MSGS.includes(value);
|
|
985
|
+
}
|
|
986
|
+
function isServerToDaemonWsMsg(value) {
|
|
987
|
+
return typeof value === "string" && SERVER_TO_DAEMON_WS_MSGS.includes(value);
|
|
988
|
+
}
|
|
909
989
|
export {
|
|
910
990
|
CANONICAL_MESH_TOOL_COUNT,
|
|
911
991
|
CANONICAL_MESH_TOOL_NAMES,
|
|
912
992
|
CLI_SLOT_RECIPES,
|
|
993
|
+
DAEMON_TO_SERVER_WS_MSGS,
|
|
913
994
|
DEFAULT_DIFFICULTY_BRAINS,
|
|
914
995
|
MAGI_RAW_ANSWER_CAP,
|
|
915
996
|
MESH_CHUNK_KIND,
|
|
@@ -921,12 +1002,14 @@ export {
|
|
|
921
1002
|
MESH_TASK_DIFFICULTIES,
|
|
922
1003
|
MeshChunkAssembler,
|
|
923
1004
|
QUOTA_SUPPORTED_PROVIDERS,
|
|
1005
|
+
SERVER_TO_DAEMON_WS_MSGS,
|
|
924
1006
|
STATUS_PROBE_ARG_KEY,
|
|
925
1007
|
UNKNOWN_CLI_SLOT_RECIPE,
|
|
926
1008
|
argsCarryStatusProbeMarker,
|
|
927
1009
|
buildMagiPanelProposal,
|
|
928
1010
|
buildSlotProposal,
|
|
929
1011
|
canonicalDaemonId,
|
|
1012
|
+
compareSemver,
|
|
930
1013
|
daemonIdsEquivalent,
|
|
931
1014
|
deriveProviderPriorityFromSlots,
|
|
932
1015
|
deriveSlotsFromLegacy,
|
|
@@ -935,9 +1018,12 @@ export {
|
|
|
935
1018
|
hasGitStatusEvidence,
|
|
936
1019
|
interpolateArgs,
|
|
937
1020
|
interpolateString,
|
|
1021
|
+
isDaemonToServerWsMsg,
|
|
1022
|
+
isDowngrade,
|
|
938
1023
|
isMeshTaskDifficulty,
|
|
939
1024
|
isPhantomDaemonEntry,
|
|
940
1025
|
isRawDaemonDoId,
|
|
1026
|
+
isServerToDaemonWsMsg,
|
|
941
1027
|
joinRepoPath,
|
|
942
1028
|
machineCoreFromDaemonId,
|
|
943
1029
|
measureWorstCaseChunkEnvelopeBytes,
|
|
@@ -956,6 +1042,7 @@ export {
|
|
|
956
1042
|
normalizeNodeCapabilitySlots,
|
|
957
1043
|
normalizeThinkingLevel,
|
|
958
1044
|
parseJsonRecord,
|
|
1045
|
+
parseSemver,
|
|
959
1046
|
pickBestTransitGitStatus,
|
|
960
1047
|
readBoolean,
|
|
961
1048
|
readGitSubmodules,
|