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:
@@ -64,7 +64,7 @@ export async function findNearestMessageWithFieldsFromSDK(
|
||||
): Promise<StoredMessage | null> {
|
||||
try {
|
||||
const response = await client.session.messages({ path: { id: sessionID } })
|
||||
const messages = (response.data ?? []) as SDKMessage[]
|
||||
const messages = ((response.data ?? response) as unknown as SDKMessage[]) ?? []
|
||||
|
||||
for (let i = messages.length - 1; i >= 0; i--) {
|
||||
const stored = convertSDKMessageToStoredMessage(messages[i])
|
||||
@@ -97,7 +97,7 @@ export async function findFirstMessageWithAgentFromSDK(
|
||||
): Promise<string | null> {
|
||||
try {
|
||||
const response = await client.session.messages({ path: { id: sessionID } })
|
||||
const messages = (response.data ?? []) as SDKMessage[]
|
||||
const messages = ((response.data ?? response) as unknown as SDKMessage[]) ?? []
|
||||
|
||||
for (const msg of messages) {
|
||||
const stored = convertSDKMessageToStoredMessage(msg)
|
||||
|
||||
Reference in New Issue
Block a user