agent-coord-mcp 0.26.41 → 0.26.43

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.
@@ -164,11 +164,14 @@ export function typedRecordGuidance(s: RecordSuggestion): string {
164
164
  // large share of real traffic, so this fires on domination, not on presence.
165
165
  export const FYI_DOMINANCE_THRESHOLD = 0.75;
166
166
 
167
+ // @ts-expect-error — untyped .mjs sibling, deliberately not duplicated in TS
168
+ import { slimText, SLIM_LENGTH } from "../hooks/tier.mjs";
169
+
167
170
  export type TypedRecordStats = {
168
171
  total: number;
169
172
  typed: number;
170
173
  coverage: number;
171
- /** Bytes below the first line of UNTYPED messages — the cost still being paid. */
174
+ /** Bytes still delivered whole: below line 1 of UNTYPED messages, plus TYPED bodies past SLIM_LENGTH the transport cannot slim (no summary, no id). */
172
175
  unslimmedBytes: number;
173
176
  /** count by record.type, plus `untyped`. */
174
177
  distribution: Record<string, number>;
@@ -177,8 +180,8 @@ export type TypedRecordStats = {
177
180
  note: string;
178
181
  };
179
182
 
180
- /** `messages` is any array of stored messages ({text, record?}). */
181
- export function typedRecordStats(messages: ReadonlyArray<{ text?: string; record?: { type?: string } }>): TypedRecordStats {
183
+ /** `messages` is any array of stored messages ({id?, text, record?}). */
184
+ export function typedRecordStats(messages: ReadonlyArray<{ id?: string; text?: string; record?: { type?: string; payload?: { summary?: unknown } } }>): TypedRecordStats {
182
185
  const distribution: Record<string, number> = {};
183
186
  let typed = 0;
184
187
  let unslimmedBytes = 0;
@@ -186,11 +189,14 @@ export function typedRecordStats(messages: ReadonlyArray<{ text?: string; record
186
189
  for (const m of messages) {
187
190
  const type = typeof m.record?.type === "string" ? m.record.type : undefined;
188
191
  distribution[type ?? "untyped"] = (distribution[type ?? "untyped"] ?? 0) + 1;
192
+ const text = m.text ?? "";
189
193
  if (type) {
190
194
  typed++;
195
+ // ⟨q-ee679d20⟩ A typed single-line body was never counted — only bytes after a newline were — so
196
+ // the traffic slimming missed read as zero cost. Count what the transport cannot slim.
197
+ if (text.length > SLIM_LENGTH && slimText(m) === null) unslimmedBytes += Buffer.byteLength(text, "utf8");
191
198
  continue;
192
199
  }
193
- const text = m.text ?? "";
194
200
  const nl = text.indexOf("\n");
195
201
  if (nl !== -1) unslimmedBytes += Buffer.byteLength(text.slice(nl + 1), "utf8");
196
202
  }
@@ -209,7 +215,7 @@ export function typedRecordStats(messages: ReadonlyArray<{ text?: string; record
209
215
  `stopped carrying information. Agents are typing to pass the gate, which is 12.5 FAILING, not holding.`
210
216
  : verdict === "healthy"
211
217
  ? `${(coverage * 100).toFixed(0)}% typed with a spread distribution — the reader-side cost is paid down and the type still discriminates.`
212
- : `${(coverage * 100).toFixed(0)}% typed; ${unslimmedBytes.toLocaleString("en-US")} bytes still sit below line 1 in untyped messages, ` +
218
+ : `${(coverage * 100).toFixed(0)}% typed; ${unslimmedBytes.toLocaleString("en-US")} bytes are still delivered whole (untyped past line 1, typed with no summary to stand in), ` +
213
219
  `carried by every reader.`;
214
220
 
215
221
  return { total, typed, coverage: Number(coverage.toFixed(3)), unslimmedBytes, distribution, fyiShareOfTyped: Number(fyiShareOfTyped.toFixed(3)), verdict, note };