openmates 0.27.0-alpha.5 → 0.27.0-alpha.6

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.
@@ -84546,6 +84546,21 @@ function padCells(value, width) {
84546
84546
  const trimmed = truncateCells(value, width);
84547
84547
  return trimmed + " ".repeat(Math.max(0, width - cells(trimmed)));
84548
84548
  }
84549
+ function sliceCells(value, start, width) {
84550
+ start = Math.max(0, Math.floor(start));
84551
+ width = Math.max(0, Math.floor(width));
84552
+ const end = start + width;
84553
+ let position = 0, result = "";
84554
+ for (const { segment } of segments.segment(terminalText(value).replace(/\n/g, " "))) {
84555
+ const size = graphemeWidth(segment), next = position + size;
84556
+ if (next > start && position < end) {
84557
+ result += position >= start && next <= end ? segment : " ".repeat(Math.min(end, next) - Math.max(start, position));
84558
+ }
84559
+ position = next;
84560
+ if (position >= end) break;
84561
+ }
84562
+ return result + " ".repeat(Math.max(0, width - cells(result)));
84563
+ }
84549
84564
  function wrapCells(value, width) {
84550
84565
  width = Math.max(1, width);
84551
84566
  const result = [];
@@ -85572,7 +85587,7 @@ function workspaceHint(state) {
85572
85587
  if (state.screen === "app") return "1\u20135 tabs \u2191/\u2193 choose Enter open Esc Apps /search";
85573
85588
  if (state.screen === "app-skill") return "1\u20133 tabs Enter use skill Esc app Ctrl+P actions";
85574
85589
  if (state.screen === "app-result") return "\u2191/\u2193 scroll Esc saved results Ctrl+P actions";
85575
- if (state.screen === "apps") return "\u2191/\u2193 choose Enter open /search /browse Show all Tab focus";
85590
+ if (state.screen === "apps") return state.focus === "composer" ? "Type /command Shift+Tab apps Ctrl+B sidebar" : "\u2190/\u2192 app Enter open \u2191/\u2193 scroll /search /browse Show all Ctrl+B sidebar";
85576
85591
  if (state.screen === "projects" || state.screen === "tasks" || state.screen === "workflows") return "\u2191/\u2193 choose Enter open /search filter Tab focus Ctrl+P actions";
85577
85592
  if (state.screen === "interests") return "\u2191/\u2193 move Space select Enter continue Esc back";
85578
85593
  if (state.screen === "examples") return "\u2191/\u2193 choose Enter open /search filter Esc back";
@@ -85637,7 +85652,7 @@ function renderWorkspaceFrame(state, rawWidth, rawHeight, body, options = {}) {
85637
85652
  const markers = content.map((row, index) => /(?:^|[│|])\s*[>›] /.test(lineText(row)) ? index : -1).filter((index) => index >= 0);
85638
85653
  const marker = state.screen === "workflow" ? markers.at(-1) ?? -1 : markers[0] ?? -1;
85639
85654
  let selectionEnd = marker;
85640
- if (["workflow", "start", "chats"].includes(state.screen) && marker >= 0) {
85655
+ if (["workflow", "start", "chats", "apps"].includes(state.screen) && marker >= 0) {
85641
85656
  const closing = content.findIndex((row, index) => index > marker && lineText(row).includes("\u2570"));
85642
85657
  selectionEnd = Math.min(marker + 10, closing < 0 ? marker : closing);
85643
85658
  }
@@ -85690,6 +85705,48 @@ function titleCase(value) {
85690
85705
  return value.charAt(0).toUpperCase() + value.slice(1);
85691
85706
  }
85692
85707
 
85708
+ // src/tuiCarousel.ts
85709
+ function renderCardCarousel(cards, width, selectedIndex, focused) {
85710
+ width = Math.max(1, Math.floor(width));
85711
+ if (!cards.length) return [];
85712
+ const selected = Math.max(0, Math.min(cards.length - 1, selectedIndex));
85713
+ const cardWidth = Math.min(width, 36), inner = Math.max(1, cardWidth - 4), stride = cardWidth + 2;
85714
+ const center = Math.floor((width - cardWidth) / 2);
85715
+ const reach = Math.ceil(width / stride);
85716
+ const visible = cards.slice(Math.max(0, selected - reach), selected + reach + 1).map((card, offset) => {
85717
+ const index = Math.max(0, selected - reach) + offset, active = index === selected && focused;
85718
+ const title = wrapCells(`${active ? "\u203A " : ""}${card.title}`, inner).slice(0, 2);
85719
+ const description = wrapCells(card.description, inner).slice(0, 2);
85720
+ while (title.length < 2) title.push("");
85721
+ while (description.length < 2) description.push("");
85722
+ const rows2 = cardWidth < 4 ? [truncateCells(card.title, cardWidth)] : [
85723
+ `\u256D${"\u2500".repeat(cardWidth - 2)}\u256E`,
85724
+ ...title.map((line) => `\u2502 ${padCells(line, inner)} \u2502`),
85725
+ ...description.map((line) => `\u2502 ${padCells(line, inner)} \u2502`),
85726
+ `\u2502 ${padCells(card.footer, inner)} \u2502`,
85727
+ `\u2570${"\u2500".repeat(cardWidth - 2)}\u256F`
85728
+ ];
85729
+ return { rows: rows2, left: center + (index - selected) * stride, background: card.background, active };
85730
+ });
85731
+ return Array.from({ length: visible[0].rows.length }, (_, row) => {
85732
+ const spans = [];
85733
+ let column = 0;
85734
+ for (const card of visible) {
85735
+ const start = Math.max(0, card.left), end = Math.min(width, card.left + cardWidth);
85736
+ if (end <= start) continue;
85737
+ if (start > column) spans.push({ text: " ".repeat(start - column) });
85738
+ spans.push({ text: sliceCells(card.rows[row], Math.max(0, -card.left), end - start), background: card.background, bold: card.active });
85739
+ column = end;
85740
+ }
85741
+ if (column < width) spans.push({ text: " ".repeat(width - column) });
85742
+ return { text: spans.map((span) => span.text).join(""), spans };
85743
+ });
85744
+ }
85745
+ function centeredCarouselText(text4, width) {
85746
+ const value = truncateCells(text4, width);
85747
+ return " ".repeat(Math.max(0, Math.floor((width - cells(value)) / 2))) + value;
85748
+ }
85749
+
85693
85750
  // ../workspaceInspirationDefaults.ts
85694
85751
  function getWorkspaceInspirations(surface) {
85695
85752
  const now = Math.floor(Date.now() / 1e3);
@@ -85950,10 +86007,7 @@ async function loadHomeData(state, client2, render) {
85950
86007
  render();
85951
86008
  }
85952
86009
  }
85953
- function centered2(text4, width) {
85954
- const value = truncateCells(text4, width);
85955
- return " ".repeat(Math.max(0, Math.floor((width - cells(value)) / 2))) + value;
85956
- }
86010
+ var centered2 = centeredCarouselText;
85957
86011
  function homeHeader(state, width, height) {
85958
86012
  const inspiration = currentInspiration(state), rows2 = Math.max(4, Math.min(8, Math.floor(height / 5))), result = [];
85959
86013
  const gradient = inspiration?.category && CATEGORY_GRADIENTS[inspiration.category] || CATEGORY_GRADIENTS.general_knowledge;
@@ -85977,40 +86031,12 @@ function renderHomeChatCards(state, width, height) {
85977
86031
  }
85978
86032
  result.push(centered2(state.signedIn ? "Continue where you left off" : "Explore example chats", width), "");
85979
86033
  const selected = Math.max(0, Math.min(chats.length - 1, state.selectedIndex));
85980
- const cardWidth = Math.min(width, 36), inner = Math.max(1, cardWidth - 4), stride = cardWidth + 2;
85981
- const slots = Math.max(1, Math.floor((width + 2) / stride));
85982
- const first = Math.max(0, selected - slots + 1);
85983
- const cards = chats.slice(first, first + slots + 1).map((chat, index) => {
85984
- const active = first + index === selected && state.focus === "content";
85985
- const title = wrapCells(`${active ? "\u203A " : ""}${chat.title || "Untitled chat"}`, inner).slice(0, 2);
85986
- const summary = wrapCells(chat.summary || "Continue this conversation", inner).slice(0, 2);
85987
- while (title.length < 2) title.push("");
85988
- while (summary.length < 2) summary.push("");
85989
- const rows2 = cardWidth < 4 ? [truncateCells(chat.title || "Untitled chat", cardWidth)] : [
85990
- `\u256D${"\u2500".repeat(cardWidth - 2)}\u256E`,
85991
- ...title.map((line) => `\u2502 ${padCells(line, inner)} \u2502`),
85992
- ...summary.map((line) => `\u2502 ${padCells(line, inner)} \u2502`),
85993
- `\u2502 ${padCells(chat.category?.replaceAll("_", " ") || "Chat", inner)} \u2502`,
85994
- `\u2570${"\u2500".repeat(cardWidth - 2)}\u256F`
85995
- ];
85996
- return { rows: rows2, background: (chat.category && CATEGORY_GRADIENTS[chat.category] || BLUE).start, active };
85997
- });
85998
- for (let row = 0; row < cards[0].rows.length; row++) {
85999
- const spans = [];
86000
- let remaining = width;
86001
- for (const card of cards) {
86002
- if (!remaining) break;
86003
- const text4 = truncateCells(card.rows[row], remaining);
86004
- spans.push({ text: text4, background: card.background, bold: card.active });
86005
- remaining -= cells(text4);
86006
- if (remaining) {
86007
- const gap = " ".repeat(Math.min(2, remaining));
86008
- spans.push({ text: gap });
86009
- remaining -= gap.length;
86010
- }
86011
- }
86012
- result.push({ text: spans.map((span) => span.text).join(""), spans });
86013
- }
86034
+ result.push(...renderCardCarousel(chats.map((chat) => ({
86035
+ title: chat.title || "Untitled chat",
86036
+ description: chat.summary || "Continue this conversation",
86037
+ footer: chat.category?.replaceAll("_", " ") || "Chat",
86038
+ background: (chat.category && CATEGORY_GRADIENTS[chat.category] || BLUE).start
86039
+ })), width, selected, state.focus === "content"));
86014
86040
  result.push(
86015
86041
  "",
86016
86042
  centered2(`${selected > 0 ? "\u2039" : " "} Chat ${selected + 1} of ${chats.length} ${selected < chats.length - 1 ? "\u203A" : " "}`, width),
@@ -86228,20 +86254,26 @@ function visibleTuiApps(apps, query = "") {
86228
86254
  const words = query.toLocaleLowerCase().trim().split(/\s+/).filter(Boolean);
86229
86255
  return apps.filter((app) => words.every((word) => `${app.name} ${app.description} ${app.category} ${app.skills.map((skill) => skill.name).join(" ")}`.toLocaleLowerCase().includes(word)));
86230
86256
  }
86257
+ function homeTuiApps(apps, query = "", showAll = false) {
86258
+ const visible = visibleTuiApps(apps, query);
86259
+ return showAll || query ? visible : visible.slice(0, HOME_APP_ORDER.length);
86260
+ }
86231
86261
  function renderTuiAppsHome(apps, options) {
86232
86262
  const width = Math.max(1, options.width);
86233
86263
  const visible = visibleTuiApps(apps, options.query);
86234
- const lines = [];
86235
- if (!visible.length) lines.push(options.query ? "No matching apps." : "No apps available.");
86236
- for (const app of visible) {
86237
- lines.push(...cardLines(
86238
- `${app.id === options.selectedId ? "\u203A" : " "} ${app.name}`,
86239
- app.description,
86240
- `${app.skills.length} skills${app.category ? ` \xB7 ${app.category.replaceAll("_", " ")}` : ""}`,
86241
- width
86242
- ), "");
86243
- }
86244
- return lines;
86264
+ if (!visible.length) return [centeredCarouselText(options.query ? "No matching apps." : "No apps available.", width)];
86265
+ const selected = Math.max(0, Math.min(visible.length - 1, options.selectedIndex ?? visible.findIndex((app) => app.id === options.selectedId)));
86266
+ return [
86267
+ ...renderCardCarousel(visible.map((app) => ({
86268
+ title: app.name,
86269
+ description: app.description,
86270
+ footer: `${app.skills.length} skills${app.category ? ` \xB7 ${app.category.replaceAll("_", " ")}` : ""}`,
86271
+ background: (APP_GRADIENTS[app.id] ?? PRIMARY_GRADIENT).start
86272
+ })), width, selected, options.selectedId !== void 0),
86273
+ "",
86274
+ centeredCarouselText(`${selected > 0 ? "\u2039" : " "} App ${selected + 1} of ${visible.length} ${selected < visible.length - 1 ? "\u203A" : " "}`, width),
86275
+ centeredCarouselText("\u2190/\u2192 choose app \xB7 Enter open \xB7 Tab focus", width)
86276
+ ];
86245
86277
  }
86246
86278
  function cardLines(title, description, footer, width) {
86247
86279
  if (width < 4) return [truncateCells(title, width)];
@@ -86888,8 +86920,13 @@ function renderBody(state, width, height) {
86888
86920
  case "chats":
86889
86921
  return renderHomeChatCards(state, width, height);
86890
86922
  case "apps": {
86891
- const apps = visibleTuiApps(state.apps, state.filter), visible = state.homeShowAll || state.filter ? apps : apps.slice(0, Math.max(6, state.selectedIndex + 1));
86892
- return [...homeHeader(state, width, height), ...homeCards(renderTuiAppsHome(visible, { width: Math.min(width, 88), selectedId: state.focus === "content" ? apps[state.selectedIndex]?.id : void 0 }), width, visible.map((app) => APP_GRADIENTS[app.id] ?? PRIMARY_GRADIENT)), "Show all \xB7 /search Search apps"];
86923
+ const apps = homeTuiApps(state.apps, state.filter, state.homeShowAll);
86924
+ return [
86925
+ ...homeHeader(state, width, height),
86926
+ ...renderTuiAppsHome(apps, { width, selectedIndex: state.selectedIndex, selectedId: state.focus === "content" ? apps[state.selectedIndex]?.id : void 0 }),
86927
+ "",
86928
+ centeredCarouselText(`${state.homeShowAll ? "/browse Featured apps" : "/browse Show all"} \xB7 /search Search apps`, width)
86929
+ ];
86893
86930
  }
86894
86931
  case "app": {
86895
86932
  const app = state.activeApp;
@@ -87750,8 +87787,8 @@ async function handleWorkspaceKey(context, chunk, key) {
87750
87787
  return true;
87751
87788
  }
87752
87789
  if (state.workflowEdit) return false;
87753
- const chatHome = state.screen === "start" || state.screen === "chats";
87754
- if (["pageup", "pagedown", "home", "end", "scrollup", "scrolldown"].includes(key.name ?? "") || (chatHome || state.screen === "project" && state.projectTab === "overview") && ["up", "down"].includes(key.name ?? "") && ["composer", "content"].includes(state.focus) && !state.input.startsWith("/")) {
87790
+ const chatHome = state.screen === "start" || state.screen === "chats", carouselHome = chatHome || state.screen === "apps";
87791
+ if (["pageup", "pagedown", "home", "end", "scrollup", "scrolldown"].includes(key.name ?? "") || (carouselHome || state.screen === "project" && state.projectTab === "overview") && ["up", "down"].includes(key.name ?? "") && ["composer", "content"].includes(state.focus) && !state.input.startsWith("/")) {
87755
87792
  const bottom = state.screen === "chat";
87756
87793
  state.followSelection = false;
87757
87794
  if (key.name === "home") state.scrollOffset = bottom ? 1e4 : 0;
@@ -87824,8 +87861,9 @@ async function handleWorkspaceKey(context, chunk, key) {
87824
87861
  render();
87825
87862
  return true;
87826
87863
  }
87827
- if (chatHome && state.focus === "content" && (key.name === "left" || key.name === "right")) {
87828
- state.selectedIndex = Math.max(0, Math.min(Math.max(0, homeChatItems(state).length - 1), state.selectedIndex + (key.name === "left" ? -1 : 1)));
87864
+ if (carouselHome && state.focus === "content" && (key.name === "left" || key.name === "right")) {
87865
+ const count = chatHome ? homeChatItems(state).length : homeTuiApps(state.apps, state.filter, state.homeShowAll).length;
87866
+ state.selectedIndex = Math.max(0, Math.min(Math.max(0, count - 1), state.selectedIndex + (key.name === "left" ? -1 : 1)));
87829
87867
  state.followSelection = true;
87830
87868
  render();
87831
87869
  return true;
@@ -87880,7 +87918,7 @@ async function handleWorkspaceKey(context, chunk, key) {
87880
87918
  }
87881
87919
  const resultsTab = state.screen === "app" ? state.appTab === "embeds" : state.screen === "app-skill" && state.appSkillTab === "embeds";
87882
87920
  const workflowsTab = state.screen === "app" ? state.appTab === "workflows" : state.screen === "app-skill" && state.appSkillTab === "workflows";
87883
- const count = state.screen === "apps" ? visibleTuiApps(state.apps, state.filter).length : resultsTab ? state.appResults.items.length : workflowsTab ? state.appWorkflows.items.length : state.activeApp?.skills.length ?? 0;
87921
+ const count = state.screen === "apps" ? homeTuiApps(state.apps, state.filter, state.homeShowAll).length : resultsTab ? state.appResults.items.length : workflowsTab ? state.appWorkflows.items.length : state.activeApp?.skills.length ?? 0;
87884
87922
  if (key.name === "up" || key.name === "down") {
87885
87923
  state.selectedIndex = Math.max(0, Math.min(count - 1, state.selectedIndex + (key.name === "up" ? -1 : 1)));
87886
87924
  render();
@@ -87888,7 +87926,7 @@ async function handleWorkspaceKey(context, chunk, key) {
87888
87926
  }
87889
87927
  if (key.name === "return") {
87890
87928
  if (state.screen === "apps") {
87891
- const app = visibleTuiApps(state.apps, state.filter)[state.selectedIndex];
87929
+ const app = homeTuiApps(state.apps, state.filter, state.homeShowAll)[state.selectedIndex];
87892
87930
  if (app) await context.command(`/app ${app.id}`);
87893
87931
  } else if (resultsTab) {
87894
87932
  const result = state.appResults.items[state.selectedIndex];
package/dist/cli.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  serializeToYaml,
20
20
  shouldRequireTrustedAccountGuard,
21
21
  waitForWorkflowRun
22
- } from "./chunk-P4SMXK2Z.js";
22
+ } from "./chunk-WQOBJUWS.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-P4SMXK2Z.js";
46
+ } from "./chunk-WQOBJUWS.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.5",
3
+ "version": "0.27.0-alpha.6",
4
4
  "description": "OpenMates CLI and SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",