- Remove UNIFIED_MODE legacy: single service manages all 3 Discord bots - Add OWNER_AGENT_TYPE / REVIEWER_AGENT_TYPE env vars for configurable agent selection - Fix Discord channel routing: reviewer output goes through correct bot (discord/discord-review) - Fix channel name assignment: explicit names prevent agentTypeFilter collision - Remove silent output suppression system: harness-level protections replace prompt workarounds - Add reviewer approval detection: DONE marker on first line stops ping-pong - Include user's original message in reviewer prompt for context - Fix round_trip_count auto-reset on new user message - Fix session ID conflict: reviewer doesn't reuse owner's session - Fix pending progress text flush in runner on close sentinel - Promote buffered intermediate text to final result when result event has no text - Remove legacy files: .env.codex.example, .env.codex-review.example, migrate-unify.cjs - Update CLAUDE.md: server-side build deployment, unified architecture docs
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import type { StructuredAgentOutput } from './types.js';
|
|
|
|
export function stringifyLegacyAgentResult(
|
|
result: string | object | null | undefined,
|
|
): string | null {
|
|
if (result === null || result === undefined) return null;
|
|
if (typeof result === 'string') return result;
|
|
|
|
try {
|
|
return JSON.stringify(result);
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
export function getStructuredAgentOutput(output: {
|
|
output?: StructuredAgentOutput;
|
|
result?: string | object | null;
|
|
}): StructuredAgentOutput | null {
|
|
if (output.output) {
|
|
return output.output;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
export function getAgentOutputText(output: {
|
|
output?: StructuredAgentOutput;
|
|
result?: string | object | null;
|
|
}): string | null {
|
|
const structured = getStructuredAgentOutput(output);
|
|
if (structured?.visibility === 'public') {
|
|
return structured.text;
|
|
}
|
|
return stringifyLegacyAgentResult(output.result);
|
|
}
|
|
|
|
export function hasAgentOutputPayload(output: {
|
|
output?: StructuredAgentOutput;
|
|
result?: string | object | null;
|
|
}): boolean {
|
|
if (output.output) {
|
|
return true;
|
|
}
|
|
return output.result !== null && output.result !== undefined;
|
|
}
|
|
|
|
export function isSilentAgentOutput(_output: {
|
|
output?: StructuredAgentOutput;
|
|
result?: string | object | null;
|
|
}): boolean {
|
|
return false;
|
|
}
|