novaprime 1.3.4 → 1.3.5
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/agent.js +8 -5
- package/src/ui.js +1 -1
package/package.json
CHANGED
package/src/agent.js
CHANGED
|
@@ -51,7 +51,7 @@ async function streamMessage(server, key, messages) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
const blocks = [];
|
|
54
|
-
let stopReason = null, labelShown = false, buffer = '';
|
|
54
|
+
let stopReason = null, labelShown = false, buffer = '', usedModel = null;
|
|
55
55
|
const renderer = new Renderer();
|
|
56
56
|
const decoder = new TextDecoder();
|
|
57
57
|
const reader = res.body.getReader();
|
|
@@ -67,22 +67,25 @@ async function streamMessage(server, key, messages) {
|
|
|
67
67
|
if (!dataLine) continue;
|
|
68
68
|
let json; try { json = JSON.parse(dataLine.slice(5).trim()); } catch (_) { continue; }
|
|
69
69
|
|
|
70
|
-
if (json.type === '
|
|
70
|
+
if (json.type === 'message_start') {
|
|
71
|
+
usedModel = (json.message && json.message.model) || usedModel;
|
|
72
|
+
if (spinning) spinner.text = c.muted('thinking · ' + (usedModel || ''));
|
|
73
|
+
} else if (json.type === 'content_block_start') {
|
|
71
74
|
const cb = json.content_block || {};
|
|
72
75
|
blocks[json.index] = cb.type === 'tool_use'
|
|
73
76
|
? { type: 'tool_use', id: cb.id, name: cb.name, _json: '' }
|
|
74
77
|
: { type: 'text', text: '' };
|
|
75
|
-
if (cb.type === 'tool_use') ensureSpin(c.muted('
|
|
78
|
+
if (cb.type === 'tool_use') ensureSpin(c.muted('writing with ' + (usedModel || 'model') + '…'));
|
|
76
79
|
} else if (json.type === 'content_block_delta') {
|
|
77
80
|
const b = blocks[json.index]; if (!b) continue;
|
|
78
81
|
if (json.delta.type === 'text_delta') {
|
|
79
82
|
stopSpin();
|
|
80
|
-
if (!labelShown) { aiLabel(); labelShown = true; }
|
|
83
|
+
if (!labelShown) { aiLabel(usedModel); labelShown = true; }
|
|
81
84
|
b.text += json.delta.text;
|
|
82
85
|
renderer.feed(json.delta.text);
|
|
83
86
|
} else if (json.delta.type === 'input_json_delta') {
|
|
84
87
|
b._json += json.delta.partial_json;
|
|
85
|
-
ensureSpin(c.muted(
|
|
88
|
+
ensureSpin(c.muted('writing with ' + (usedModel || 'model') + '… ' + b._json.length + ' chars'));
|
|
86
89
|
}
|
|
87
90
|
} else if (json.type === 'message_delta') {
|
|
88
91
|
if (json.delta && json.delta.stop_reason) stopReason = json.delta.stop_reason;
|
package/src/ui.js
CHANGED
|
@@ -98,7 +98,7 @@ function inputBoxOpen() {
|
|
|
98
98
|
}
|
|
99
99
|
function inputBoxClose() { process.stdout.write('\n'); }
|
|
100
100
|
|
|
101
|
-
function aiLabel() { process.stdout.write('\n' + c.violet('● ') + c.violet.bold('Nova Prime') + '\n'); }
|
|
101
|
+
function aiLabel(model) { process.stdout.write('\n' + c.violet('● ') + c.violet.bold('Nova Prime') + (model ? c.dim(' · ' + model) : '') + '\n'); }
|
|
102
102
|
|
|
103
103
|
function info(msg) { console.log(c.muted(msg)); }
|
|
104
104
|
function hint(msg) { console.log(c.dim(msg)); }
|