@dylanrussell/agent-router 1.0.2 → 1.0.4
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/README.md +45 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/tui.js +39 -12
- package/dist/tui.js.map +1 -1
- package/package.json +2 -1
package/dist/tui.js
CHANGED
|
@@ -15347,15 +15347,23 @@ function materializeNode(node, solid) {
|
|
|
15347
15347
|
}
|
|
15348
15348
|
|
|
15349
15349
|
// src/tui/store.ts
|
|
15350
|
-
function snapshotKey(active, stacks) {
|
|
15351
|
-
return `${active ?? "\0"}|${stacks.join(",")}`;
|
|
15350
|
+
function snapshotKey(active, stacks, agents = []) {
|
|
15351
|
+
return `${active ?? "\0"}|${stacks.join(",")}|${agents.map((a) => `${a.agent}=${a.model}`).join(",")}`;
|
|
15352
15352
|
}
|
|
15353
15353
|
async function readStackSnapshot(paths) {
|
|
15354
15354
|
const [active, stacks] = await Promise.all([
|
|
15355
15355
|
getActiveStackName(paths).catch(() => null),
|
|
15356
15356
|
listStacks(paths).catch(() => [])
|
|
15357
15357
|
]);
|
|
15358
|
-
|
|
15358
|
+
let agents = [];
|
|
15359
|
+
if (active !== null) {
|
|
15360
|
+
try {
|
|
15361
|
+
const stack = await readStack(paths, active);
|
|
15362
|
+
agents = Object.entries(stack.agents).map(([agent, entry]) => ({ agent, model: entry.model })).sort((a, b) => a.agent.localeCompare(b.agent));
|
|
15363
|
+
} catch {
|
|
15364
|
+
}
|
|
15365
|
+
}
|
|
15366
|
+
return { active, stacks, agents, key: snapshotKey(active, stacks, agents) };
|
|
15359
15367
|
}
|
|
15360
15368
|
function createSidebarPoller(options) {
|
|
15361
15369
|
const schedule = options.schedule ?? ((fn, ms) => setTimeout(fn, ms));
|
|
@@ -15401,18 +15409,37 @@ function restartRequired(snapshot, ctx) {
|
|
|
15401
15409
|
}
|
|
15402
15410
|
function buildSidebarNodes(snapshot, ctx) {
|
|
15403
15411
|
const theme = ctx.theme ?? {};
|
|
15404
|
-
const nodes = [
|
|
15405
|
-
|
|
15406
|
-
text(
|
|
15407
|
-
|
|
15412
|
+
const nodes = [text("Agent Stacks", { fg: theme.text, attributes: TEXT_ATTR_BOLD })];
|
|
15413
|
+
if (snapshot.stacks.length === 0) {
|
|
15414
|
+
nodes.push(text(" \u25A3 (none)", { fg: theme.success }));
|
|
15415
|
+
} else {
|
|
15416
|
+
for (const name of snapshot.stacks) {
|
|
15417
|
+
const isActive = name === snapshot.active;
|
|
15418
|
+
nodes.push(
|
|
15419
|
+
text(`${isActive ? " \u25A3 " : " \u25A1 "}${name}`, {
|
|
15420
|
+
fg: isActive ? theme.success : theme.textMuted
|
|
15421
|
+
})
|
|
15422
|
+
);
|
|
15423
|
+
}
|
|
15424
|
+
}
|
|
15425
|
+
nodes.push(text("Current Stack", { fg: theme.text, attributes: TEXT_ATTR_BOLD }));
|
|
15426
|
+
if (snapshot.agents.length === 0) {
|
|
15427
|
+
nodes.push(text("\u2022 (none)", { fg: theme.success }));
|
|
15428
|
+
} else {
|
|
15429
|
+
for (const { agent, model } of snapshot.agents) {
|
|
15430
|
+
nodes.push({
|
|
15431
|
+
kind: "box",
|
|
15432
|
+
props: { flexDirection: "row" },
|
|
15433
|
+
children: [
|
|
15434
|
+
text("\u2022 ", { fg: theme.success }),
|
|
15435
|
+
text(`${agent} \u2192 ${model}`, { fg: theme.textMuted })
|
|
15436
|
+
]
|
|
15437
|
+
});
|
|
15438
|
+
}
|
|
15439
|
+
}
|
|
15408
15440
|
if (restartRequired(snapshot, ctx)) {
|
|
15409
15441
|
nodes.push(text(" \u27F3 restart required", { fg: theme.warning }));
|
|
15410
15442
|
}
|
|
15411
|
-
nodes.push(
|
|
15412
|
-
text(` ${snapshot.stacks.length} stack${snapshot.stacks.length === 1 ? "" : "s"}`, {
|
|
15413
|
-
fg: theme.textMuted
|
|
15414
|
-
})
|
|
15415
|
-
);
|
|
15416
15443
|
return nodes;
|
|
15417
15444
|
}
|
|
15418
15445
|
|