4a7ddae53f
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
31 lines
899 B
TypeScript
31 lines
899 B
TypeScript
import type { PluginInput } from "@opencode-ai/plugin"
|
|
import { log, normalizeSDKResponse } from "../../shared"
|
|
import { hasCouncilResponseTag } from "../../tools/council-archive/council-response-extractor"
|
|
|
|
type OpencodeClient = PluginInput["client"]
|
|
|
|
export async function sessionHasCouncilResponse(
|
|
client: OpencodeClient,
|
|
sessionID: string,
|
|
): Promise<boolean> {
|
|
try {
|
|
const response = await client.session.messages({
|
|
path: { id: sessionID },
|
|
})
|
|
|
|
const messages = normalizeSDKResponse(
|
|
response,
|
|
[] as Array<{ info?: { role?: string }; parts?: Array<{ type?: string; text?: string }> }>,
|
|
{ preferResponseOnMissingData: true },
|
|
)
|
|
|
|
return hasCouncilResponseTag(messages)
|
|
} catch (error) {
|
|
log("[council-response-checker] Error checking session for response tag:", {
|
|
sessionID,
|
|
error: String(error),
|
|
})
|
|
return false
|
|
}
|
|
}
|