u-foo 2.3.17 → 2.3.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "u-foo",
3
- "version": "2.3.17",
3
+ "version": "2.3.18",
4
4
  "description": "Multi-Agent Workspace Protocol. Just add u. claude → uclaude, codex → ucodex.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://ufoo.dev",
@@ -1,3 +1,6 @@
1
+ const os = require("os");
2
+ const { version: packageVersion } = require("../../package.json");
3
+
1
4
  function createAgentViewController(options = {}) {
2
5
  const {
3
6
  screen,
@@ -17,6 +20,7 @@ function createAgentViewController(options = {}) {
17
20
  setAgentListWindowStart = () => {},
18
21
  getAgentLabel = (id) => id,
19
22
  getAgentStates = () => ({}),
23
+ getProjectRoot = () => process.cwd(),
20
24
  setDashboardView = () => {},
21
25
  setScreenGrabKeys = (value) => {
22
26
  if (screen) screen.grabKeys = Boolean(value);
@@ -202,31 +206,93 @@ function createAgentViewController(options = {}) {
202
206
  processStdout.write(`\x1b[${row};1H\x1b[2K${content}`);
203
207
  }
204
208
 
205
- function buildInternalStartupLines(agentLabel = "", width = 80) {
209
+ function forceScreenRepaint() {
210
+ if (typeof screen.realloc === "function") {
211
+ screen.realloc();
212
+ return;
213
+ }
214
+ if (typeof screen.alloc === "function") {
215
+ screen.alloc(true);
216
+ }
217
+ }
218
+
219
+ function compactProjectPath(projectRoot = "") {
220
+ const raw = String(projectRoot || process.cwd() || "").trim();
221
+ const home = os.homedir();
222
+ if (home && (raw === home || raw.startsWith(`${home}/`))) {
223
+ return `~${raw.slice(home.length)}`;
224
+ }
225
+ return raw || ".";
226
+ }
227
+
228
+ function borderedLines(lines = [], innerWidth = 56) {
229
+ const contentWidth = Math.max(1, innerWidth);
230
+ const out = [`╭${"─".repeat(contentWidth + 2)}╮`];
231
+ for (const line of lines) {
232
+ out.push(`│ ${fitText(line, contentWidth)} │`);
233
+ }
234
+ out.push(`╰${"─".repeat(contentWidth + 2)}╯`);
235
+ return out;
236
+ }
237
+
238
+ function normalizeAgentKind(agentId = "") {
239
+ const text = String(agentId || "").trim().toLowerCase();
240
+ if (text.startsWith("codex:") || text === "codex") return "codex";
241
+ if (text.startsWith("claude:") || text.startsWith("claude-code:") || text === "claude" || text === "claude-code") {
242
+ return "claude";
243
+ }
244
+ return "internal";
245
+ }
246
+
247
+ function buildClaudeStartupLines(agentLabel = "", width = 80) {
248
+ const label = String(agentLabel || "").trim();
249
+ const projectPath = compactProjectPath(getProjectRoot());
250
+ const product = "Claude Code";
251
+ const detail = label ? `${label} · managed headless` : "managed headless";
252
+ const lines = [
253
+ ` ▐▛███▜▌${product} v${packageVersion}`,
254
+ `▝▜█████▛▘${detail}`,
255
+ ` ▘▘▝▝${projectPath}`,
256
+ "",
257
+ ];
258
+ if (width < 44) return lines;
259
+ return lines.map((line) => padToWidth(line, Math.min(58, Math.max(1, width))));
260
+ }
261
+
262
+ function buildCodexStartupLines(agentLabel = "", width = 80) {
206
263
  const label = String(agentLabel || "").trim();
207
- if (width < 48) {
264
+ const projectPath = compactProjectPath(getProjectRoot());
265
+ if (width < 36) {
208
266
  return [
209
- `Welcome to ufoo internal`,
210
- label ? `agent ${label}` : "agent internal",
267
+ `>_ OpenAI Codex`,
268
+ label ? `model: ${label}` : "model: managed headless",
269
+ `directory: ${projectPath}`,
211
270
  "",
212
271
  ];
213
272
  }
273
+ const innerWidth = Math.min(56, Math.max(24, width - 4));
214
274
  return [
215
- "Welcome to ufoo internal",
216
- "································",
217
- " ░░░░░░ ██╗ ██╗",
218
- " ░░░ ░░░░░░░░░░ ██║ ██║",
219
- " ░░░░░░░░░░░░░░░░ ╚██████╔╝",
220
- label ? `agent ${label}` : "agent internal",
275
+ ...borderedLines([
276
+ `>_ OpenAI Codex (ufoo v${packageVersion})`,
277
+ "",
278
+ `model: ${label ? `${label} · managed headless` : "managed headless"}`,
279
+ `directory: ${projectPath}`,
280
+ ], innerWidth),
221
281
  "",
222
282
  ];
223
283
  }
224
284
 
285
+ function buildInternalStartupLines(agentId = "", agentLabel = "", width = 80) {
286
+ const kind = normalizeAgentKind(agentId);
287
+ if (kind === "codex") return buildCodexStartupLines(agentLabel || agentId, width);
288
+ return buildClaudeStartupLines(agentLabel || agentId, width);
289
+ }
290
+
225
291
  function resetBusView(agentId) {
226
292
  busInputValue = "";
227
293
  busInputCursor = 0;
228
294
  const label = getAgentLabel(agentId);
229
- busLogLines = buildInternalStartupLines(label, getCols());
295
+ busLogLines = buildInternalStartupLines(agentId, label, getCols());
230
296
  }
231
297
 
232
298
  function appendBusLog(text = "") {
@@ -384,7 +450,7 @@ function createAgentViewController(options = {}) {
384
450
  viewingAgent = null;
385
451
 
386
452
  processStdout.write(`\x1b[1;${rows}r`);
387
- processStdout.write("\x1b[2J\x1b[H");
453
+ processStdout.write("\x1b[?25h");
388
454
 
389
455
  if (detachedChildren) {
390
456
  for (const child of detachedChildren) screen.append(child);
@@ -396,9 +462,7 @@ function createAgentViewController(options = {}) {
396
462
  setDashboardView("agents");
397
463
  setSelectedAgentIndex(-1);
398
464
  setScreenGrabKeys(false);
399
- if (typeof screen.alloc === "function") {
400
- screen.alloc();
401
- }
465
+ forceScreenRepaint();
402
466
  clearTargetAgent();
403
467
  renderDashboard();
404
468
  focusInput();
package/src/chat/index.js CHANGED
@@ -1543,6 +1543,7 @@ async function runChat(projectRoot, options = {}) {
1543
1543
  }
1544
1544
  return states;
1545
1545
  },
1546
+ getProjectRoot: () => activeProjectRoot,
1546
1547
  setDashboardView: (value) => {
1547
1548
  dashboardView = value;
1548
1549
  },