wtt-connect 0.2.25 → 0.2.26
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/adapters/generic-cli.js +12 -5
package/package.json
CHANGED
|
@@ -31,13 +31,13 @@ export const CLI_PROFILES = {
|
|
|
31
31
|
defaultBin: 'gemini',
|
|
32
32
|
sessionKey: 'geminiSessionId',
|
|
33
33
|
buildArgs: ({ prompt, config, sessionId, context }) => {
|
|
34
|
-
const args = ['--output-format', 'stream-json'];
|
|
34
|
+
const args = ['--skip-trust', '--output-format', 'stream-json'];
|
|
35
35
|
if (['yolo', 'full-auto', 'force'].includes(normalizeMode(config.mode))) args.push('-y');
|
|
36
36
|
else if (['auto-edit', 'auto_edit', 'auto'].includes(normalizeMode(config.mode))) args.push('--approval-mode', 'auto_edit');
|
|
37
37
|
else if (['plan', 'suggest'].includes(normalizeMode(config.mode))) args.push('--approval-mode', 'plan');
|
|
38
38
|
if (sessionId) args.push('--resume', sessionId);
|
|
39
39
|
if (config.model) args.push('-m', config.model);
|
|
40
|
-
args.push('-p', '
|
|
40
|
+
args.push('-p', '');
|
|
41
41
|
return { args, stdin: appendAttachmentRefs(prompt, context) };
|
|
42
42
|
},
|
|
43
43
|
},
|
|
@@ -184,7 +184,7 @@ function runCli(bin, args, stdinText, cwd, onEvent, timeoutMs) {
|
|
|
184
184
|
const eventSessionId = extractSessionId(event);
|
|
185
185
|
if (eventSessionId) sessionId = eventSessionId;
|
|
186
186
|
const text = extractText(event);
|
|
187
|
-
if (text) texts.push(text);
|
|
187
|
+
if (text) texts.push({ text, delta: event.delta === true });
|
|
188
188
|
onEvent?.(event);
|
|
189
189
|
});
|
|
190
190
|
child.on('close', (code) => {
|
|
@@ -197,8 +197,13 @@ function runCli(bin, args, stdinText, cwd, onEvent, timeoutMs) {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
function collapseText(texts, plainStdout) {
|
|
200
|
-
const filtered = texts
|
|
201
|
-
|
|
200
|
+
const filtered = texts
|
|
201
|
+
.map((entry) => ({ text: String(entry?.text || ''), delta: entry?.delta === true }))
|
|
202
|
+
.filter((entry) => entry.text.trim());
|
|
203
|
+
if (filtered.length) {
|
|
204
|
+
const joiner = filtered.every((entry) => entry.delta) ? '' : '\n';
|
|
205
|
+
return filtered.map((entry) => entry.text.trim()).join(joiner).trim();
|
|
206
|
+
}
|
|
202
207
|
return String(plainStdout || '').trim();
|
|
203
208
|
}
|
|
204
209
|
|
|
@@ -221,6 +226,8 @@ function isSessionEvent(event) {
|
|
|
221
226
|
|
|
222
227
|
function extractText(event) {
|
|
223
228
|
if (typeof event === 'string') return event;
|
|
229
|
+
const role = String(event.role || '').toLowerCase();
|
|
230
|
+
if (role && role !== 'assistant') return '';
|
|
224
231
|
for (const key of ['result', 'text', 'content', 'message', 'output', 'output_text', 'final', 'response']) {
|
|
225
232
|
const value = event[key];
|
|
226
233
|
const text = valueToText(value);
|