@dylanrussell/agent-router 1.0.1 → 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 +40 -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));
|
|
@@ -15392,6 +15400,7 @@ function createSidebarPoller(options) {
|
|
|
15392
15400
|
}
|
|
15393
15401
|
|
|
15394
15402
|
// src/tui/view.ts
|
|
15403
|
+
var TEXT_ATTR_BOLD = 1;
|
|
15395
15404
|
function text(content, props = {}) {
|
|
15396
15405
|
return { kind: "text", props, text: content };
|
|
15397
15406
|
}
|
|
@@ -15400,18 +15409,37 @@ function restartRequired(snapshot, ctx) {
|
|
|
15400
15409
|
}
|
|
15401
15410
|
function buildSidebarNodes(snapshot, ctx) {
|
|
15402
15411
|
const theme = ctx.theme ?? {};
|
|
15403
|
-
const nodes = [
|
|
15404
|
-
|
|
15405
|
-
text(
|
|
15406
|
-
|
|
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
|
+
}
|
|
15407
15440
|
if (restartRequired(snapshot, ctx)) {
|
|
15408
15441
|
nodes.push(text(" \u27F3 restart required", { fg: theme.warning }));
|
|
15409
15442
|
}
|
|
15410
|
-
nodes.push(
|
|
15411
|
-
text(` ${snapshot.stacks.length} stack${snapshot.stacks.length === 1 ? "" : "s"}`, {
|
|
15412
|
-
fg: theme.textMuted
|
|
15413
|
-
})
|
|
15414
|
-
);
|
|
15415
15443
|
return nodes;
|
|
15416
15444
|
}
|
|
15417
15445
|
|