{"version":3,"file":"SessionTranscriptView.mjs","names":[],"sources":["../../../../src/web/features/session/SessionTranscriptView.tsx"],"sourcesContent":["import { type ThreadViewOptions, useT } from '@agimon-ai/po-core/web';\nimport { EmptyState, LoadingState } from '@agimon-ai/po-web-components';\nimport { useStore } from '@tanstack/react-store';\nimport { type ComponentType, useEffect } from 'react';\n\nimport { sessionsStore } from '../../stores/sessionsStore';\nimport { sessionStoreFor, streamedSessions } from '../../stores/sessionStore';\nimport { Transcript, type TranscriptTurnRenderProps } from './Timeline';\n\nconst SESSION_TRANSCRIPT_TEST_ID = 'session-transcript';\n\n/**\n * Another session's conversation, drawn inside a plugin panel of the focused one.\n *\n * It reads the same store the session's own tab reads. `watch` is what fills\n * that store while this is mounted without focusing the session; the app owns\n * it because only the app can open a protocol connection.\n */\nexport function SessionTranscriptView({\n  sessionId,\n  options,\n  watch,\n  renderTurn,\n  showThinking,\n}: {\n  sessionId: string;\n  options?: ThreadViewOptions;\n  watch: (sessionId: string) => () => void;\n  /** A template's own turn layout, as Timeline takes it. */\n  renderTurn?: ComponentType<TranscriptTurnRenderProps>;\n  showThinking?: boolean;\n}) {\n  const t = useT();\n  const focusedId = useStore(sessionsStore, (state) => state.activeId);\n  const dormant = useStore(sessionsStore, (state) => state.byId[sessionId]?.summary.dormant === true);\n  useEffect(() => (focusedId !== sessionId ? watch(sessionId) : undefined), [sessionId, focusedId, dormant, watch]);\n  // Until the first history page lands an empty store means not read yet, not an empty conversation.\n  const loaded = useStore(streamedSessions, (state) => state.has(sessionId));\n\n  return (\n    <Transcript\n      store={sessionStoreFor(sessionId)}\n      sessionId={sessionId}\n      historyKey={sessionId}\n      testId={SESSION_TRANSCRIPT_TEST_ID}\n      limit={options?.limit}\n      compact={options?.compact}\n      renderTurn={renderTurn}\n      showThinking={showThinking}\n      empty={\n        !loaded ? (\n          <LoadingState\n            data-testid=\"session-transcript-loading\"\n            label={t('webDashboard.session.loadingConversation', 'Loading conversation')}\n          />\n        ) : (\n          <EmptyState\n            data-testid=\"session-transcript-empty\"\n            title={t('webDashboard.session.noMessagesYetLower', 'no messages yet')}\n            description={t(\n              'webDashboard.session.transcriptEmptyDescription',\n              \"the session's conversation shows here as soon as its agent starts.\",\n            )}\n          />\n        )\n      }\n    />\n  );\n}\n"],"mappings":";;;;;;;;;AASA,MAAM,6BAA6B;;;;;;;;AASnC,SAAgB,sBAAsB,EACpC,WACA,SACA,OACA,YACA,gBAQC;CACD,MAAM,IAAI,KAAK;CACf,MAAM,YAAY,SAAS,gBAAgB,UAAU,MAAM,QAAQ;CACnE,MAAM,UAAU,SAAS,gBAAgB,UAAU,MAAM,KAAK,UAAU,EAAE,QAAQ,YAAY,IAAI;CAClG,gBAAiB,cAAc,YAAY,MAAM,SAAS,IAAI,KAAA,GAAY;EAAC;EAAW;EAAW;EAAS;CAAK,CAAC;CAEhH,MAAM,SAAS,SAAS,mBAAmB,UAAU,MAAM,IAAI,SAAS,CAAC;CAEzE,OACE,oBAAC,YAAD;EACE,OAAO,gBAAgB,SAAS;EACrB;EACX,YAAY;EACZ,QAAQ;EACR,OAAO,SAAS;EAChB,SAAS,SAAS;EACN;EACE;EACd,OACE,CAAC,SACC,oBAAC,cAAD;GACE,eAAY;GACZ,OAAO,EAAE,4CAA4C,sBAAsB;EAC5E,CAAA,IAED,oBAAC,YAAD;GACE,eAAY;GACZ,OAAO,EAAE,2CAA2C,iBAAiB;GACrE,aAAa,EACX,mDACA,oEACF;EACD,CAAA;CAGN,CAAA;AAEL"}