@adhdev/mesh-shared 1.0.58-rc.2 → 1.0.58-rc.20
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 +92 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +85 -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 +35 -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 +90 -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,87 @@ 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
|
+
];
|
|
969
|
+
var SERVER_TO_DAEMON_WS_MSGS = [
|
|
970
|
+
"auth_ok",
|
|
971
|
+
"auth_error",
|
|
972
|
+
"machine_evicted",
|
|
973
|
+
"force_disconnect",
|
|
974
|
+
"token_revoked",
|
|
975
|
+
"version_mismatch",
|
|
976
|
+
"force_update_required",
|
|
977
|
+
"command",
|
|
978
|
+
"agent_command",
|
|
979
|
+
"resolve_action"
|
|
980
|
+
];
|
|
981
|
+
function isDaemonToServerWsMsg(value) {
|
|
982
|
+
return typeof value === "string" && DAEMON_TO_SERVER_WS_MSGS.includes(value);
|
|
983
|
+
}
|
|
984
|
+
function isServerToDaemonWsMsg(value) {
|
|
985
|
+
return typeof value === "string" && SERVER_TO_DAEMON_WS_MSGS.includes(value);
|
|
986
|
+
}
|
|
909
987
|
export {
|
|
910
988
|
CANONICAL_MESH_TOOL_COUNT,
|
|
911
989
|
CANONICAL_MESH_TOOL_NAMES,
|
|
912
990
|
CLI_SLOT_RECIPES,
|
|
991
|
+
DAEMON_TO_SERVER_WS_MSGS,
|
|
913
992
|
DEFAULT_DIFFICULTY_BRAINS,
|
|
914
993
|
MAGI_RAW_ANSWER_CAP,
|
|
915
994
|
MESH_CHUNK_KIND,
|
|
@@ -921,12 +1000,14 @@ export {
|
|
|
921
1000
|
MESH_TASK_DIFFICULTIES,
|
|
922
1001
|
MeshChunkAssembler,
|
|
923
1002
|
QUOTA_SUPPORTED_PROVIDERS,
|
|
1003
|
+
SERVER_TO_DAEMON_WS_MSGS,
|
|
924
1004
|
STATUS_PROBE_ARG_KEY,
|
|
925
1005
|
UNKNOWN_CLI_SLOT_RECIPE,
|
|
926
1006
|
argsCarryStatusProbeMarker,
|
|
927
1007
|
buildMagiPanelProposal,
|
|
928
1008
|
buildSlotProposal,
|
|
929
1009
|
canonicalDaemonId,
|
|
1010
|
+
compareSemver,
|
|
930
1011
|
daemonIdsEquivalent,
|
|
931
1012
|
deriveProviderPriorityFromSlots,
|
|
932
1013
|
deriveSlotsFromLegacy,
|
|
@@ -935,9 +1016,12 @@ export {
|
|
|
935
1016
|
hasGitStatusEvidence,
|
|
936
1017
|
interpolateArgs,
|
|
937
1018
|
interpolateString,
|
|
1019
|
+
isDaemonToServerWsMsg,
|
|
1020
|
+
isDowngrade,
|
|
938
1021
|
isMeshTaskDifficulty,
|
|
939
1022
|
isPhantomDaemonEntry,
|
|
940
1023
|
isRawDaemonDoId,
|
|
1024
|
+
isServerToDaemonWsMsg,
|
|
941
1025
|
joinRepoPath,
|
|
942
1026
|
machineCoreFromDaemonId,
|
|
943
1027
|
measureWorstCaseChunkEnvelopeBytes,
|
|
@@ -956,6 +1040,7 @@ export {
|
|
|
956
1040
|
normalizeNodeCapabilitySlots,
|
|
957
1041
|
normalizeThinkingLevel,
|
|
958
1042
|
parseJsonRecord,
|
|
1043
|
+
parseSemver,
|
|
959
1044
|
pickBestTransitGitStatus,
|
|
960
1045
|
readBoolean,
|
|
961
1046
|
readGitSubmodules,
|