@dylanrussell/agent-router 1.1.0 → 1.1.1

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/tui.js CHANGED
@@ -15743,7 +15743,16 @@ function materializeNode(node, solid) {
15743
15743
 
15744
15744
  // src/tui/store.ts
15745
15745
  function snapshotKey(active, stacks, agents = []) {
15746
- return `${active ?? "\0"}|${stacks.join(",")}|${agents.map((a) => `${a.agent}=${a.model}`).join(",")}`;
15746
+ return JSON.stringify([
15747
+ active,
15748
+ stacks,
15749
+ agents.map((a) => [
15750
+ a.agent,
15751
+ a.model,
15752
+ a.variant ?? null,
15753
+ (a.fallbacks ?? []).map((fallback) => [fallback.model, fallback.variant ?? null])
15754
+ ])
15755
+ ]);
15747
15756
  }
15748
15757
  async function readStackSnapshot(paths) {
15749
15758
  const [active, stacks] = await Promise.all([
@@ -15754,7 +15763,12 @@ async function readStackSnapshot(paths) {
15754
15763
  if (active !== null) {
15755
15764
  try {
15756
15765
  const stack = await readStack(paths, active);
15757
- agents = Object.entries(stack.agents).map(([agent, entry]) => ({ agent, model: entry.model })).sort((a, b) => a.agent.localeCompare(b.agent));
15766
+ agents = Object.entries(stack.agents).map(([agent, entry]) => ({
15767
+ agent,
15768
+ model: entry.model,
15769
+ variant: entry.variant ?? null,
15770
+ fallbacks: entry.fallbacks ?? []
15771
+ })).sort((a, b) => a.agent.localeCompare(b.agent));
15758
15772
  } catch {
15759
15773
  }
15760
15774
  }
@@ -15802,6 +15816,9 @@ function text(content, props = {}) {
15802
15816
  function restartRequired(snapshot, ctx) {
15803
15817
  return snapshot.active !== ctx.bootActive;
15804
15818
  }
15819
+ function modelLabel(assignment) {
15820
+ return `${assignment.model}${assignment.variant ? ` [${assignment.variant}]` : ""}`;
15821
+ }
15805
15822
  function buildSidebarNodes(snapshot, ctx) {
15806
15823
  const theme = ctx.theme ?? {};
15807
15824
  const nodes = [text("Agent Stacks", { fg: theme.text, attributes: TEXT_ATTR_BOLD })];
@@ -15821,13 +15838,30 @@ function buildSidebarNodes(snapshot, ctx) {
15821
15838
  if (snapshot.agents.length === 0) {
15822
15839
  nodes.push(text("\u2022 (none)", { fg: theme.textMuted }));
15823
15840
  } else {
15824
- for (const { agent, model } of snapshot.agents) {
15841
+ nodes.push(text("Configured routing", { fg: theme.textMuted }));
15842
+ for (const assignment of snapshot.agents) {
15825
15843
  nodes.push({
15826
15844
  kind: "box",
15827
- props: { flexDirection: "row", gap: 1 },
15845
+ props: { flexDirection: "column" },
15828
15846
  children: [
15829
- text("\u2022", { flexShrink: 0, style: { fg: theme.success } }),
15830
- text(`${agent} \u2192 ${model}`, { fg: theme.textMuted })
15847
+ {
15848
+ kind: "box",
15849
+ props: { flexDirection: "row", gap: 1 },
15850
+ children: [
15851
+ text("\u2022", { flexShrink: 0, style: { fg: theme.success } }),
15852
+ text(assignment.agent, { fg: theme.text, attributes: TEXT_ATTR_BOLD })
15853
+ ]
15854
+ },
15855
+ {
15856
+ kind: "box",
15857
+ props: { flexDirection: "column", paddingLeft: 2 },
15858
+ children: [
15859
+ text(`Primary \u2192 ${modelLabel(assignment)}`, { fg: theme.textMuted }),
15860
+ ...(assignment.fallbacks ?? []).map(
15861
+ (fallback, index) => text(`Fallback ${index + 1} \u2192 ${modelLabel(fallback)}`, { fg: theme.textMuted })
15862
+ )
15863
+ ]
15864
+ }
15831
15865
  ]
15832
15866
  });
15833
15867
  }