@vercel/dream 0.3.1 → 0.3.3
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/dist/dream.js +25 -0
- package/package.json +1 -1
package/dist/dream.js
CHANGED
|
@@ -541,9 +541,34 @@ async function runSession(client, title, systemPrompt, verbose) {
|
|
|
541
541
|
if (props.sessionID && props.sessionID !== sessionId) {
|
|
542
542
|
continue;
|
|
543
543
|
}
|
|
544
|
+
if (event.type === "message.part.delta") {
|
|
545
|
+
const { delta, field } = event.properties;
|
|
546
|
+
if (delta && field === "text") {
|
|
547
|
+
responseText += delta;
|
|
548
|
+
if (lastOutput === "tool") process.stdout.write("\n");
|
|
549
|
+
const indented = delta.replace(/\n/g, `
|
|
550
|
+
${INDENT_SESSION}`);
|
|
551
|
+
process.stdout.write(
|
|
552
|
+
lastOutput !== "text" ? `${INDENT_SESSION}${dim(indented)}` : dim(indented)
|
|
553
|
+
);
|
|
554
|
+
lastOutput = "text";
|
|
555
|
+
}
|
|
556
|
+
}
|
|
544
557
|
if (event.type === "message.part.updated") {
|
|
545
558
|
const { part } = event.properties;
|
|
546
559
|
const delta = event.properties.delta;
|
|
560
|
+
if (verbose && ![
|
|
561
|
+
"text",
|
|
562
|
+
"reasoning",
|
|
563
|
+
"tool",
|
|
564
|
+
"step-finish",
|
|
565
|
+
"step-start",
|
|
566
|
+
"patch"
|
|
567
|
+
].includes(part.type)) {
|
|
568
|
+
printSessionDim(
|
|
569
|
+
`unhandled part type: ${part.type} ${JSON.stringify(part).slice(0, 200)}`
|
|
570
|
+
);
|
|
571
|
+
}
|
|
547
572
|
if (part.type === "text" && delta) {
|
|
548
573
|
responseText += delta;
|
|
549
574
|
if (lastOutput === "tool") process.stdout.write("\n");
|