@mrciphersmith/keryx 0.2.63 → 0.2.65

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 +91 -53
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -53556,7 +53556,7 @@ import { spawnSync as spawnSync2 } from "child_process";
53556
53556
  // package.json
53557
53557
  var package_default = {
53558
53558
  name: "@mrciphersmith/keryx",
53559
- version: "0.2.63",
53559
+ version: "0.2.65",
53560
53560
  description: "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
53561
53561
  private: false,
53562
53562
  publishConfig: {
@@ -54542,7 +54542,11 @@ function mountTab(state, input2, tabId) {
54542
54542
  unmountActiveTab(state);
54543
54543
  state.active = tabId;
54544
54544
  paintTabs(state);
54545
- const cleanup = input2.renderTab(tabId, state.body, { width: innerWidthOf(state) });
54545
+ const size = resolveModalPanelSize(state.chrome.renderer.width, state.chrome.renderer.height);
54546
+ const cleanup = input2.renderTab(tabId, state.body, {
54547
+ width: resolveModalInnerWidth(size.width),
54548
+ height: modalBodyRows(size.height)
54549
+ });
54546
54550
  state.tabCleanup = typeof cleanup === "function" ? cleanup : undefined;
54547
54551
  }
54548
54552
  function closeHost(state, opts) {
@@ -57575,6 +57579,10 @@ function formatTokens(n) {
57575
57579
 
57576
57580
  // src/tui/games/constants.ts
57577
57581
  var GAME_MODEL_TIMEOUT_MS = 60000;
57582
+ var PROMPT_MIN_ROWS = 5;
57583
+ var PROMPT_MAX_ROWS = 14;
57584
+ var PANEL_FIXED_ROWS = 7;
57585
+ var PANEL_MIN_ROWS = PANEL_FIXED_ROWS + PROMPT_MIN_ROWS;
57578
57586
  var GAMES_FOOTER = [
57579
57587
  { key: "arrows", label: "move" },
57580
57588
  { key: "enter", label: "place" },
@@ -57736,14 +57744,39 @@ var GAME_CELL_GAP = 1;
57736
57744
  var GAME_BOARD_CHROME_X = 4;
57737
57745
  var GAME_CELL_SIZES = {
57738
57746
  large: { width: 9, height: 5 },
57739
- small: { width: 5, height: 3 }
57747
+ medium: { width: 7, height: 4 },
57748
+ small: { width: 5, height: 3 },
57749
+ tiny: { width: 3, height: 2 }
57740
57750
  };
57741
57751
  function gameBoardWidth(cellWidth) {
57742
57752
  return cellWidth * 3 + GAME_CELL_GAP * 2 + GAME_BOARD_CHROME_X;
57743
57753
  }
57744
- function resolveCellSize(availableWidth) {
57745
- const large = GAME_CELL_SIZES.large;
57746
- return gameBoardWidth(large.width) <= availableWidth ? large : GAME_CELL_SIZES.small;
57754
+ function boardRows(cellHeight) {
57755
+ return cellHeight * 3 + 2;
57756
+ }
57757
+ function boardRegionRows(cellHeight) {
57758
+ return boardRows(cellHeight) + 4;
57759
+ }
57760
+ function resolveCellSize(availableWidth, availableHeight) {
57761
+ const candidates = [
57762
+ GAME_CELL_SIZES.large,
57763
+ GAME_CELL_SIZES.medium,
57764
+ GAME_CELL_SIZES.small,
57765
+ GAME_CELL_SIZES.tiny
57766
+ ];
57767
+ for (const size of candidates) {
57768
+ if (gameBoardWidth(size.width) <= availableWidth && boardRegionRows(size.height) <= availableHeight) {
57769
+ return size;
57770
+ }
57771
+ }
57772
+ return GAME_CELL_SIZES.tiny;
57773
+ }
57774
+ function resolveGameBudget(availableWidth, bodyRows) {
57775
+ const boardBudgetRows = Math.max(1, bodyRows - PANEL_MIN_ROWS);
57776
+ const cellSize = resolveCellSize(availableWidth, boardBudgetRows);
57777
+ const boardUsedRows = boardRegionRows(cellSize.height);
57778
+ const promptRows = Math.max(PROMPT_MIN_ROWS, Math.min(PROMPT_MAX_ROWS, bodyRows - PANEL_FIXED_ROWS - boardUsedRows));
57779
+ return { cellSize, boardUsedRows, promptRows, boardBudgetRows };
57747
57780
  }
57748
57781
 
57749
57782
  // src/tui/games/tic-tac-toe/render.ts
@@ -57763,7 +57796,7 @@ function render2(state, ctx) {
57763
57796
  const core = ctx.core;
57764
57797
  const r = ctx.renderer;
57765
57798
  const theme = ctx.theme;
57766
- const cellSize = resolveCellSize(ctx.width);
57799
+ const cellSize = resolveCellSize(ctx.width, ctx.height);
57767
57800
  const wrap2 = new core.BoxRenderable(r, {
57768
57801
  id: "game-wrap",
57769
57802
  width: "100%",
@@ -57925,12 +57958,6 @@ function renderAgentPanel(game, parent, core, renderer, args2) {
57925
57958
  paddingRight: 1,
57926
57959
  ...extra
57927
57960
  });
57928
- const statRow = (owner, label, value, id, valueFg = theme.text) => {
57929
- const rowBox = box({ flexDirection: "row", gap: 1 });
57930
- rowBox.add(text({ content: label, fg: theme.muted }));
57931
- rowBox.add(text({ id, content: value, fg: valueFg }));
57932
- owner.add(rowBox);
57933
- };
57934
57961
  const idle = args2.notice === undefined || args2.notice === "";
57935
57962
  const statusCard = card("game-status-card", { width: "100%", marginTop: 1 });
57936
57963
  statusCard.add(text({
@@ -57938,47 +57965,50 @@ function renderAgentPanel(game, parent, core, renderer, args2) {
57938
57965
  content: args2.modelBusy ? "agent is thinking\u2026" : idle ? "waiting for your move" : args2.notice,
57939
57966
  fg: args2.modelBusy ? theme.focus : idle ? theme.text : theme.error
57940
57967
  }));
57941
- parent.add(statusCard);
57942
- const sysLines = game.systemPrompt().split(`
57943
- `);
57944
- const sysShown = sysLines.length > 6 ? [...sysLines.slice(0, 6), `\u2026 (+${sysLines.length - 6} more)`] : sysLines;
57945
- const sysCard = card("game-system-card", { width: "100%", marginTop: 1 });
57946
- sysCard.add(text({ id: "game-system-title", content: "system prompt", fg: theme.muted }));
57947
- sysCard.add(text({ id: "game-system", content: sysShown.join(`
57948
- `), fg: theme.muted }));
57949
- parent.add(sysCard);
57950
57968
  const lt = args2.lastTurn;
57951
57969
  const tot = args2.totals;
57952
- const statsRow = box({ id: "game-stats-row", width: "100%", flexDirection: "row", gap: 1, marginTop: 1 });
57953
- const lastTurnCard = card("game-last-turn", { flexGrow: 1, flexShrink: 0 });
57954
- lastTurnCard.add(text({ id: "game-last-turn-title", content: "last turn", fg: theme.muted }));
57955
- if (lt === undefined) {
57956
- lastTurnCard.add(text({ id: "game-stats-empty", content: "no turns yet", fg: theme.muted }));
57957
- } else {
57958
- const model = lt.provider === "\u2013" ? "\u2013" : truncate4(`${lt.provider}/${lt.model}`, MODEL_MAX);
57959
- statRow(lastTurnCard, "model", model, "game-stats-model");
57960
- statRow(lastTurnCard, "first byte", formatMs(lt.latencyMs), "game-stats-latency");
57961
- statRow(lastTurnCard, "total", formatMs(lt.totalMs), "game-stats-total");
57962
- statRow(lastTurnCard, "tokens", `in ${formatTokens(lt.inputTokens)} \xB7 out ${formatTokens(lt.outputTokens)}`, "game-stats-tokens");
57963
- if (lt.reasoning) {
57964
- statRow(lastTurnCard, "reasoning", "yes", "game-stats-reasoning", theme.focus);
57965
- }
57966
- if (lt.localFallback) {
57967
- statRow(lastTurnCard, "fallback", "local", "game-stats-fallback", theme.error);
57968
- }
57969
- if (lt.error) {
57970
- statRow(lastTurnCard, "error", "yes", "game-stats-error", theme.error);
57971
- }
57970
+ const shownModel = lt !== undefined && lt.provider !== "\u2013" ? truncate4(`${lt.provider}/${lt.model}`, MODEL_MAX) : args2.modelParam;
57971
+ statusCard.add(text({ id: "game-stats-model", content: `model: ${shownModel}`, fg: theme.muted }));
57972
+ const lastCore = lt === undefined ? "no turns yet" : `${formatMs(lt.totalMs)} \xB7 in ${formatTokens(lt.inputTokens)}/out ${formatTokens(lt.outputTokens)}`;
57973
+ const flags = [];
57974
+ if (lt?.reasoning) {
57975
+ flags.push("reasoning");
57976
+ }
57977
+ if (lt?.localFallback) {
57978
+ flags.push("fallback");
57972
57979
  }
57973
- const sessionCard = card("game-session", { flexGrow: 1, flexShrink: 0 });
57974
- sessionCard.add(text({ id: "game-session-title", content: "session", fg: theme.muted }));
57975
- statRow(sessionCard, "turns", String(tot.turns), "game-session-turns");
57976
- statRow(sessionCard, "fallbacks", String(tot.localFallbacks), "game-session-fallbacks");
57977
- statRow(sessionCard, "errors", String(tot.errors), "game-session-errors");
57978
- statRow(sessionCard, "tokens", `in ${formatTokens(tot.inputTokens)} \xB7 out ${formatTokens(tot.outputTokens)}`, "game-session-tokens");
57979
- statsRow.add(lastTurnCard);
57980
- statsRow.add(sessionCard);
57981
- parent.add(statsRow);
57980
+ if (lt?.error) {
57981
+ flags.push("error");
57982
+ }
57983
+ statusCard.add(text({
57984
+ id: "game-stats-line",
57985
+ content: `last: ${lastCore}${flags.length > 0 ? ` \xB7 ${flags.join(", ")}` : ""} \xB7 session: ${tot.turns} turn${tot.turns === 1 ? "" : "s"} \xB7 ${tot.localFallbacks} fb \xB7 ${tot.errors} err \xB7 in ${formatTokens(tot.inputTokens)}/out ${formatTokens(tot.outputTokens)}`,
57986
+ fg: theme.muted
57987
+ }));
57988
+ parent.add(statusCard);
57989
+ const sysCard = new core.ScrollBoxRenderable(renderer, {
57990
+ id: "game-system-card",
57991
+ width: "100%",
57992
+ height: args2.promptRows,
57993
+ minHeight: args2.promptRows,
57994
+ maxHeight: args2.promptRows,
57995
+ flexShrink: 0,
57996
+ flexGrow: 0,
57997
+ marginTop: 1,
57998
+ border: true,
57999
+ borderStyle: "rounded",
58000
+ borderColor: theme.border,
58001
+ backgroundColor: theme.panel,
58002
+ paddingLeft: 1,
58003
+ paddingRight: 1,
58004
+ scrollY: true,
58005
+ contentOptions: { flexDirection: "column" }
58006
+ });
58007
+ sysCard.add(text({ id: "game-user-title", content: "your turn prompt (board)", fg: theme.muted }));
58008
+ sysCard.add(text({ id: "game-user-prompt", content: args2.userPrompt, fg: theme.muted }));
58009
+ sysCard.add(text({ id: "game-system-title", content: "system prompt", fg: theme.muted }));
58010
+ sysCard.add(text({ id: "game-system", content: game.systemPrompt(), fg: theme.muted }));
58011
+ parent.add(sysCard);
57982
58012
  }
57983
58013
 
57984
58014
  // src/tui/games/otui.ts
@@ -58013,6 +58043,8 @@ function presentGamesModal(openModalFn, otui, chrome, options = {}, registry = c
58013
58043
  let unsubscribeKey;
58014
58044
  let bodyRef;
58015
58045
  let bodyWidth = 0;
58046
+ let bodyHeight = 0;
58047
+ const modelParam = `${options.provider ?? "auto"}/${options.model ?? "auto"}`;
58016
58048
  const stateOf = (id) => {
58017
58049
  const game = registry.get(id);
58018
58050
  if (game === undefined) {
@@ -58043,19 +58075,24 @@ function presentGamesModal(openModalFn, otui, chrome, options = {}, registry = c
58043
58075
  return;
58044
58076
  }
58045
58077
  const state = stateOf(activeId);
58078
+ const budget = resolveGameBudget(bodyWidth, Math.max(1, bodyHeight));
58046
58079
  const ctx = {
58047
58080
  core,
58048
58081
  renderer,
58049
58082
  theme: getTheme(),
58050
58083
  parent: bodyRef,
58051
- width: bodyWidth
58084
+ width: bodyWidth,
58085
+ height: budget.boardBudgetRows
58052
58086
  };
58053
58087
  game.render(state, ctx);
58054
58088
  renderAgentPanel(game, bodyRef, core, renderer, {
58055
58089
  notice,
58056
58090
  modelBusy,
58057
58091
  lastTurn: lastTurn.get(activeId),
58058
- totals: totalsOf(activeId)
58092
+ totals: totalsOf(activeId),
58093
+ userPrompt: game.stateForModel(state),
58094
+ promptRows: budget.promptRows,
58095
+ modelParam
58059
58096
  });
58060
58097
  };
58061
58098
  const restart = () => {
@@ -58162,6 +58199,7 @@ function presentGamesModal(openModalFn, otui, chrome, options = {}, registry = c
58162
58199
  }
58163
58200
  bodyRef = body;
58164
58201
  bodyWidth = ctx.width;
58202
+ bodyHeight = ctx.height;
58165
58203
  paint();
58166
58204
  },
58167
58205
  onClose: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrciphersmith/keryx",
3
- "version": "0.2.63",
3
+ "version": "0.2.65",
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": {