feat(athena): council member continuation enforcer, tool allowlist, and prompt fixes

- Add council-continuation-enforcer to nudge council members until they
  output COUNCIL_MEMBER_RESPONSE, replacing the hacky post-compaction hack
- Add background_wait + background_cancel to council member tool allowlist
  so members can properly manage their explore agents before responding
- Update COUNCIL_DELEGATION_ADDENDUM prompt to instruct members to cancel
  pending tasks and wait for explore results before final response
- Fix council_finalize path resolution to use project directory
- Remove post-compaction-continuation.ts and recentlyCompactedSessions hack
- Add council-response-checker for detecting response tag in session messages
This commit is contained in:
ismeth
2026-02-28 00:50:23 +01:00
committed by YeonGyu-Kim
parent 684b746ee7
commit 2b70130c08
14 changed files with 817 additions and 115 deletions
@@ -0,0 +1,42 @@
import type { PluginInput } from "@opencode-ai/plugin"
import { log, normalizeSDKResponse } from "../../shared"
type OpencodeClient = PluginInput["client"]
const COUNCIL_RESPONSE_TAG = "</COUNCIL_MEMBER_RESPONSE>"
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 },
)
for (let i = messages.length - 1; i >= 0; i--) {
const msg = messages[i]
if (msg.info?.role !== "assistant") continue
const parts = msg.parts ?? []
for (const part of parts) {
if (part.type === "text" && part.text?.includes(COUNCIL_RESPONSE_TAG)) {
return true
}
}
}
return false
} catch (error) {
log("[council-response-checker] Error checking session for response tag:", {
sessionID,
error: String(error),
})
return false
}
}