Line data Source code
1 : import { inject, ref } from 'vue'
2 : import type { InjectionKey, Ref } from 'vue'
3 :
4 : import type { AgentErrorContext } from '@/platform/workflowErrors/agentErrorContext'
5 :
6 : export interface AskAgentPort {
7 : canAskAgent: Readonly<Ref<boolean>>
8 : askAgentAboutIssues(context: AgentErrorContext): Promise<void>
9 : }
10 :
11 2355 : export const AskAgentPortKey: InjectionKey<AskAgentPort> =
12 : Symbol('askAgentPort')
13 :
14 2355 : const NO_AGENT: AskAgentPort = {
15 : canAskAgent: ref(false),
16 : askAgentAboutIssues: () => Promise.resolve()
17 : }
18 :
19 2187 : export function useAskAgentPort(): AskAgentPort {
20 2187 : return inject(AskAgentPortKey, NO_AGENT)
21 : }
|