@adhdev/mesh-shared 0.9.82-rc.415 → 0.9.82-rc.417

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/magi.d.ts CHANGED
@@ -82,8 +82,50 @@ export interface MagiResponseSource {
82
82
  provider?: string;
83
83
  /** False when the replica failed or its output could not be parsed. */
84
84
  ok: boolean;
85
- /** Reason when ok=false (timeout / failed / unparseable). */
85
+ /** Reason when ok=false (timeout / failed / unparseable / stale). */
86
86
  error?: string;
87
+ /**
88
+ * True when the replica was detected STALE during collection — assigned to a
89
+ * node/session no longer present in the live mesh (so it will never reach a
90
+ * terminal state). Distinguishes a dead-assignment replica from one that is
91
+ * merely still generating. Always implies ok=false.
92
+ */
93
+ stale?: boolean;
94
+ /**
95
+ * Git ref of the node this replica ran on, captured at collection time from the
96
+ * live mesh node's compact git summary. Lets synthesis (and a dashboard) detect
97
+ * GIT SKEW across the panel — if the answering replicas span different branches
98
+ * or diverge (ahead/behind), their file:line evidence is comparing different code
99
+ * and "agreement" is less meaningful. Best-effort; absent when the node carried
100
+ * no git summary.
101
+ */
102
+ git?: MagiReplicaGitRef;
103
+ }
104
+ /** Compact git ref of the node a replica ran on (subset of GitRepoStatus). */
105
+ export interface MagiReplicaGitRef {
106
+ branch?: string | null;
107
+ /** HEAD commit sha of the node's workspace — the exact code the replica saw. */
108
+ headCommit?: string | null;
109
+ ahead?: number;
110
+ behind?: number;
111
+ dirty?: boolean;
112
+ }
113
+ /**
114
+ * Cross-replica git divergence assessment. `skewed` is true when the answering
115
+ * replicas span more than one branch OR any replica diverges from its upstream
116
+ * (ahead/behind > 0) — both mean the panel is not all looking at the same code, so
117
+ * file:line evidence and agreement are git-skewed. Always present on a synthesis
118
+ * (skewed=false / distinctBranches≤1 when there is nothing to flag).
119
+ */
120
+ export interface MagiGitSkew {
121
+ skewed: boolean;
122
+ /** Number of distinct branches across the answering replicas with a known branch. */
123
+ distinctBranches: number;
124
+ /** The distinct branch names (sorted), for display. */
125
+ branches: string[];
126
+ /** Replicas whose branch/divergence differs from the panel baseline. */
127
+ divergentReplicas: number;
128
+ note?: string;
87
129
  }
88
130
  /** A parsed replica response paired with its source identity. */
89
131
  export interface MagiSynthesizedResponse {
@@ -153,4 +195,17 @@ export interface MagiSynthesis {
153
195
  agreed: MagiClaimCluster[];
154
196
  /** Union of every response's open_questions (deduped). */
155
197
  openQuestions: string[];
198
+ /**
199
+ * Per-replica source identity (taskId / nodeId / provider / ok / stale / git) for
200
+ * every replica in the fan-out. Lets a consumer (the dashboard's extractMagiActivity)
201
+ * read which node × provider answered and the git ref each ran at — the inputs behind
202
+ * the gitSkew assessment.
203
+ */
204
+ replicas: MagiResponseSource[];
205
+ /**
206
+ * Cross-replica git divergence. When skewed, the answering replicas were not all
207
+ * on the same code (different branches / ahead-behind), so evidence and agreement
208
+ * should be read with that caveat. Always present.
209
+ */
210
+ gitSkew: MagiGitSkew;
156
211
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/mesh-shared",
3
- "version": "0.9.82-rc.415",
3
+ "version": "0.9.82-rc.417",
4
4
  "description": "ADHDev mesh-shared — pure mesh/git status normalizers shared by daemon-core and web-core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/magi.ts CHANGED
@@ -96,8 +96,52 @@ export interface MagiResponseSource {
96
96
  provider?: string
97
97
  /** False when the replica failed or its output could not be parsed. */
98
98
  ok: boolean
99
- /** Reason when ok=false (timeout / failed / unparseable). */
99
+ /** Reason when ok=false (timeout / failed / unparseable / stale). */
100
100
  error?: string
101
+ /**
102
+ * True when the replica was detected STALE during collection — assigned to a
103
+ * node/session no longer present in the live mesh (so it will never reach a
104
+ * terminal state). Distinguishes a dead-assignment replica from one that is
105
+ * merely still generating. Always implies ok=false.
106
+ */
107
+ stale?: boolean
108
+ /**
109
+ * Git ref of the node this replica ran on, captured at collection time from the
110
+ * live mesh node's compact git summary. Lets synthesis (and a dashboard) detect
111
+ * GIT SKEW across the panel — if the answering replicas span different branches
112
+ * or diverge (ahead/behind), their file:line evidence is comparing different code
113
+ * and "agreement" is less meaningful. Best-effort; absent when the node carried
114
+ * no git summary.
115
+ */
116
+ git?: MagiReplicaGitRef
117
+ }
118
+
119
+ /** Compact git ref of the node a replica ran on (subset of GitRepoStatus). */
120
+ export interface MagiReplicaGitRef {
121
+ branch?: string | null
122
+ /** HEAD commit sha of the node's workspace — the exact code the replica saw. */
123
+ headCommit?: string | null
124
+ ahead?: number
125
+ behind?: number
126
+ dirty?: boolean
127
+ }
128
+
129
+ /**
130
+ * Cross-replica git divergence assessment. `skewed` is true when the answering
131
+ * replicas span more than one branch OR any replica diverges from its upstream
132
+ * (ahead/behind > 0) — both mean the panel is not all looking at the same code, so
133
+ * file:line evidence and agreement are git-skewed. Always present on a synthesis
134
+ * (skewed=false / distinctBranches≤1 when there is nothing to flag).
135
+ */
136
+ export interface MagiGitSkew {
137
+ skewed: boolean
138
+ /** Number of distinct branches across the answering replicas with a known branch. */
139
+ distinctBranches: number
140
+ /** The distinct branch names (sorted), for display. */
141
+ branches: string[]
142
+ /** Replicas whose branch/divergence differs from the panel baseline. */
143
+ divergentReplicas: number
144
+ note?: string
101
145
  }
102
146
 
103
147
  /** A parsed replica response paired with its source identity. */
@@ -173,4 +217,17 @@ export interface MagiSynthesis {
173
217
  agreed: MagiClaimCluster[]
174
218
  /** Union of every response's open_questions (deduped). */
175
219
  openQuestions: string[]
220
+ /**
221
+ * Per-replica source identity (taskId / nodeId / provider / ok / stale / git) for
222
+ * every replica in the fan-out. Lets a consumer (the dashboard's extractMagiActivity)
223
+ * read which node × provider answered and the git ref each ran at — the inputs behind
224
+ * the gitSkew assessment.
225
+ */
226
+ replicas: MagiResponseSource[]
227
+ /**
228
+ * Cross-replica git divergence. When skewed, the answering replicas were not all
229
+ * on the same code (different branches / ahead-behind), so evidence and agreement
230
+ * should be read with that caveat. Always present.
231
+ */
232
+ gitSkew: MagiGitSkew
176
233
  }