@fias/plugin-dev-harness 1.5.11 → 1.5.12
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.
|
@@ -267,6 +267,7 @@
|
|
|
267
267
|
|
|
268
268
|
// Streaming path for entity_invoke with stream: true
|
|
269
269
|
if (data.type === 'entity_invoke' && data.payload && data.payload.stream) {
|
|
270
|
+
logMessage('info', 'Streaming request detected (mode: ' + currentMode + ')');
|
|
270
271
|
handleStreamingRequest(data);
|
|
271
272
|
return;
|
|
272
273
|
}
|
|
@@ -404,7 +405,9 @@
|
|
|
404
405
|
}
|
|
405
406
|
|
|
406
407
|
var contentType = response.headers.get('content-type') || '';
|
|
408
|
+
logMessage('info', 'Live SSE response content-type: ' + contentType);
|
|
407
409
|
if (contentType.indexOf('text/event-stream') === -1) {
|
|
410
|
+
logMessage('warn', 'Not SSE — falling back to JSON');
|
|
408
411
|
return response.json().then(function (result) {
|
|
409
412
|
sendToPlugin({ type: 'response', messageId: data.messageId, payload: result });
|
|
410
413
|
});
|
|
@@ -415,11 +418,12 @@
|
|
|
415
418
|
var decoder = new TextDecoder();
|
|
416
419
|
var buffer = '';
|
|
417
420
|
var fullOutput = '';
|
|
421
|
+
var tokenCount = 0;
|
|
418
422
|
|
|
419
423
|
function pump() {
|
|
420
424
|
return reader.read().then(function (chunk) {
|
|
421
425
|
if (chunk.done) {
|
|
422
|
-
logMessage('
|
|
426
|
+
logMessage('info', 'Stream complete — ' + tokenCount + ' tokens sent');
|
|
423
427
|
sendToPlugin({
|
|
424
428
|
type: 'response',
|
|
425
429
|
messageId: data.messageId,
|
|
@@ -442,7 +446,9 @@
|
|
|
442
446
|
if (parsed.error) throw new Error(parsed.error);
|
|
443
447
|
if (parsed.text) {
|
|
444
448
|
fullOutput += parsed.text;
|
|
449
|
+
tokenCount++;
|
|
445
450
|
sendToPlugin({ type: 'stream_token', messageId: data.messageId, text: parsed.text });
|
|
451
|
+
if (tokenCount <= 3) logMessage('info', 'stream_token #' + tokenCount + ': "' + parsed.text.substring(0, 20) + '"');
|
|
446
452
|
}
|
|
447
453
|
if (parsed.done) {
|
|
448
454
|
if (parsed.output) fullOutput = parsed.output;
|