@clawdbot/zalouser 2026.1.20 → 2026.1.22

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 (3) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/package.json +1 -1
  3. package/src/zca.ts +26 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026.1.22
4
+
5
+ ### Changes
6
+ - Version alignment with core Clawdbot release numbers.
7
+
8
+ ## 2026.1.21
9
+
10
+ ### Changes
11
+ - Version alignment with core Clawdbot release numbers.
12
+
3
13
  ## 2026.1.20
4
14
 
5
15
  ### Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawdbot/zalouser",
3
- "version": "2026.1.20",
3
+ "version": "2026.1.22",
4
4
  "type": "module",
5
5
  "description": "Clawdbot Zalo Personal Account plugin via zca-cli",
6
6
  "dependencies": {
package/src/zca.ts CHANGED
@@ -114,11 +114,36 @@ export function runZcaInteractive(
114
114
  });
115
115
  }
116
116
 
117
+ function stripAnsi(str: string): string {
118
+ return str.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "");
119
+ }
120
+
117
121
  export function parseJsonOutput<T>(stdout: string): T | null {
118
122
  try {
119
123
  return JSON.parse(stdout) as T;
120
124
  } catch {
121
- return null;
125
+ const cleaned = stripAnsi(stdout);
126
+
127
+ try {
128
+ return JSON.parse(cleaned) as T;
129
+ } catch {
130
+ // zca may prefix output with INFO/log lines, try to find JSON
131
+ const lines = cleaned.split("\n");
132
+
133
+ for (let i = 0; i < lines.length; i++) {
134
+ const line = lines[i].trim();
135
+ if (line.startsWith("{") || line.startsWith("[")) {
136
+ // Try parsing from this line to the end
137
+ const jsonCandidate = lines.slice(i).join("\n").trim();
138
+ try {
139
+ return JSON.parse(jsonCandidate) as T;
140
+ } catch {
141
+ continue;
142
+ }
143
+ }
144
+ }
145
+ return null;
146
+ }
122
147
  }
123
148
  }
124
149