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:
@@ -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 []
|
||||
|
||||
Reference in New Issue
Block a user