@kontextmind/kxm 0.7.150 → 0.7.151

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.
@@ -573,12 +573,14 @@ function evaluateCircuitBreaker(records, route, config, now = Date.now()) {
573
573
  }
574
574
  function generateRoutingReport(records, options = {}) {
575
575
  const generatedAt = options.now ? options.now() : (/* @__PURE__ */ new Date()).toISOString();
576
+ const routeSwitches = options.routeSwitches?.filter((item) => item.from && item.to) ?? [];
576
577
  if (records.length === 0) {
577
578
  return {
578
579
  schema: ROUTING_REPORT_SCHEMA,
579
580
  generatedAt,
580
581
  totalAttempts: 0,
581
- rows: []
582
+ rows: [],
583
+ ...routeSwitches.length > 0 ? { routeSwitches: [...routeSwitches] } : {}
582
584
  };
583
585
  }
584
586
  const groups = /* @__PURE__ */ new Map();
@@ -742,13 +744,22 @@ function generateRoutingReport(records, options = {}) {
742
744
  schema: ROUTING_REPORT_SCHEMA,
743
745
  generatedAt,
744
746
  totalAttempts: records.length,
745
- rows
747
+ rows,
748
+ ...routeSwitches.length > 0 ? { routeSwitches: [...routeSwitches] } : {}
746
749
  };
747
750
  }
748
751
  function formatRoutingReport(report, options = {}) {
749
- if (report.rows.length === 0) {
752
+ if (report.rows.length === 0 && (!report.routeSwitches || report.routeSwitches.length === 0)) {
750
753
  return "no routing records to report";
751
754
  }
755
+ if (report.rows.length === 0) {
756
+ const lines2 = ["no routing records to report", "", `Route switches (${report.routeSwitches.length})`];
757
+ for (const item of report.routeSwitches) {
758
+ const effort = item.effort ? ` effort ${item.effort}` : "";
759
+ lines2.push(` ${item.from} -> ${item.to} (${item.reason}${effort}) step ${item.stepId}`);
760
+ }
761
+ return lines2.join("\n");
762
+ }
752
763
  const showListCost = Boolean(options.equivalentListCost);
753
764
  const headers = [
754
765
  "Harness".padEnd(10),
@@ -804,6 +815,14 @@ function formatRoutingReport(report, options = {}) {
804
815
  if (report.rows.some((r) => r.flagged)) {
805
816
  lines.push("* = unknown-cost attempts present (never ranked cheapest)");
806
817
  }
818
+ if (report.routeSwitches && report.routeSwitches.length > 0) {
819
+ lines.push("");
820
+ lines.push(`Route switches (${report.routeSwitches.length})`);
821
+ for (const item of report.routeSwitches) {
822
+ const effort = item.effort ? ` effort ${item.effort}` : "";
823
+ lines.push(` ${item.from} -> ${item.to} (${item.reason}${effort}) step ${item.stepId}`);
824
+ }
825
+ }
807
826
  return lines.join("\n");
808
827
  }
809
828
 
@@ -17313,7 +17313,7 @@ function sessionTokenFixHint(policy) {
17313
17313
  }
17314
17314
 
17315
17315
  // plugins/kxm/src/mcp-server.ts
17316
- var VERSION = "0.7.150";
17316
+ var VERSION = "0.7.151";
17317
17317
  var CONFIGURE_PLUGIN = "/plugin configure kxm@kxm";
17318
17318
  var inbox = /* @__PURE__ */ new Map();
17319
17319
  var notifiedInbox = /* @__PURE__ */ new Set();