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
14 lines
329 B
TypeScript
14 lines
329 B
TypeScript
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;
|
|
};
|