@castlemilk/omega 0.6.2 → 0.6.3

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/dist/cli.js CHANGED
@@ -57,6 +57,7 @@ function useTasks(pollMs = 1e3) {
57
57
  };
58
58
  useEffect(() => {
59
59
  let cancelled = false;
60
+ let timer;
60
61
  const tick = async () => {
61
62
  try {
62
63
  const res = await fetch(`${API}/tasks`);
@@ -98,7 +99,7 @@ function useTasks(pollMs = 1e3) {
98
99
  }
99
100
  }
100
101
  if (!cancelled) {
101
- setTimeout(() => {
102
+ timer = setTimeout(() => {
102
103
  void tick();
103
104
  }, pollMs);
104
105
  }
@@ -106,6 +107,7 @@ function useTasks(pollMs = 1e3) {
106
107
  void tick();
107
108
  return () => {
108
109
  cancelled = true;
110
+ if (timer) clearTimeout(timer);
109
111
  };
110
112
  }, [pollMs]);
111
113
  return { tasks, logs, connected };
@@ -161,7 +163,6 @@ function TaskList({
161
163
  tasks,
162
164
  height,
163
165
  collapsed,
164
- toggle: _toggle,
165
166
  columns
166
167
  }) {
167
168
  const sorted = useMemo(
@@ -186,21 +187,31 @@ function TaskList({
186
187
  }
187
188
  const availableLines = Math.max(0, height - 3);
188
189
  const visible = sorted.slice(0, availableLines);
189
- return /* @__PURE__ */ jsxs(Box, { borderStyle: "single", paddingX: 1, flexDirection: "column", height, flexShrink: 0, children: [
190
- header,
191
- visible.length === 0 && /* @__PURE__ */ jsx(Text, { dimColor: true, children: "No tasks yet. Create one in the web UI." }),
192
- visible.map((task) => {
193
- const providerText = task.provider ? `${task.provider}/${task.model ?? ""}` : "-";
194
- const titleMax = Math.max(10, columns - 50);
195
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", gap: 1, children: [
196
- /* @__PURE__ */ jsx(Text, { color: statusColor(task.status), children: statusSymbol(task.status) }),
197
- /* @__PURE__ */ jsx(Box, { width: 20, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: formatTime(new Date(task.updatedAt)) }) }),
198
- /* @__PURE__ */ jsx(Box, { width: 12, children: /* @__PURE__ */ jsx(Text, { color: statusColor(task.status), bold: true, children: task.status.toUpperCase() }) }),
199
- /* @__PURE__ */ jsx(Box, { width: 24, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: truncate(providerText, 23) }) }),
200
- /* @__PURE__ */ jsx(Box, { flexGrow: 1, children: /* @__PURE__ */ jsx(Text, { children: truncate(task.title, titleMax) }) })
201
- ] }, task.id);
202
- })
203
- ] });
190
+ return /* @__PURE__ */ jsxs(
191
+ Box,
192
+ {
193
+ borderStyle: "single",
194
+ paddingX: 1,
195
+ flexDirection: "column",
196
+ height,
197
+ flexShrink: 0,
198
+ children: [
199
+ header,
200
+ visible.length === 0 && /* @__PURE__ */ jsx(Text, { dimColor: true, children: "No tasks yet. Create one in the web UI." }),
201
+ visible.map((task) => {
202
+ const providerText = task.provider ? `${task.provider}/${task.model ?? ""}` : "-";
203
+ const titleMax = Math.max(10, columns - 62);
204
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", gap: 1, children: [
205
+ /* @__PURE__ */ jsx(Text, { color: statusColor(task.status), children: statusSymbol(task.status) }),
206
+ /* @__PURE__ */ jsx(Box, { width: 20, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: formatTime(new Date(task.updatedAt)) }) }),
207
+ /* @__PURE__ */ jsx(Box, { width: 12, children: /* @__PURE__ */ jsx(Text, { color: statusColor(task.status), bold: true, children: task.status.toUpperCase() }) }),
208
+ /* @__PURE__ */ jsx(Box, { width: 24, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: truncate(providerText, 23) }) }),
209
+ /* @__PURE__ */ jsx(Box, { flexGrow: 1, children: /* @__PURE__ */ jsx(Text, { children: truncate(task.title, titleMax) }) })
210
+ ] }, task.id);
211
+ })
212
+ ]
213
+ }
214
+ );
204
215
  }
205
216
  function ConsoleLog({
206
217
  logs,
@@ -227,7 +238,7 @@ function TuiApp() {
227
238
  const { tasks, logs, connected } = useTasks();
228
239
  const { columns, rows } = useWindowSize();
229
240
  const [tasksCollapsed, setTasksCollapsed] = useState(false);
230
- const [sidebar, setSidebar] = useState(false);
241
+ const [sidebar, setSidebar] = useState(() => columns >= 100);
231
242
  useInput((input, key) => {
232
243
  if (input === "q" || key.escape) {
233
244
  exit();
@@ -239,11 +250,16 @@ function TuiApp() {
239
250
  setSidebar((s) => !s);
240
251
  }
241
252
  });
253
+ useEffect(() => {
254
+ if (columns >= 100 && !sidebar) setSidebar(true);
255
+ if (columns < 80 && sidebar) setSidebar(false);
256
+ }, [columns, sidebar]);
257
+ const taskListWidth = sidebar ? Math.max(30, Math.floor(columns * 0.4)) : columns;
258
+ const consoleColumns = sidebar ? Math.max(20, columns - taskListWidth - 1) : columns;
242
259
  const mainHeight = Math.max(6, rows - 9);
243
- const taskListWidth = sidebar ? Math.max(30, Math.floor(columns * 0.4)) : void 0;
244
- const taskListHeight = sidebar ? mainHeight : tasksCollapsed ? 3 : Math.max(3, Math.floor(mainHeight * 0.45));
245
- const consoleHeight = sidebar ? mainHeight : mainHeight - taskListHeight;
246
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", height: rows, width: columns, gap: 1, padding: 1, children: [
260
+ const taskListHeight = sidebar ? mainHeight : tasksCollapsed ? 3 : Math.max(6, Math.floor(mainHeight * 0.45));
261
+ const consoleHeight = sidebar ? mainHeight : Math.max(3, mainHeight - taskListHeight);
262
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", height: rows, width: columns, gap: 1, children: [
247
263
  /* @__PURE__ */ jsx(Header, { connected }),
248
264
  /* @__PURE__ */ jsx(Stats, { tasks }),
249
265
  /* @__PURE__ */ jsxs(Box, { flexDirection: sidebar ? "row" : "column", gap: 1, flexGrow: 1, children: [
@@ -253,15 +269,12 @@ function TuiApp() {
253
269
  tasks,
254
270
  height: taskListHeight,
255
271
  collapsed: tasksCollapsed,
256
- toggle: () => {
257
- setTasksCollapsed((c) => !c);
258
- },
259
- columns: taskListWidth ?? columns
272
+ columns: taskListWidth
260
273
  }
261
274
  ),
262
- /* @__PURE__ */ jsx(ConsoleLog, { logs, height: consoleHeight, columns })
275
+ /* @__PURE__ */ jsx(ConsoleLog, { logs, height: consoleHeight, columns: consoleColumns })
263
276
  ] }),
264
- /* @__PURE__ */ jsx(Box, { height: 1, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: "q/esc quit \u2022 t toggle tasks \u2022 s toggle sidebar" }) })
277
+ /* @__PURE__ */ jsx(Box, { height: 1, flexShrink: 0, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: "q/esc quit \u2022 t toggle tasks \u2022 s toggle sidebar" }) })
265
278
  ] });
266
279
  }
267
280
  var API;
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  -42
2
2
  /pglite/data
3
- 1783000357
3
+ 1783002024
4
4
  5432
5
5
 
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@castlemilk/omega",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Omega Harness CLI - installable via npx",
5
5
  "type": "module",
6
6
  "main": "./dist/cli.js",