fix: address 5 SDK compatibility issues from Cubic round 8

- P1: Use compacted timestamp check instead of nonexistent truncated
  field in target-token-truncation.ts
- P1: Use defensive (response.data ?? response) pattern in
  hook-message-injector/injector.ts to match codebase convention
- P2: Filter by tool type in countTruncatedResultsFromSDK to avoid
  counting non-tool compacted parts
- P2: Treat thinking/meta-only messages as empty in both
  empty-content-recovery-sdk.ts and message-builder.ts to align
  SDK path with file-based logic
This commit is contained in:
YeonGyu-Kim
2026-02-16 15:33:39 +09:00
parent cfb8164d9a
commit 8edf6ed96f
5 changed files with 14 additions and 10 deletions
@@ -10,8 +10,10 @@ interface SDKToolPart {
id: string
type: string
tool?: string
state?: { output?: string }
truncated?: boolean
state?: {
output?: string
time?: { start?: number; end?: number; compacted?: number }
}
originalSize?: number
}
@@ -81,7 +83,7 @@ export async function truncateUntilTargetTokens(
const results: import("./tool-part-types").ToolResultInfo[] = []
for (const [key, part] of toolPartsByKey) {
if (part.type === "tool" && part.state?.output && !part.truncated && part.tool) {
if (part.type === "tool" && part.state?.output && !part.state?.time?.compacted && part.tool) {
results.push({
partPath: "",
partId: part.id,