openmates 0.27.0-alpha.8 → 0.27.0-alpha.9

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.
@@ -86133,6 +86133,16 @@ async function createTuiChatProject(state, client2, chatIds) {
86133
86133
  // src/tuiLayout.ts
86134
86134
  var WORKSPACES = ["chats", "apps", "projects", "workflows", "tasks"];
86135
86135
  var DEFAULT_CHAT_BACKGROUND = "#4867cd";
86136
+ var CONTENT_MAX_COLUMNS = 100;
86137
+ function workspaceGeometry(state, rawWidth) {
86138
+ const width = Math.max(1, Math.floor(rawWidth));
86139
+ const gutter = Math.min(2, Math.floor((width - 1) / 2));
86140
+ const sidebarWidth = state.sidebarOpen && width >= 90 && !state.form && !state.paletteOpen ? 27 : 0;
86141
+ const paneWidth = Math.max(1, width - gutter * 2 - sidebarWidth);
86142
+ const contentWidth = Math.min(CONTENT_MAX_COLUMNS, paneWidth);
86143
+ const inset = Math.floor((paneWidth - contentWidth) / 2);
86144
+ return { width, gutter, sidebarWidth, paneWidth, contentWidth, inset };
86145
+ }
86136
86146
  function chatBackground(category) {
86137
86147
  return category && CATEGORY_GRADIENTS[category]?.start || DEFAULT_CHAT_BACKGROUND;
86138
86148
  }
@@ -86196,29 +86206,24 @@ function overlayLines(state, width, height) {
86196
86206
  return rows2;
86197
86207
  }
86198
86208
  function renderWorkspaceFrame(state, rawWidth, rawHeight, body, options = {}) {
86199
- const width = Math.max(1, Math.floor(rawWidth)), height = Math.max(1, Math.floor(rawHeight));
86209
+ const { gutter, sidebarWidth, paneWidth, contentWidth, inset } = workspaceGeometry(state, rawWidth);
86210
+ const height = Math.max(1, Math.floor(rawHeight));
86200
86211
  const mode = options.colorMode ?? "none";
86201
86212
  const ascii = options.ascii ?? false;
86202
- const inner = Math.max(1, width - 4);
86203
86213
  const line = ascii ? "-" : "\u2500", vertical = ascii ? "|" : "\u2502";
86204
- const border = (left, right) => left + line.repeat(Math.max(0, width - 2)) + right;
86205
- const top = border(ascii ? "+" : "\u256D", ascii ? "+" : "\u256E");
86206
- const bottom = border(ascii ? "+" : "\u2570", ascii ? "+" : "\u256F");
86207
- const divider = border(ascii ? "+" : "\u251C", ascii ? "+" : "\u2524");
86208
- const box = (text4, style) => `${vertical} ${style ?? padCells(text4, inner)} ${vertical}`;
86214
+ const place = (rendered, side2 = " ".repeat(sidebarWidth)) => " ".repeat(gutter) + side2 + " ".repeat(inset) + rendered + " ".repeat(paneWidth - inset - contentWidth + gutter);
86209
86215
  const labels = WORKSPACES.map((w, i) => state.workspace === w ? `[${titleCase(w)}]` : state.focus === "navigation" && i === state.navigationIndex ? `>${titleCase(w)}<` : titleCase(w)).join(" ");
86210
86216
  const title = state.activeChat?.title && state.workspace === "chats" ? ` \xB7 ${state.activeChat.title}` : "";
86211
- const nav = width >= 90 ? `OpenMates ${labels}${title}` : `OpenMates [${titleCase(state.workspace)}] ${state.sidebarOpen ? "Sidebar open" : "Ctrl+B sidebar"}${title}`;
86212
- const inputLines = state.input.split("\n");
86217
+ const nav = contentWidth >= 90 ? `OpenMates ${labels}${title}` : `OpenMates [${titleCase(state.workspace)}] ${state.sidebarOpen ? "Sidebar open" : "Ctrl+B sidebar"}${title}`;
86218
+ const inputWidth = Math.max(1, contentWidth - 6);
86219
+ const inputLines = state.input.split("\n").flatMap((text4) => wrapCells(text4, inputWidth));
86213
86220
  const showComposer = state.workspace !== "apps" || state.focus === "composer" || Boolean(state.input);
86214
86221
  const composerRows = showComposer ? Math.min(3, Math.max(1, inputLines.length)) : 0;
86215
- const bodyHeight = Math.max(1, height - 5 - (showComposer ? 1 + composerRows : 0));
86222
+ const bodyHeight = Math.max(1, height - 2 - (showComposer ? composerRows + 3 : 1));
86216
86223
  const overlay = state.form || state.paletteOpen;
86217
86224
  const sidebar = state.sidebarOpen && !overlay;
86218
- const sidebarWidth = sidebar && width >= 90 ? 27 : 0;
86219
- const contentWidth = Math.max(1, inner - sidebarWidth);
86220
86225
  const sidebarOverlay = sidebar && !sidebarWidth;
86221
- let content = overlay ? overlayLines(state, inner, bodyHeight) : sidebarOverlay ? sidebarLines(state) : body;
86226
+ let content = overlay ? overlayLines(state, contentWidth, bodyHeight) : sidebarOverlay ? sidebarLines(state) : body;
86222
86227
  const stickyCount = !overlay && !sidebarOverlay ? Math.min(options.stickyRows ?? 0, Math.max(0, bodyHeight - 8)) : 0;
86223
86228
  const fixed = content.slice(0, stickyCount);
86224
86229
  content = content.slice(stickyCount);
@@ -86260,8 +86265,8 @@ function renderWorkspaceFrame(state, rawWidth, rawHeight, body, options = {}) {
86260
86265
  const raw = terminalText(lineText(value)).replace(/\n/g, " ");
86261
86266
  let rendered = padCells(raw, contentWidth);
86262
86267
  if (style && !overlay && !sidebarOverlay) {
86263
- const inset = Math.max(0, Math.min(Math.floor(contentWidth / 2) - 1, style.inset ?? 0));
86264
- const span = Math.max(1, contentWidth - 2 * inset);
86268
+ const inset2 = Math.max(0, Math.min(Math.floor(contentWidth / 2) - 1, style.inset ?? 0));
86269
+ const span = Math.max(1, contentWidth - 2 * inset2);
86265
86270
  if (style.spans) {
86266
86271
  let remaining = span;
86267
86272
  rendered = "";
@@ -86271,19 +86276,34 @@ function renderWorkspaceFrame(state, rawWidth, rawHeight, body, options = {}) {
86271
86276
  remaining -= size;
86272
86277
  if (!remaining) break;
86273
86278
  }
86274
- rendered = " ".repeat(inset) + rendered + " ".repeat(remaining + inset);
86275
- } else rendered = " ".repeat(inset) + (style.background ? backgroundLine(raw, span, style.background, mode, style.bold) : foreground(padCells(raw, span), style.color ?? "#e6e6e6", mode, style.bold)) + " ".repeat(inset);
86279
+ rendered = " ".repeat(inset2) + rendered + " ".repeat(remaining + inset2);
86280
+ } else rendered = " ".repeat(inset2) + (style.background ? backgroundLine(raw, span, style.background, mode, style.bold) : foreground(padCells(raw, span), style.color ?? "#e6e6e6", mode, style.bold)) + " ".repeat(inset2);
86276
86281
  } else if (!overlay && !sidebarOverlay && index < heroRows) rendered = backgroundLine(raw, contentWidth, background, mode);
86277
86282
  else if (raw.startsWith("> ") || raw.includes("\u203A")) rendered = foreground(rendered, "#ff553b", mode, true);
86278
86283
  else if (/^(You|Sophia|Tasks|Projects|Workflows|Recent chats|Suggestions|Actions)$/.test(raw)) rendered = foreground(rendered, "#5a85eb", mode, true);
86279
- if (sidebarWidth) rendered = foreground(padCells(side[i] ?? "", sidebarWidth - 2), "#cfcfcf", mode) + `${vertical} ` + rendered;
86280
- rows2.push(box("", rendered));
86284
+ const sidebarRow = sidebarWidth ? foreground(padCells(side[i] ?? "", sidebarWidth - 2), "#cfcfcf", mode) + `${vertical} ` : void 0;
86285
+ rows2.push(place(rendered, sidebarRow));
86281
86286
  }
86282
86287
  const placeholder = state.screen === "example" ? "Continue from this example, or ask your own question..." : state.workspace === "chats" ? state.screen === "chat" ? "Ask a follow-up, use @file, or type /help" : "Ask anything..." : state.workspace === "projects" ? "Name a new project \xB7 /search to browse" : state.workspace === "workflows" ? "Describe new workflow \xB7 /search to browse" : state.workspace === "tasks" ? "Add or update tasks \xB7 /search to browse" : "Search apps or type / for actions";
86283
- const composer = showComposer ? inputLines.slice(-composerRows).map((text4, i) => box(`${i ? " " : "> "}${text4 || (!state.input ? placeholder : "")}`)) : [];
86284
86288
  const hint = state.status && state.screen !== "status" ? `${state.status} \xB7 ${workspaceHint(state)}` : workspaceHint(state);
86285
- const frame = [top, box("", foreground(padCells(nav, inner), "#cfcfcf", mode, true)), divider, ...rows2, ...showComposer ? [divider, ...composer] : [], box("", foreground(padCells(hint, inner), state.focus === "composer" ? "#a0a0a0" : "#ff553b", mode)), bottom];
86286
- return frame.slice(0, height).map((row) => width < 5 ? truncateCells(row, width) : row).join("\n");
86289
+ const hintColor = state.focus === "composer" ? "#a0a0a0" : "#ff553b";
86290
+ const composer = [];
86291
+ if (showComposer) {
86292
+ const inputRows = inputLines.slice(-composerRows).map((text4, i) => `${i ? " " : "> "}${text4 || (!state.input ? placeholder : "")}`);
86293
+ if (contentWidth < 6) composer.push(...inputRows.map((text4) => place(padCells(text4, contentWidth))), place(foreground(padCells(hint, contentWidth), hintColor, mode)), place(" ".repeat(contentWidth)), place(" ".repeat(contentWidth)));
86294
+ else {
86295
+ const edge = (left, right) => place(foreground(left + line.repeat(contentWidth - 2) + right, "#6b6b6b", mode));
86296
+ const inputRow = (text4, color) => place(foreground(vertical, "#6b6b6b", mode) + " " + foreground(padCells(text4, contentWidth - 4), color ?? "#e6e6e6", mode) + " " + foreground(vertical, "#6b6b6b", mode));
86297
+ composer.push(edge(ascii ? "+" : "\u256D", ascii ? "+" : "\u256E"), ...inputRows.map((text4) => inputRow(text4)), inputRow(hint, hintColor), edge(ascii ? "+" : "\u2570", ascii ? "+" : "\u256F"));
86298
+ }
86299
+ }
86300
+ const frame = [
86301
+ place(foreground(padCells(nav, contentWidth), "#cfcfcf", mode, true)),
86302
+ place(" ".repeat(contentWidth)),
86303
+ ...rows2,
86304
+ ...showComposer ? composer : [place(foreground(padCells(hint, contentWidth), hintColor, mode))]
86305
+ ];
86306
+ return frame.slice(0, height).join("\n");
86287
86307
  }
86288
86308
  function titleCase(value) {
86289
86309
  return value.charAt(0).toUpperCase() + value.slice(1);
@@ -87479,8 +87499,7 @@ function rankExamples(examples, interests) {
87479
87499
  }).sort((a, b) => b.score - a.score || a.index - b.index).map((entry) => entry.example);
87480
87500
  }
87481
87501
  function renderTuiFrame(state, width, height, options = {}) {
87482
- const sidebarWidth = state.sidebarOpen && width >= 90 ? 27 : 0;
87483
- const bodyWidth = Math.max(1, width - 4 - sidebarWidth);
87502
+ const bodyWidth = workspaceGeometry(state, width).contentWidth;
87484
87503
  const stickyRows = state.screen === "project" && state.activeProject ? renderProjectIdentity(state.activeProject, { width: bodyWidth }).length + renderProjectTabs(state.projectTab, bodyWidth).length : state.screen === "app" && state.activeApp ? renderTuiAppIdentity(state.activeApp, bodyWidth).length + renderTuiAppTabs(state.appTab, bodyWidth).length : state.screen === "app-skill" && state.activeAppSkill ? renderTuiAppsSkillIdentity(state.activeAppSkill, bodyWidth).length + renderTuiAppsSkillTabs(state.appSkillTab, bodyWidth).length : state.screen === "workflow" && state.activeWorkflow ? renderWorkflowIdentity(state.activeWorkflow, { width: bodyWidth, run: state.workflowTab === "runs" ? state.workflowRuns[state.selectedWorkflowRunIndex] : void 0 }).length + (bodyWidth < 36 ? 7 : 4) : 0;
87485
87504
  return renderWorkspaceFrame(state, width, height, renderBody(state, bodyWidth, height), { ...options, stickyRows, headerRows: state.screen === "chat" || state.screen === "example" ? renderChatHeader(state, bodyWidth).length : void 0 });
87486
87505
  }
@@ -88711,7 +88730,7 @@ async function handleWorkspaceKey(context, chunk, key) {
88711
88730
  }
88712
88731
  }
88713
88732
  if (state.focus === "content" && (state.screen === "task" || state.screen === "tasks")) {
88714
- if (state.screen === "tasks" && (key.name === "left" || key.name === "right") && context.terminal.width - (state.sidebarOpen && context.terminal.width >= 90 ? 27 : 0) - 4 < 110) {
88733
+ if (state.screen === "tasks" && (key.name === "left" || key.name === "right") && workspaceGeometry(state, context.terminal.width).contentWidth < 110) {
88715
88734
  const selected = selectedTask(state), current = TASK_STATUSES.indexOf(state.taskStatusFilter || selected?.status || "todo");
88716
88735
  state.taskStatusFilter = TASK_STATUSES[(current + (key.name === "left" ? -1 : 1) + TASK_STATUSES.length) % TASK_STATUSES.length];
88717
88736
  state.selectedIndex = 0;
package/dist/cli.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  serializeToYaml,
20
20
  shouldRequireTrustedAccountGuard,
21
21
  waitForWorkflowRun
22
- } from "./chunk-IUOCCXVD.js";
22
+ } from "./chunk-GTS7R6VM.js";
23
23
  import "./chunk-IWKP55ZB.js";
24
24
  import "./chunk-BBKJZ23O.js";
25
25
  export {
package/dist/index.js CHANGED
@@ -43,7 +43,7 @@ import {
43
43
  selectAssistantMessagesForSpeech,
44
44
  serializeToYaml,
45
45
  summarizeAssistantSpeech
46
- } from "./chunk-IUOCCXVD.js";
46
+ } from "./chunk-GTS7R6VM.js";
47
47
  import "./chunk-IWKP55ZB.js";
48
48
  import "./chunk-BBKJZ23O.js";
49
49
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmates",
3
- "version": "0.27.0-alpha.8",
3
+ "version": "0.27.0-alpha.9",
4
4
  "description": "OpenMates CLI and SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",