@lazyingart/agintiflow 0.16.0 → 0.16.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazyingart/agintiflow",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "type": "module",
5
5
  "description": "AgInTiFlow is a resumable Playwright website-control agent with OpenAI-compatible tool calling.",
6
6
  "license": "Apache-2.0",
@@ -93,6 +93,9 @@ try {
93
93
  if (!promptText.includes("user>")) {
94
94
  throw new Error("terminal prompt layout did not render the user> label");
95
95
  }
96
+ if (!promptText.includes("user> ")) {
97
+ throw new Error("terminal prompt layout did not pad user> to the aginti> label width");
98
+ }
96
99
  const visibleLengths = promptLayout.renderedRows.map((line) =>
97
100
  line.replace(/\x1b\[[0-9;?]*[ -/]*[@-~]/g, "").length
98
101
  );
@@ -73,8 +73,17 @@ function sleep(ms) {
73
73
  return new Promise((resolve) => setTimeout(resolve, ms));
74
74
  }
75
75
 
76
+ const ROLE_LABEL_WIDTH = "aginti".length;
77
+ const PROMPT_LABEL_WIDTH = "aginti>".length;
78
+
79
+ function labelText(name, { prompt = false } = {}) {
80
+ const raw = String(name || "");
81
+ const width = prompt || raw.endsWith(">") ? PROMPT_LABEL_WIDTH : ROLE_LABEL_WIDTH;
82
+ return ` ${raw.padEnd(width, " ")} `;
83
+ }
84
+
76
85
  function label(name, bgCode) {
77
- return color(` ${name} `, bgCode, ansi.bold);
86
+ return color(labelText(name), bgCode, ansi.bold);
78
87
  }
79
88
 
80
89
  function outputLine(line = "") {
@@ -542,8 +551,8 @@ export function buildPromptLayout(buffer = "", cursor = 0, width = terminalWidth
542
551
  const safeBuffer = String(buffer || "");
543
552
  const safeCursor = clamp(Number(cursor) || 0, 0, safeBuffer.length);
544
553
  const lineWidth = editorWidth(width);
545
- const firstPrefix = " user> ";
546
- const nextPrefix = " ... ";
554
+ const firstPrefix = labelText("user>", { prompt: true });
555
+ const nextPrefix = labelText("...", { prompt: true });
547
556
  const firstInnerWidth = Math.max(lineWidth - firstPrefix.length, 8);
548
557
  const nextInnerWidth = Math.max(lineWidth - nextPrefix.length, 8);
549
558
  const rows = [];