@adhdev/mesh-shared 1.0.58-rc.1 → 1.0.58-rc.100

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 CHANGED
@@ -25,3 +25,6 @@ export * from './interpolation';
25
25
  export * from './mesh-tool-names';
26
26
  export * from './mesh-status-probe';
27
27
  export * from './rpc-chunking';
28
+ export * from './semver-compare';
29
+ export * from './ws-protocol';
30
+ export * from './interactive-prompt-constants';
package/dist/index.js CHANGED
@@ -22,7 +22,10 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  CANONICAL_MESH_TOOL_COUNT: () => CANONICAL_MESH_TOOL_COUNT,
24
24
  CANONICAL_MESH_TOOL_NAMES: () => CANONICAL_MESH_TOOL_NAMES,
25
+ CLAUDE_TUI_REVIEW_PAGE_NOT_FOCUSED_PREFIX: () => CLAUDE_TUI_REVIEW_PAGE_NOT_FOCUSED_PREFIX,
26
+ CLAUDE_TUI_REVIEW_UNCONFIRMED_PREFIX: () => CLAUDE_TUI_REVIEW_UNCONFIRMED_PREFIX,
25
27
  CLI_SLOT_RECIPES: () => CLI_SLOT_RECIPES,
28
+ DAEMON_TO_SERVER_WS_MSGS: () => DAEMON_TO_SERVER_WS_MSGS,
26
29
  DEFAULT_DIFFICULTY_BRAINS: () => DEFAULT_DIFFICULTY_BRAINS,
27
30
  MAGI_RAW_ANSWER_CAP: () => MAGI_RAW_ANSWER_CAP,
28
31
  MESH_CHUNK_KIND: () => MESH_CHUNK_KIND,
@@ -34,12 +37,14 @@ __export(index_exports, {
34
37
  MESH_TASK_DIFFICULTIES: () => MESH_TASK_DIFFICULTIES,
35
38
  MeshChunkAssembler: () => MeshChunkAssembler,
36
39
  QUOTA_SUPPORTED_PROVIDERS: () => QUOTA_SUPPORTED_PROVIDERS,
40
+ SERVER_TO_DAEMON_WS_MSGS: () => SERVER_TO_DAEMON_WS_MSGS,
37
41
  STATUS_PROBE_ARG_KEY: () => STATUS_PROBE_ARG_KEY,
38
42
  UNKNOWN_CLI_SLOT_RECIPE: () => UNKNOWN_CLI_SLOT_RECIPE,
39
43
  argsCarryStatusProbeMarker: () => argsCarryStatusProbeMarker,
40
44
  buildMagiPanelProposal: () => buildMagiPanelProposal,
41
45
  buildSlotProposal: () => buildSlotProposal,
42
46
  canonicalDaemonId: () => canonicalDaemonId,
47
+ compareSemver: () => compareSemver,
43
48
  daemonIdsEquivalent: () => daemonIdsEquivalent,
44
49
  deriveProviderPriorityFromSlots: () => deriveProviderPriorityFromSlots,
45
50
  deriveSlotsFromLegacy: () => deriveSlotsFromLegacy,
@@ -48,9 +53,12 @@ __export(index_exports, {
48
53
  hasGitStatusEvidence: () => hasGitStatusEvidence,
49
54
  interpolateArgs: () => interpolateArgs,
50
55
  interpolateString: () => interpolateString,
56
+ isDaemonToServerWsMsg: () => isDaemonToServerWsMsg,
57
+ isDowngrade: () => isDowngrade,
51
58
  isMeshTaskDifficulty: () => isMeshTaskDifficulty,
52
59
  isPhantomDaemonEntry: () => isPhantomDaemonEntry,
53
60
  isRawDaemonDoId: () => isRawDaemonDoId,
61
+ isServerToDaemonWsMsg: () => isServerToDaemonWsMsg,
54
62
  joinRepoPath: () => joinRepoPath,
55
63
  machineCoreFromDaemonId: () => machineCoreFromDaemonId,
56
64
  measureWorstCaseChunkEnvelopeBytes: () => measureWorstCaseChunkEnvelopeBytes,
@@ -69,6 +77,7 @@ __export(index_exports, {
69
77
  normalizeNodeCapabilitySlots: () => normalizeNodeCapabilitySlots,
70
78
  normalizeThinkingLevel: () => normalizeThinkingLevel,
71
79
  parseJsonRecord: () => parseJsonRecord,
80
+ parseSemver: () => parseSemver,
72
81
  pickBestTransitGitStatus: () => pickBestTransitGitStatus,
73
82
  readBoolean: () => readBoolean,
74
83
  readGitSubmodules: () => readGitSubmodules,
@@ -345,6 +354,7 @@ var QUOTA_SUPPORTED_PROVIDERS = [
345
354
  "antigravity-cli",
346
355
  "claude-cli",
347
356
  "codex-cli",
357
+ "cursor-cli",
348
358
  "grok-cli",
349
359
  "kimi",
350
360
  "opencode"
@@ -742,6 +752,7 @@ function interpolateString(template, ctx) {
742
752
  // src/mesh-tool-names.ts
743
753
  var CANONICAL_MESH_TOOL_NAMES = [
744
754
  "mesh_status",
755
+ "mesh_route_preview",
745
756
  "mesh_list_nodes",
746
757
  // GRAPH-ORCHESTRATION Phase F — batch before task, mirroring ALL_MESH_TOOLS.
747
758
  "mesh_enqueue_batch",
@@ -995,11 +1006,96 @@ var MeshChunkAssembler = class {
995
1006
  }
996
1007
  }
997
1008
  };
1009
+
1010
+ // src/semver-compare.ts
1011
+ var SEMVER_PATTERN = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
1012
+ var NUMERIC_IDENTIFIER = /^\d+$/;
1013
+ function parseSemver(version) {
1014
+ if (typeof version !== "string") return null;
1015
+ const match = version.trim().replace(/^v/, "").match(SEMVER_PATTERN);
1016
+ if (!match) return null;
1017
+ return {
1018
+ major: Number(match[1]),
1019
+ minor: Number(match[2]),
1020
+ patch: Number(match[3]),
1021
+ prerelease: match[4] ? match[4].split(".") : []
1022
+ };
1023
+ }
1024
+ function comparePrerelease(a, b) {
1025
+ if (a.length === 0 && b.length === 0) return 0;
1026
+ if (a.length === 0) return 1;
1027
+ if (b.length === 0) return -1;
1028
+ for (let i = 0; i < Math.min(a.length, b.length); i += 1) {
1029
+ const idA = a[i];
1030
+ const idB = b[i];
1031
+ if (idA === idB) continue;
1032
+ const numA = NUMERIC_IDENTIFIER.test(idA);
1033
+ const numB = NUMERIC_IDENTIFIER.test(idB);
1034
+ if (numA && numB) return Number(idA) < Number(idB) ? -1 : 1;
1035
+ if (numA) return -1;
1036
+ if (numB) return 1;
1037
+ return idA < idB ? -1 : 1;
1038
+ }
1039
+ return a.length === b.length ? 0 : a.length < b.length ? -1 : 1;
1040
+ }
1041
+ function compareSemver(a, b) {
1042
+ const pa = parseSemver(a);
1043
+ const pb = parseSemver(b);
1044
+ if (!pa || !pb) return null;
1045
+ if (pa.major !== pb.major) return pa.major < pb.major ? -1 : 1;
1046
+ if (pa.minor !== pb.minor) return pa.minor < pb.minor ? -1 : 1;
1047
+ if (pa.patch !== pb.patch) return pa.patch < pb.patch ? -1 : 1;
1048
+ return comparePrerelease(pa.prerelease, pb.prerelease);
1049
+ }
1050
+ function isDowngrade(current, target) {
1051
+ const direction = compareSemver(target, current);
1052
+ if (direction === null) return false;
1053
+ return direction < 0;
1054
+ }
1055
+
1056
+ // src/ws-protocol.ts
1057
+ var DAEMON_TO_SERVER_WS_MSGS = [
1058
+ "auth",
1059
+ "status_report",
1060
+ "status_heartbeat",
1061
+ "status_event",
1062
+ "command_result",
1063
+ "error",
1064
+ "agent_event",
1065
+ "log",
1066
+ "beacon_vectors"
1067
+ ];
1068
+ var SERVER_TO_DAEMON_WS_MSGS = [
1069
+ "auth_ok",
1070
+ "auth_error",
1071
+ "machine_evicted",
1072
+ "force_disconnect",
1073
+ "token_revoked",
1074
+ "version_mismatch",
1075
+ "force_update_required",
1076
+ "command",
1077
+ "agent_command",
1078
+ "resolve_action",
1079
+ "beacon_vectors_result"
1080
+ ];
1081
+ function isDaemonToServerWsMsg(value) {
1082
+ return typeof value === "string" && DAEMON_TO_SERVER_WS_MSGS.includes(value);
1083
+ }
1084
+ function isServerToDaemonWsMsg(value) {
1085
+ return typeof value === "string" && SERVER_TO_DAEMON_WS_MSGS.includes(value);
1086
+ }
1087
+
1088
+ // src/interactive-prompt-constants.ts
1089
+ var CLAUDE_TUI_REVIEW_PAGE_NOT_FOCUSED_PREFIX = "Claude TUI review page is not focused";
1090
+ var CLAUDE_TUI_REVIEW_UNCONFIRMED_PREFIX = "Claude TUI answer delivered but not confirmed";
998
1091
  // Annotate the CommonJS export names for ESM import in node:
999
1092
  0 && (module.exports = {
1000
1093
  CANONICAL_MESH_TOOL_COUNT,
1001
1094
  CANONICAL_MESH_TOOL_NAMES,
1095
+ CLAUDE_TUI_REVIEW_PAGE_NOT_FOCUSED_PREFIX,
1096
+ CLAUDE_TUI_REVIEW_UNCONFIRMED_PREFIX,
1002
1097
  CLI_SLOT_RECIPES,
1098
+ DAEMON_TO_SERVER_WS_MSGS,
1003
1099
  DEFAULT_DIFFICULTY_BRAINS,
1004
1100
  MAGI_RAW_ANSWER_CAP,
1005
1101
  MESH_CHUNK_KIND,
@@ -1011,12 +1107,14 @@ var MeshChunkAssembler = class {
1011
1107
  MESH_TASK_DIFFICULTIES,
1012
1108
  MeshChunkAssembler,
1013
1109
  QUOTA_SUPPORTED_PROVIDERS,
1110
+ SERVER_TO_DAEMON_WS_MSGS,
1014
1111
  STATUS_PROBE_ARG_KEY,
1015
1112
  UNKNOWN_CLI_SLOT_RECIPE,
1016
1113
  argsCarryStatusProbeMarker,
1017
1114
  buildMagiPanelProposal,
1018
1115
  buildSlotProposal,
1019
1116
  canonicalDaemonId,
1117
+ compareSemver,
1020
1118
  daemonIdsEquivalent,
1021
1119
  deriveProviderPriorityFromSlots,
1022
1120
  deriveSlotsFromLegacy,
@@ -1025,9 +1123,12 @@ var MeshChunkAssembler = class {
1025
1123
  hasGitStatusEvidence,
1026
1124
  interpolateArgs,
1027
1125
  interpolateString,
1126
+ isDaemonToServerWsMsg,
1127
+ isDowngrade,
1028
1128
  isMeshTaskDifficulty,
1029
1129
  isPhantomDaemonEntry,
1030
1130
  isRawDaemonDoId,
1131
+ isServerToDaemonWsMsg,
1031
1132
  joinRepoPath,
1032
1133
  machineCoreFromDaemonId,
1033
1134
  measureWorstCaseChunkEnvelopeBytes,
@@ -1046,6 +1147,7 @@ var MeshChunkAssembler = class {
1046
1147
  normalizeNodeCapabilitySlots,
1047
1148
  normalizeThinkingLevel,
1048
1149
  parseJsonRecord,
1150
+ parseSemver,
1049
1151
  pickBestTransitGitStatus,
1050
1152
  readBoolean,
1051
1153
  readGitSubmodules,