@phren/agent 0.1.0 → 0.1.1

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/tui.js +30 -15
  2. package/package.json +2 -2
package/dist/tui.js CHANGED
@@ -198,11 +198,11 @@ export async function startTui(config, spawner) {
198
198
  w.write("\n");
199
199
  // Separator line + prompt on last 2 rows
200
200
  const permLabel = PERMISSION_LABELS[mode];
201
- const separator = s.dim("─".repeat(c));
202
- const rightHints = s.dim(`${bashMode ? "! bash" : permLabel} · shift+tab to cycle · esc to interrupt`);
203
- const rightLen = stripAnsi(rightHints).length;
204
- const sepLine = s.dim("─".repeat(Math.max(1, c - rightLen - 1))) + " " + rightHints;
205
- w.write(`${ESC}${rows - 1};1H${ESC}2K${sepLine}`);
201
+ // 3 bottom rows: separator, permission line, input
202
+ const sepLine = s.dim("".repeat(c));
203
+ const permLine = ` ${modeColor(`${modeIcon} ${permLabel} permissions`)} ${s.dim("(shift+tab to cycle)")}`;
204
+ w.write(`${ESC}${rows - 2};1H${ESC}2K${sepLine}`);
205
+ w.write(`${ESC}${rows - 1};1H${ESC}2K${permLine}`);
206
206
  if (bashMode) {
207
207
  w.write(`${ESC}${rows};1H${ESC}2K${s.yellow("!")} `);
208
208
  }
@@ -241,7 +241,7 @@ export async function startTui(config, spawner) {
241
241
  if (artLines.length > 0) {
242
242
  // Art on left, info on right
243
243
  const info = [
244
- `${s.brand("◆ phren agent")} ${s.dim("v${AGENT_VERSION}")}`,
244
+ `${s.brand("◆ phren agent")} ${s.dim(`v${AGENT_VERSION}`)}`,
245
245
  `${s.dim(config.provider.name)}${project ? s.dim(` · ${project}`) : ""}`,
246
246
  `${s.dim(cwd)}`,
247
247
  ``,
@@ -259,7 +259,7 @@ export async function startTui(config, spawner) {
259
259
  }
260
260
  else {
261
261
  // Fallback: text-only banner
262
- w.write(`\n ${s.brand("◆ phren agent")} ${s.dim("v${AGENT_VERSION}")}\n`);
262
+ w.write(`\n ${s.brand("◆ phren agent")} ${s.dim(`v${AGENT_VERSION}`)}\n`);
263
263
  w.write(` ${s.dim(config.provider.name)}${project ? s.dim(` · ${project}`) : ""} ${s.dim(cwd)}\n`);
264
264
  w.write(` ${modeColor(`${permMode === "full-auto" ? "●" : permMode === "auto-confirm" ? "◐" : "○"} ${permMode}`)} ${s.dim("permissions (shift+tab to cycle)")}\n\n`);
265
265
  w.write(` ${s.dim("Tab")} memory ${s.dim("Shift+Tab")} perms ${s.dim("/help")} cmds ${s.dim("Ctrl+D")} exit\n\n`);
@@ -435,15 +435,30 @@ export async function startTui(config, spawner) {
435
435
  const cmd = bashMode ? line : line.slice(1).trim();
436
436
  bashMode = false;
437
437
  if (cmd) {
438
- try {
439
- const output = execSync(cmd, { encoding: "utf-8", timeout: 30_000, cwd: process.cwd(), stdio: ["ignore", "pipe", "pipe"] });
440
- w.write(output);
441
- if (!output.endsWith("\n"))
442
- w.write("\n");
438
+ // Handle cd specially — change process cwd
439
+ const cdMatch = cmd.match(/^cd\s+(.*)/);
440
+ if (cdMatch) {
441
+ try {
442
+ const target = cdMatch[1].trim().replace(/^~/, os.homedir());
443
+ const resolved = require("path").resolve(process.cwd(), target);
444
+ process.chdir(resolved);
445
+ w.write(s.dim(process.cwd()) + "\n");
446
+ }
447
+ catch (err) {
448
+ w.write(s.red(err.message) + "\n");
449
+ }
443
450
  }
444
- catch (err) {
445
- const e = err;
446
- w.write(s.red(e.stderr || e.message || "Command failed") + "\n");
451
+ else {
452
+ try {
453
+ const output = execSync(cmd, { encoding: "utf-8", timeout: 30_000, cwd: process.cwd(), stdio: ["ignore", "pipe", "pipe"] });
454
+ w.write(output);
455
+ if (!output.endsWith("\n"))
456
+ w.write("\n");
457
+ }
458
+ catch (err) {
459
+ const e = err;
460
+ w.write(s.red(e.stderr || e.message || "Command failed") + "\n");
461
+ }
447
462
  }
448
463
  }
449
464
  prompt();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/agent",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Coding agent with persistent memory — powered by phren",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,7 +13,7 @@
13
13
  "dist"
14
14
  ],
15
15
  "dependencies": {
16
- "@phren/cli": "0.1.0"
16
+ "@phren/cli": "0.1.1"
17
17
  },
18
18
  "engines": {
19
19
  "node": ">=20.0.0"