@mrciphersmith/keryx 0.2.51 → 0.2.52

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.
Files changed (2) hide show
  1. package/dist/cli.js +118 -62
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -52951,7 +52951,7 @@ import { spawnSync as spawnSync2 } from "child_process";
52951
52951
  // package.json
52952
52952
  var package_default = {
52953
52953
  name: "@mrciphersmith/keryx",
52954
- version: "0.2.51",
52954
+ version: "0.2.52",
52955
52955
  description: "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
52956
52956
  private: false,
52957
52957
  publishConfig: {
@@ -53839,16 +53839,15 @@ var MODAL_PANEL_MARGIN = 1;
53839
53839
  var MODAL_PANEL_CHROME_X = 4;
53840
53840
  var MODAL_PANEL_MIN_WIDTH = 72;
53841
53841
  var MODAL_PANEL_MIN_HEIGHT = 18;
53842
- var MODAL_PANEL_TARGET_WIDTH = 96;
53843
- var MODAL_PANEL_TARGET_HEIGHT = 28;
53842
+ var MODAL_PANEL_SIZE_RATIO = 0.95;
53844
53843
  var MODAL_CHROME_ROWS = 5;
53845
53844
  var MODAL_PANEL_WIDTH = MODAL_PANEL_MIN_WIDTH;
53846
53845
  var MODAL_PANEL_HEIGHT = MODAL_PANEL_MIN_HEIGHT;
53847
53846
  var MODAL_PANEL_INNER_WIDTH = MODAL_PANEL_MIN_WIDTH - MODAL_PANEL_CHROME_X;
53848
53847
  function resolveModalPanelSize(cols, rows) {
53849
53848
  return {
53850
- width: Math.min(MODAL_PANEL_TARGET_WIDTH, Math.max(MODAL_PANEL_MIN_WIDTH, cols - 4)),
53851
- height: Math.min(MODAL_PANEL_TARGET_HEIGHT, Math.max(MODAL_PANEL_MIN_HEIGHT, rows - 4))
53849
+ width: Math.max(MODAL_PANEL_MIN_WIDTH, Math.round(cols * MODAL_PANEL_SIZE_RATIO)),
53850
+ height: Math.max(MODAL_PANEL_MIN_HEIGHT, Math.round(rows * MODAL_PANEL_SIZE_RATIO))
53852
53851
  };
53853
53852
  }
53854
53853
  function modalBodyRows(panelHeight) {
@@ -55532,6 +55531,7 @@ async function declineProposalViaShell(run, workspaceId, proposalId) {
55532
55531
  // src/tui/mcp-inspector.ts
55533
55532
  var MCP_INSPECTOR_FOOTER = [
55534
55533
  { key: "\u2191/\u2193", label: "select" },
55534
+ { key: "click", label: "row: select/act" },
55535
55535
  { key: "c/d", label: "connect/disconnect" },
55536
55536
  { key: "y", label: "confirm" },
55537
55537
  { key: "\u2190/\u2192", label: "tabs" },
@@ -55552,41 +55552,42 @@ var RUNTIME_LABELS = {
55552
55552
  function runtimeLabel(id) {
55553
55553
  return RUNTIME_LABELS[id] ?? id;
55554
55554
  }
55555
- function formatToolsListLines(tools) {
55556
- if (tools.length === 0) {
55557
- return ["No tools available."];
55558
- }
55559
- return tools.map((tool) => {
55560
- const risk = (tool.risk ?? "read").padEnd(6);
55561
- const name = tool.name.padEnd(28);
55562
- return `${name} ${risk} ${tool.description ?? ""}`.trimEnd();
55563
- });
55555
+ function formatToolRowLine(tool) {
55556
+ const risk = (tool.risk ?? "read").padEnd(6);
55557
+ const name = tool.name.padEnd(28);
55558
+ return `${name} ${risk} ${tool.description ?? ""}`.trimEnd();
55564
55559
  }
55565
55560
  function isActionable(id) {
55566
55561
  return id !== "generic";
55567
55562
  }
55568
- function formatMcpListLines(runtimes, selected, status) {
55569
- if (runtimes.length === 0) {
55570
- return ["No MCP client runtimes registered."];
55563
+ function formatMcpRowLine(runtime, isSelected, status) {
55564
+ const mark = isSelected ? ">" : " ";
55565
+ const label = runtimeLabel(runtime.id).padEnd(20);
55566
+ const statusText = runtime.connected ? "\u25CF connected" : "\u25CB not connected";
55567
+ let action = "";
55568
+ if (!isActionable(runtime.id)) {
55569
+ action = " (copy snippet manually)";
55570
+ } else if (status.kind === "armed" && status.target.id === runtime.id) {
55571
+ action = ` [click again or press y to ${status.target.action}]`;
55572
+ } else if (status.kind === "running" && status.target.id === runtime.id) {
55573
+ action = ` ${status.target.action === "connect" ? "connecting\u2026" : "disconnecting\u2026"}`;
55574
+ } else if (status.kind === "done" && status.target.id === runtime.id) {
55575
+ action = status.outcome.ok ? " \u2713 done" : ` \u2717 ${status.outcome.message}`;
55576
+ } else {
55577
+ action = runtime.connected ? " [d] disconnect" : " [c] connect";
55571
55578
  }
55572
- return runtimes.map((runtime, index) => {
55573
- const mark = index === selected ? ">" : " ";
55574
- const label = runtimeLabel(runtime.id).padEnd(20);
55575
- const statusText = runtime.connected ? "\u25CF connected" : "\u25CB not connected";
55576
- let action = "";
55577
- if (!isActionable(runtime.id)) {
55578
- action = " (copy snippet manually)";
55579
- } else if (status.kind === "armed" && status.target.id === runtime.id) {
55580
- action = ` [press y to ${status.target.action}]`;
55581
- } else if (status.kind === "running" && status.target.id === runtime.id) {
55582
- action = ` ${status.target.action === "connect" ? "connecting\u2026" : "disconnecting\u2026"}`;
55583
- } else if (status.kind === "done" && status.target.id === runtime.id) {
55584
- action = status.outcome.ok ? " \u2713 done" : ` \u2717 ${status.outcome.message}`;
55585
- } else {
55586
- action = runtime.connected ? " [d] disconnect" : " [c] connect";
55587
- }
55588
- return `${mark} ${label} ${statusText}${action}`;
55589
- });
55579
+ return `${mark} ${label} ${statusText}${action}`;
55580
+ }
55581
+ function asRowTarget(body) {
55582
+ const parent = body;
55583
+ if (parent.add === undefined || parent.getChildren === undefined || parent.remove === undefined) {
55584
+ return;
55585
+ }
55586
+ return {
55587
+ add: parent.add.bind(parent),
55588
+ getChildren: parent.getChildren.bind(parent),
55589
+ remove: parent.remove.bind(parent)
55590
+ };
55590
55591
  }
55591
55592
  function presentMcpTools(openModal2, otui, chrome, options) {
55592
55593
  const runtimes = options.runtimes.map((r) => ({ ...r }));
@@ -55594,25 +55595,52 @@ function presentMcpTools(openModal2, otui, chrome, options) {
55594
55595
  let toolsScroll = 0;
55595
55596
  let mcpScroll = 0;
55596
55597
  let status = { kind: "idle" };
55597
- let toolsNode;
55598
- let mcpNode;
55598
+ let toolsBody;
55599
+ let mcpBody;
55600
+ let rowCtor;
55601
+ let activeRenderer;
55599
55602
  let unsubscribeKey;
55600
55603
  const rendererHint = options.renderer ?? chrome?.renderer;
55601
55604
  const bodyRows = options.visibleRows ?? (typeof rendererHint?.width === "number" && typeof rendererHint.height === "number" ? modalBodyRows(resolveModalPanelSize(rendererHint.width, rendererHint.height).height) : 13);
55602
- const toolLines = () => formatToolsListLines(options.tools);
55603
- const mcpLines = () => formatMcpListLines(runtimes, mcpSelected, status);
55604
- const paint = () => {
55605
- toolsScroll = clampScroll3(toolsScroll, toolLines().length, bodyRows);
55606
- mcpScroll = scrollToReveal3(mcpSelected, mcpScroll, bodyRows);
55607
- mcpScroll = clampScroll3(mcpScroll, mcpLines().length, bodyRows);
55608
- if (toolsNode !== undefined) {
55609
- toolsNode.content = windowLines3(toolLines(), toolsScroll, bodyRows).join(`
55610
- `);
55605
+ const paintToolsRows = () => {
55606
+ if (toolsBody === undefined || rowCtor === undefined) {
55607
+ return;
55611
55608
  }
55612
- if (mcpNode !== undefined) {
55613
- mcpNode.content = windowLines3(mcpLines(), mcpScroll, bodyRows).join(`
55614
- `);
55609
+ clearTranscriptChildren(toolsBody);
55610
+ if (options.tools.length === 0) {
55611
+ toolsBody.add(new rowCtor(activeRenderer, { id: "mcp-tools-empty", content: "No tools available." }));
55612
+ return;
55613
+ }
55614
+ const start = clampScroll3(toolsScroll, options.tools.length, bodyRows);
55615
+ for (const [i, tool] of options.tools.slice(start, start + bodyRows).entries()) {
55616
+ toolsBody.add(new rowCtor(activeRenderer, { id: `mcp-tool-row-${start + i}`, content: formatToolRowLine(tool) }));
55617
+ }
55618
+ };
55619
+ const paintMcpRows = () => {
55620
+ if (mcpBody === undefined || rowCtor === undefined) {
55621
+ return;
55615
55622
  }
55623
+ clearTranscriptChildren(mcpBody);
55624
+ if (runtimes.length === 0) {
55625
+ mcpBody.add(new rowCtor(activeRenderer, { id: "mcp-mcp-empty", content: "No MCP client runtimes registered." }));
55626
+ return;
55627
+ }
55628
+ const start = clampScroll3(mcpScroll, runtimes.length, bodyRows);
55629
+ for (const [i, runtime] of runtimes.slice(start, start + bodyRows).entries()) {
55630
+ const index = start + i;
55631
+ mcpBody.add(new rowCtor(activeRenderer, {
55632
+ id: `mcp-row-${runtime.id}`,
55633
+ content: formatMcpRowLine(runtime, index === mcpSelected, status),
55634
+ onMouseDown: () => handleRowClick(runtime.id, index)
55635
+ }));
55636
+ }
55637
+ };
55638
+ const paint = () => {
55639
+ toolsScroll = clampScroll3(toolsScroll, options.tools.length, bodyRows);
55640
+ mcpScroll = scrollToReveal3(mcpSelected, mcpScroll, bodyRows);
55641
+ mcpScroll = clampScroll3(mcpScroll, runtimes.length, bodyRows);
55642
+ paintToolsRows();
55643
+ paintMcpRows();
55616
55644
  };
55617
55645
  const moveMcpSelection = (next) => {
55618
55646
  if (runtimes.length === 0) {
@@ -55646,6 +55674,34 @@ function presentMcpTools(openModal2, otui, chrome, options) {
55646
55674
  paint();
55647
55675
  });
55648
55676
  };
55677
+ const armFor = (id) => {
55678
+ const index = runtimes.findIndex((r) => r.id === id);
55679
+ const row = runtimes[index];
55680
+ if (index < 0 || row === undefined || !isActionable(row.id) || status.kind === "running") {
55681
+ return;
55682
+ }
55683
+ mcpSelected = index;
55684
+ status = { kind: "armed", target: { id: row.id, action: row.connected ? "disconnect" : "connect" } };
55685
+ paint();
55686
+ };
55687
+ const handleRowClick = (id, index) => {
55688
+ if (status.kind === "armed" && status.target.id === id) {
55689
+ runAction();
55690
+ return;
55691
+ }
55692
+ if (status.kind === "running") {
55693
+ return;
55694
+ }
55695
+ if (!isActionable(id)) {
55696
+ if (index !== mcpSelected) {
55697
+ mcpSelected = index;
55698
+ status = { kind: "idle" };
55699
+ paint();
55700
+ }
55701
+ return;
55702
+ }
55703
+ armFor(id);
55704
+ };
55649
55705
  const handle = openModal2(otui, chrome, {
55650
55706
  title: "Tools & MCP",
55651
55707
  tabs: [
@@ -55656,22 +55712,22 @@ function presentMcpTools(openModal2, otui, chrome, options) {
55656
55712
  footer: MCP_INSPECTOR_FOOTER,
55657
55713
  renderTab: (tabId, body, ctx) => {
55658
55714
  const renderer = options.renderer ?? chrome?.renderer;
55659
- const parent = body;
55660
55715
  const ctor = otui.TextRenderable;
55661
- if (parent.add === undefined || ctor === undefined) {
55716
+ const target = asRowTarget(body);
55717
+ if (target === undefined || ctor === undefined) {
55662
55718
  return;
55663
55719
  }
55720
+ rowCtor = ctor;
55721
+ activeRenderer = renderer;
55664
55722
  if (tabId === "tools") {
55665
- toolsScroll = clampScroll3(toolsScroll, toolLines().length, bodyRows);
55666
- toolsNode = new ctor(renderer, { id: "mcp-tools-body", content: windowLines3(toolLines(), toolsScroll, bodyRows).join(`
55667
- `) });
55668
- parent.add(toolsNode);
55723
+ toolsBody = target;
55724
+ toolsScroll = clampScroll3(toolsScroll, options.tools.length, bodyRows);
55725
+ paintToolsRows();
55669
55726
  return;
55670
55727
  }
55728
+ mcpBody = target;
55671
55729
  mcpScroll = scrollToReveal3(mcpSelected, mcpScroll, bodyRows);
55672
- mcpNode = new ctor(renderer, { id: "mcp-mcp-body", content: windowLines3(mcpLines(), mcpScroll, bodyRows).join(`
55673
- `) });
55674
- parent.add(mcpNode);
55730
+ paintMcpRows();
55675
55731
  },
55676
55732
  onClose: () => {
55677
55733
  unsubscribeKey?.();
@@ -55713,7 +55769,7 @@ function presentMcpTools(openModal2, otui, chrome, options) {
55713
55769
  if (onMcp) {
55714
55770
  moveMcpSelection(mcpSelected - 1);
55715
55771
  } else {
55716
- toolsScroll = clampScroll3(toolsScroll - 1, toolLines().length, bodyRows);
55772
+ toolsScroll = clampScroll3(toolsScroll - 1, options.tools.length, bodyRows);
55717
55773
  paint();
55718
55774
  }
55719
55775
  return;
@@ -55722,7 +55778,7 @@ function presentMcpTools(openModal2, otui, chrome, options) {
55722
55778
  if (onMcp) {
55723
55779
  moveMcpSelection(mcpSelected + 1);
55724
55780
  } else {
55725
- toolsScroll = clampScroll3(toolsScroll + 1, toolLines().length, bodyRows);
55781
+ toolsScroll = clampScroll3(toolsScroll + 1, options.tools.length, bodyRows);
55726
55782
  paint();
55727
55783
  }
55728
55784
  return;
@@ -55730,9 +55786,9 @@ function presentMcpTools(openModal2, otui, chrome, options) {
55730
55786
  if (token === "pageup" || token === "pagedown") {
55731
55787
  const step = token === "pageup" ? -bodyRows : bodyRows;
55732
55788
  if (onMcp) {
55733
- mcpScroll = clampScroll3(mcpScroll + step, mcpLines().length, bodyRows);
55789
+ mcpScroll = clampScroll3(mcpScroll + step, runtimes.length, bodyRows);
55734
55790
  } else {
55735
- toolsScroll = clampScroll3(toolsScroll + step, toolLines().length, bodyRows);
55791
+ toolsScroll = clampScroll3(toolsScroll + step, options.tools.length, bodyRows);
55736
55792
  }
55737
55793
  paint();
55738
55794
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrciphersmith/keryx",
3
- "version": "0.2.51",
3
+ "version": "0.2.52",
4
4
  "description": "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
5
5
  "private": false,
6
6
  "publishConfig": {