refactor(sdk): narrow response fallbacks

Replace unsafe unknown-array assertions with generic fallback types and explicit todo status narrowing.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-05-15 16:31:13 +09:00
parent 4785767a0c
commit d92e78c956
3 changed files with 19 additions and 15 deletions
+2 -2
View File
@@ -189,8 +189,8 @@ export function createReadImageResizerHook(_ctx: PluginInput) {
}
}
if (attachmentsToRemove.length > 0) {
const rawAttachments = outputRecord.attachments as unknown[]
if (attachmentsToRemove.length > 0 && Array.isArray(outputRecord.attachments)) {
const rawAttachments = outputRecord.attachments
for (const toRemove of attachmentsToRemove) {
const removeIndex = rawAttachments.indexOf(toRemove)
if (removeIndex !== -1) {
@@ -62,7 +62,7 @@ export async function readMessagesFromSDK(
): Promise<StoredMessageMeta[]> {
try {
const response = await client.session.messages({ path: { id: sessionID } })
const data = normalizeSDKResponse(response, [] as unknown[], {
const data = normalizeSDKResponse<unknown[]>(response, [], {
preferResponseOnMissingData: true,
})
if (!Array.isArray(data)) return []