fix: resolve chat prompt read-only state for subagent sessions

Allows prompting subagent sessions without needing the parent record
Keeps subagents read-only when prompting is disabled
Covers root and subagent cases with unit tests
This commit is contained in:
Bohdan Triapitsyn
2026-07-28 02:50:02 +03:00
parent 3fa0c5be57
commit 5787ea5d49
3 changed files with 47 additions and 1 deletions
@@ -0,0 +1,13 @@
import type { Session } from '@opencode-ai/sdk/v2';
export const resolveChatPromptReadOnly = (
session: Session | null | undefined,
allowPromptingSubagentSessions: boolean,
readOnly: boolean,
): boolean => {
if (session?.parentID) {
return !allowPromptingSubagentSessions;
}
return readOnly;
};