diff --git a/changelog.md b/changelog.md index 463b089..d207dc2 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,13 @@ # Changelog +## 2026-01-20 - 1.5.3 - fix(driveragent) +prefix thinking tokens with [THINKING] when forwarding streaming chunks to onToken + +- Wraps chunk.thinking with '[THINKING] ' before calling onToken to mark thinking tokens +- Forwards chunk.content unchanged +- Change applied in ts/smartagent.classes.driveragent.ts for both initial and subsequent assistant streaming responses +- No API signature changes; only the token payloads sent to onToken are altered + ## 2026-01-20 - 1.5.2 - fix() no changes in this diff; nothing to release diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 76d8ea1..dbe9ebb 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartagent', - version: '1.5.2', + version: '1.5.3', description: 'an agentic framework built on top of @push.rocks/smartai' } diff --git a/ts/smartagent.classes.driveragent.ts b/ts/smartagent.classes.driveragent.ts index eb554a9..85bbb27 100644 --- a/ts/smartagent.classes.driveragent.ts +++ b/ts/smartagent.classes.driveragent.ts @@ -491,10 +491,14 @@ Your complete output here images: images, tools: tools.length > 0 ? tools : undefined, }, - // Pass onToken callback through onChunk for streaming + // Pass onToken callback through onChunk for streaming with thinking markers this.onToken ? (chunk: any) => { - if (chunk.thinking && this.onToken) this.onToken(chunk.thinking); - if (chunk.content && this.onToken) this.onToken(chunk.content); + if (chunk.thinking && this.onToken) { + this.onToken(`[THINKING] ${chunk.thinking}`); + } + if (chunk.content && this.onToken) { + this.onToken(chunk.content); + } } : undefined ); @@ -574,10 +578,14 @@ Your complete output here messageHistory: historyForChat, tools: tools.length > 0 ? tools : undefined, }, - // Pass onToken callback through onChunk for streaming + // Pass onToken callback through onChunk for streaming with thinking markers this.onToken ? (chunk: any) => { - if (chunk.thinking && this.onToken) this.onToken(chunk.thinking); - if (chunk.content && this.onToken) this.onToken(chunk.content); + if (chunk.thinking && this.onToken) { + this.onToken(`[THINKING] ${chunk.thinking}`); + } + if (chunk.content && this.onToken) { + this.onToken(chunk.content); + } } : undefined );