Merge branch 'feature/stream-json-migration' into mingholy/feat/cli-sdk

This commit is contained in:
mingholy.lmh
2025-11-18 14:38:29 +08:00
14 changed files with 611 additions and 172 deletions

View File

@@ -620,6 +620,17 @@ export class SubAgentScope {
success,
error: errorMessage,
responseParts: call.response.responseParts,
/**
* Tools like todoWrite will add some extra contents to the result,
* making it unable to deserialize the `responseParts` to a JSON object.
* While `resultDisplay` is normally a string, if not we stringify it,
* so that we can deserialize it to a JSON object when needed.
*/
resultDisplay: call.response.resultDisplay
? typeof call.response.resultDisplay === 'string'
? call.response.resultDisplay
: JSON.stringify(call.response.resultDisplay)
: undefined,
durationMs: duration,
timestamp: Date.now(),
} as SubAgentToolResultEvent);