{"version":3,"file":"ThreadView.cjs","names":["useT","unsubscribeThread","useStore","streamedSessions","threadStoreKey","Transcript","sessionStoreFor","LoadingState","EmptyState"],"sources":["../../../../src/web/features/session/ThreadView.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 { useEffect } from 'react';\n\nimport { sessionStoreFor, streamedSessions } from '../../stores/sessionStore';\nimport { subscribeThread, threadStoreKey, unsubscribeThread } from '../../stores/threadStore';\nimport { Transcript } from './Timeline';\n\nconst THREAD_TEST_ID = 'thread-timeline';\n\n/**\n * A thread of the focused session, such as a subagent run's own journal, on\n * the same transcript as the session itself and followed only while shown.\n * The parent session id goes down with it so tool cards resolve renderers\n * and slot props exactly as the main thread does.\n *\n * `options` is how a caller that is not a whole tab asks for less: a grid card\n * shows the newest few entries at card scale.\n */\nexport function ThreadView({\n  sessionId,\n  threadId,\n  options,\n}: {\n  sessionId: string;\n  threadId: string;\n  options?: ThreadViewOptions;\n}) {\n  const t = useT();\n  useEffect(() => {\n    subscribeThread(sessionId, threadId);\n    return () => unsubscribeThread(sessionId, threadId);\n  }, [sessionId, threadId]);\n  // The thread's fold is empty until its first transcript page is read, which is not an empty journal.\n  const loaded = useStore(streamedSessions, (state) => state.has(threadStoreKey(sessionId, threadId)));\n\n  return (\n    <Transcript\n      store={sessionStoreFor(threadStoreKey(sessionId, threadId))}\n      sessionId={sessionId}\n      historyKey={threadStoreKey(sessionId, threadId)}\n      testId={THREAD_TEST_ID}\n      limit={options?.limit}\n      compact={options?.compact}\n      childThread\n      empty={\n        !loaded ? (\n          <LoadingState\n            data-testid=\"thread-loading\"\n            label={t('webDashboard.session.loadingMessages', 'Loading messages')}\n          />\n        ) : (\n          <EmptyState\n            data-testid=\"thread-empty\"\n            title={t('webDashboard.session.noMessagesYetLower', 'no messages yet')}\n            description={t(\n              'webDashboard.session.threadEmptyDescription',\n              \"the agent's journal shows here as soon as it starts writing.\",\n            )}\n          />\n        )\n      }\n    />\n  );\n}\n"],"mappings":";;;;;;;;;AASA,MAAM,iBAAiB;;;;;;;;;;AAWvB,SAAgB,WAAW,EACzB,WACA,UACA,WAKC;CACD,MAAM,KAAA,GAAIA,uBAAAA,KAAAA,CAAK;CACf,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,oBAAA,gBAAgB,WAAW,QAAQ;EACnC,aAAaC,oBAAAA,kBAAkB,WAAW,QAAQ;CACpD,GAAG,CAAC,WAAW,QAAQ,CAAC;CAExB,MAAM,UAAA,GAASC,sBAAAA,SAAAA,CAASC,qBAAAA,mBAAmB,UAAU,MAAM,IAAIC,oBAAAA,eAAe,WAAW,QAAQ,CAAC,CAAC;CAEnG,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,YAAD;EACE,OAAOC,qBAAAA,gBAAgBF,oBAAAA,eAAe,WAAW,QAAQ,CAAC;EAC/C;EACX,YAAYA,oBAAAA,eAAe,WAAW,QAAQ;EAC9C,QAAQ;EACR,OAAO,SAAS;EAChB,SAAS,SAAS;EAClB,aAAA;EACA,OACE,CAAC,SACC,iBAAA,GAAA,kBAAA,IAAA,CAACG,6BAAAA,cAAD;GACE,eAAY;GACZ,OAAO,EAAE,wCAAwC,kBAAkB;EACpE,CAAA,IAED,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,YAAD;GACE,eAAY;GACZ,OAAO,EAAE,2CAA2C,iBAAiB;GACrE,aAAa,EACX,+CACA,8DACF;EACD,CAAA;CAGN,CAAA;AAEL"}