@lardexx/arenacode 2.5.7 → 2.5.8
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 +1 -1
- package/src/cli.js +24 -4
- package/src/tui/app.js +7 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lardexx/arenacode",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.8",
|
|
4
4
|
"description": "Terminal client for ArenaCode: talks to an arena-bridge, streams the Agent Mode timeline, and runs local commands and file operations on your PC. Node port of the ArenaCode desktop client.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
package/src/cli.js
CHANGED
|
@@ -142,11 +142,26 @@ async function cmdInit(flags, { tail = true } = {}) {
|
|
|
142
142
|
const cfg = readConfig();
|
|
143
143
|
write(c.gray(` config file: ${configPath()}`));
|
|
144
144
|
write('');
|
|
145
|
-
const url = await ask(` Bridge URL ${cfg.url ? c.gray(`[${cfg.url}]`) : ''}: `, { default: cfg.url });
|
|
146
|
-
const key = await ask(` API key ${cfg.key ? c.gray('[configured]') : ''}: `, { default: cfg.key });
|
|
145
|
+
const url = String(await ask(` Bridge URL ${cfg.url ? c.gray(`[${cfg.url}]`) : ''}: `, { default: cfg.url })).trim();
|
|
146
|
+
const key = String(await ask(` API key ${cfg.key ? c.gray('[configured]') : ''}: `, { default: cfg.key })).trim();
|
|
147
|
+
|
|
148
|
+
// Never write an empty answer over a working configuration: an empty URL here is what makes
|
|
149
|
+
// every later command (ping included) print the setup notice instead of talking to the bridge.
|
|
150
|
+
const cleanUrl = url.replace(/\/+$/, '');
|
|
151
|
+
if (!cleanUrl || !key) {
|
|
152
|
+
write('');
|
|
153
|
+
write(c.red(` ✗ nothing saved: ${!cleanUrl ? 'bridge URL' : 'API key'} is empty`));
|
|
154
|
+
write(c.gray(` run: ${SELF} init (or: ${SELF} config set url https://your-bridge.tunnl.gg)`));
|
|
155
|
+
return 1;
|
|
156
|
+
}
|
|
157
|
+
if (!/^https?:\/\//i.test(cleanUrl)) {
|
|
158
|
+
write('');
|
|
159
|
+
write(c.red(' ✗ nothing saved: the URL must start with http:// or https://'));
|
|
160
|
+
return 1;
|
|
161
|
+
}
|
|
147
162
|
|
|
148
163
|
// no folder question: arenacode always works in the directory it was started from
|
|
149
|
-
const next = { ...cfg, url:
|
|
164
|
+
const next = { ...cfg, url: cleanUrl, key };
|
|
150
165
|
delete next.folder;
|
|
151
166
|
const file = writeConfig(next);
|
|
152
167
|
write(` ${c.green('✓')} saved ${c.gray(file)}`);
|
|
@@ -752,7 +767,12 @@ async function main(argv) {
|
|
|
752
767
|
// `arenacode "instruction"` convenience form
|
|
753
768
|
return cmdAsk(positional, flags);
|
|
754
769
|
}
|
|
755
|
-
|
|
770
|
+
{
|
|
771
|
+
// a typo used to dump the whole help with no clue about what went wrong
|
|
772
|
+
const known = ['init','config','ping','doctor','ask','ui','chat','tasks','status','events','stop','files','cat','attach','handshake','help','version'];
|
|
773
|
+
const near = known.find((k) => k.startsWith(command.slice(0, 3)) || command.startsWith(k.slice(0, 3)));
|
|
774
|
+
write(c.red(` unknown command: ${command}`) + (near ? c.gray(` · did you mean ${c.bold(near)}?`) : ''));
|
|
775
|
+
}
|
|
756
776
|
help();
|
|
757
777
|
return 2;
|
|
758
778
|
}
|
package/src/tui/app.js
CHANGED
|
@@ -704,7 +704,10 @@ class App {
|
|
|
704
704
|
}
|
|
705
705
|
case 'text': {
|
|
706
706
|
let item = st.seqItems.get(`s${ev.seq}`);
|
|
707
|
-
|
|
707
|
+
// agents may send the text in `delta` (streaming) or in `label` (one shot): take either,
|
|
708
|
+
// otherwise the row is empty and the answer silently disappears.
|
|
709
|
+
const delta = String(ev.delta != null && ev.delta !== '' ? ev.delta : (ev.label || '')).replace(/\\n/g, '\n');
|
|
710
|
+
if (!delta) break;
|
|
708
711
|
if (!item) {
|
|
709
712
|
item = this.push({ kind: 'text', text: delta });
|
|
710
713
|
st.seqItems.set(`s${ev.seq}`, item);
|
|
@@ -726,8 +729,9 @@ class App {
|
|
|
726
729
|
this.push({ kind: 'error', text: ev.label || ev.error || 'error' });
|
|
727
730
|
break;
|
|
728
731
|
case 'done': {
|
|
729
|
-
|
|
730
|
-
|
|
732
|
+
// only a *non-empty* text row counts: an empty one used to swallow the task output
|
|
733
|
+
const hasText = st.items.some((i) => i.kind === 'text' && String(i.text || '').trim());
|
|
734
|
+
if (!hasText && ev.output && String(ev.output).trim()) this.push({ kind: 'text', text: String(ev.output) });
|
|
731
735
|
this.push({ kind: 'done', state: ev.state || 'done', secs: ev.secs });
|
|
732
736
|
st.status = 'idle';
|
|
733
737
|
break;
|