Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions src/workbench/extensions/agent/AgentPanelRoot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ import type {
TurnOrigin,
WorkflowTurnContext
} from './composables/agent/useAgentSession'
import { useAgentTabSignals } from './composables/agent/useAgentTabSignals'
import type { CoachStep } from './composables/agent/useOnboarding'
import { useBillingIdentity } from './composables/useBillingIdentity'
import { useAgentConsent } from './composables/agent/useAgentConsent'
Expand All @@ -151,7 +152,6 @@ import {
describeAgentRequestFailure
} from './services/agent/agentRequestFailure'
import { createAgentRestClient } from './services/agent/agentRestClient'
import { setAgentTabTitlePrefix } from './services/agent/agentTabTitlePrefix'
import { useAgentChatHistoryRefresh } from './composables/agent/useAgentChatHistoryRefresh'
import { useAgentWorkflowChatFollow } from './composables/agent/useAgentWorkflowChatFollow'
import {
Expand Down Expand Up @@ -1360,18 +1360,7 @@ async function restoreThreadWorkflow(
}

conversationStore.setTurnTabResolver(turnTab)
conversationStore.onTurnCompleted((path) => tabActivity.markModified(path))
watch(
() => conversationStore.turnTabs,
(tabs) => tabActivity.setAgentTurnTabs(tabs),
{ immediate: true, flush: 'sync' }
)
watch(
() =>
conversationStore.awaitingApproval ? t('g.agentInputNeededShort') : null,
setAgentTabTitlePrefix,
{ immediate: true, flush: 'sync' }
)
const { clearTurnSignals } = useAgentTabSignals()

const boundCanvasNodeCount = ref(0)
function readBoundCanvasNodeCount(): void {
Expand Down Expand Up @@ -1768,8 +1757,7 @@ onBeforeUnmount(() => {
++activeTabGeneration
},
clearAgentTurnTabs: () => {
tabActivity.setAgentTurnTabs([])
setAgentTabTitlePrefix(null)
clearTurnSignals()
},
resetTurnTabResolver: () => {
conversationStore.setTurnTabResolver(() => ({ status: 'unknown' }))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { watch } from 'vue'
import { useI18n } from 'vue-i18n'

import { useWorkflowTabActivityStore } from '@/stores/workflowTabActivityStore'
import { setAgentTabTitlePrefix } from '@/workbench/extensions/agent/services/agent/agentTabTitlePrefix'
import { useAgentConversationStore } from '@/workbench/extensions/agent/stores/agent/agentConversationStore'

/** Mirrors the agent's turns onto the workflow tabs and the browser tab title. */
export function useAgentTabSignals() {
const { t } = useI18n()
const conversationStore = useAgentConversationStore()
const tabActivity = useWorkflowTabActivityStore()

conversationStore.onTurnCompleted((path) => tabActivity.markModified(path))
watch(
() => conversationStore.turnTabs,
(tabs) => tabActivity.setAgentTurnTabs(tabs),
{ immediate: true, flush: 'sync' }
)
watch(
() =>
conversationStore.awaitingApproval ? t('g.agentInputNeededShort') : null,
setAgentTabTitlePrefix,
{ immediate: true, flush: 'sync' }
)

function clearTurnSignals(): void {
tabActivity.setAgentTurnTabs([])
setAgentTabTitlePrefix(null)
}

return { clearTurnSignals }
}
Loading