@agentbean/daemon 0.1.15 → 0.1.16

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.
@@ -32,6 +32,35 @@ export function extractHermesReply(output) {
32
32
  .replace(ANSI_RE, '')
33
33
  .replace(/\r\n?/g, '\n')
34
34
  .split('\n');
35
+ let boxStart = -1;
36
+ for (let i = lines.length - 1; i >= 0; i -= 1) {
37
+ if (lines[i]?.trim().startsWith('╭')) {
38
+ boxStart = i;
39
+ break;
40
+ }
41
+ }
42
+ if (boxStart >= 0) {
43
+ const boxLines = [];
44
+ for (const line of lines.slice(boxStart + 1)) {
45
+ const trimmed = line.trim();
46
+ if (trimmed.startsWith('╰'))
47
+ break;
48
+ if (BOX_ONLY_RE.test(trimmed))
49
+ continue;
50
+ boxLines.push(line);
51
+ }
52
+ const boxedReply = boxLines
53
+ .map((line) => line.trimEnd())
54
+ .filter((line) => {
55
+ const trimmed = line.trim();
56
+ return !(trimmed.startsWith('╭') || trimmed.startsWith('╰') || BOX_ONLY_RE.test(trimmed));
57
+ })
58
+ .map((line) => line.replace(/^[│┃]\s?/, '').replace(/\s?[│┃]$/, '').replace(/^\s{2,}/, ''))
59
+ .join('\n')
60
+ .trim();
61
+ if (boxedReply)
62
+ return boxedReply;
63
+ }
35
64
  const cleaned = lines
36
65
  .map((line) => line.trimEnd())
37
66
  .filter((line) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agentbean/daemon",
3
3
  "private": false,
4
- "version": "0.1.15",
4
+ "version": "0.1.16",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "bin": {