@agimon-ai/po-web-dashboard 0.0.0-alpha.2 → 0.0.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (366) hide show
  1. package/LICENSE +149 -29
  2. package/dist/core.cjs +13 -0
  3. package/dist/core.d.mts +8 -7
  4. package/dist/core.mjs +7 -6
  5. package/dist/index.cjs +17 -1
  6. package/dist/index.d.mts +12 -12
  7. package/dist/index.mjs +10 -10
  8. package/dist/types/hub.cjs +9 -100
  9. package/dist/types/hub.cjs.map +1 -1
  10. package/dist/types/hub.d.mts +12 -110
  11. package/dist/types/hub.d.mts.map +1 -1
  12. package/dist/types/hub.mjs +9 -79
  13. package/dist/types/hub.mjs.map +1 -1
  14. package/dist/types/notification.cjs +4 -4
  15. package/dist/types/notification.cjs.map +1 -1
  16. package/dist/types/notification.d.mts +5 -5
  17. package/dist/types/notification.d.mts.map +1 -1
  18. package/dist/types/notification.mjs +5 -5
  19. package/dist/types/notification.mjs.map +1 -1
  20. package/dist/types/settings.cjs.map +1 -1
  21. package/dist/types/settings.d.mts +1 -1
  22. package/dist/types/settings.mjs.map +1 -1
  23. package/dist/types.cjs +2 -23
  24. package/dist/types.d.mts +3 -3
  25. package/dist/types.mjs +3 -3
  26. package/dist/views.cjs +1 -0
  27. package/dist/views.d.mts +2 -2
  28. package/dist/views.mjs +2 -2
  29. package/dist/web/components/SessionMcp.cjs +17 -17
  30. package/dist/web/components/SessionMcp.cjs.map +1 -1
  31. package/dist/web/components/SessionMcp.mjs +17 -17
  32. package/dist/web/components/SessionMcp.mjs.map +1 -1
  33. package/dist/web/components/Story.fixture.cjs +4 -3
  34. package/dist/web/components/Story.fixture.cjs.map +1 -1
  35. package/dist/web/components/Story.fixture.d.mts.map +1 -1
  36. package/dist/web/components/Story.fixture.mjs +4 -3
  37. package/dist/web/components/Story.fixture.mjs.map +1 -1
  38. package/dist/web/components/Template.fixture.cjs +1 -1
  39. package/dist/web/components/Template.fixture.cjs.map +1 -1
  40. package/dist/web/components/Template.fixture.mjs +1 -1
  41. package/dist/web/components/Template.fixture.mjs.map +1 -1
  42. package/dist/web/components/ToolRendererBoundary.d.mts +1 -0
  43. package/dist/web/features/activity/ActivityDock.cjs +68 -47
  44. package/dist/web/features/activity/ActivityDock.cjs.map +1 -1
  45. package/dist/web/features/activity/ActivityDock.d.mts +2 -1
  46. package/dist/web/features/activity/ActivityDock.d.mts.map +1 -1
  47. package/dist/web/features/activity/ActivityDock.mjs +70 -49
  48. package/dist/web/features/activity/ActivityDock.mjs.map +1 -1
  49. package/dist/web/features/activity/ContextItemDialog.cjs +17 -17
  50. package/dist/web/features/activity/ContextItemDialog.cjs.map +1 -1
  51. package/dist/web/features/activity/ContextItemDialog.d.mts +1 -0
  52. package/dist/web/features/activity/ContextItemDialog.mjs +17 -17
  53. package/dist/web/features/activity/ContextItemDialog.mjs.map +1 -1
  54. package/dist/web/features/activity/ContextPanel.cjs +184 -148
  55. package/dist/web/features/activity/ContextPanel.cjs.map +1 -1
  56. package/dist/web/features/activity/ContextPanel.d.mts +23 -0
  57. package/dist/web/features/activity/ContextPanel.d.mts.map +1 -1
  58. package/dist/web/features/activity/ContextPanel.mjs +186 -151
  59. package/dist/web/features/activity/ContextPanel.mjs.map +1 -1
  60. package/dist/web/features/activity/DockTabs.cjs +1 -1
  61. package/dist/web/features/activity/DockTabs.cjs.map +1 -1
  62. package/dist/web/features/activity/DockTabs.mjs +1 -1
  63. package/dist/web/features/activity/DockTabs.mjs.map +1 -1
  64. package/dist/web/features/connection/RefusedCard.cjs +9 -9
  65. package/dist/web/features/connection/RefusedCard.cjs.map +1 -1
  66. package/dist/web/features/connection/RefusedCard.mjs +9 -9
  67. package/dist/web/features/connection/RefusedCard.mjs.map +1 -1
  68. package/dist/web/features/dialogs/DialogOverlay.cjs +9 -9
  69. package/dist/web/features/dialogs/DialogOverlay.cjs.map +1 -1
  70. package/dist/web/features/dialogs/DialogOverlay.mjs +9 -9
  71. package/dist/web/features/dialogs/DialogOverlay.mjs.map +1 -1
  72. package/dist/web/features/leader/CommandPalette.cjs +23 -23
  73. package/dist/web/features/leader/CommandPalette.cjs.map +1 -1
  74. package/dist/web/features/leader/CommandPalette.mjs +23 -23
  75. package/dist/web/features/leader/CommandPalette.mjs.map +1 -1
  76. package/dist/web/features/remote/DevProxyTargets.cjs +6 -6
  77. package/dist/web/features/remote/DevProxyTargets.cjs.map +1 -1
  78. package/dist/web/features/remote/DevProxyTargets.mjs +6 -6
  79. package/dist/web/features/remote/DevProxyTargets.mjs.map +1 -1
  80. package/dist/web/features/remote/HandoverProgress.cjs +2 -2
  81. package/dist/web/features/remote/HandoverProgress.cjs.map +1 -1
  82. package/dist/web/features/remote/HandoverProgress.mjs +2 -2
  83. package/dist/web/features/remote/HandoverProgress.mjs.map +1 -1
  84. package/dist/web/features/remote/PairedDeviceList.cjs +3 -3
  85. package/dist/web/features/remote/PairedDeviceList.cjs.map +1 -1
  86. package/dist/web/features/remote/PairedDeviceList.mjs +3 -3
  87. package/dist/web/features/remote/PairedDeviceList.mjs.map +1 -1
  88. package/dist/web/features/remote/PairingApprovalDialog.cjs +3 -3
  89. package/dist/web/features/remote/PairingApprovalDialog.cjs.map +1 -1
  90. package/dist/web/features/remote/PairingApprovalDialog.mjs +3 -3
  91. package/dist/web/features/remote/PairingApprovalDialog.mjs.map +1 -1
  92. package/dist/web/features/remote/RemoteAccessDialog.cjs +3 -3
  93. package/dist/web/features/remote/RemoteAccessDialog.cjs.map +1 -1
  94. package/dist/web/features/remote/RemoteAccessDialog.mjs +3 -3
  95. package/dist/web/features/remote/RemoteAccessDialog.mjs.map +1 -1
  96. package/dist/web/features/remote/RemoteAccessOptions.cjs +11 -11
  97. package/dist/web/features/remote/RemoteAccessOptions.cjs.map +1 -1
  98. package/dist/web/features/remote/RemoteAccessOptions.mjs +11 -11
  99. package/dist/web/features/remote/RemoteAccessOptions.mjs.map +1 -1
  100. package/dist/web/features/remote/RemoteAccessPairing.cjs +8 -8
  101. package/dist/web/features/remote/RemoteAccessPairing.cjs.map +1 -1
  102. package/dist/web/features/remote/RemoteAccessPairing.mjs +8 -8
  103. package/dist/web/features/remote/RemoteAccessPairing.mjs.map +1 -1
  104. package/dist/web/features/remote/SandboxWorkspaces.cjs +3 -3
  105. package/dist/web/features/remote/SandboxWorkspaces.cjs.map +1 -1
  106. package/dist/web/features/remote/SandboxWorkspaces.mjs +3 -3
  107. package/dist/web/features/remote/SandboxWorkspaces.mjs.map +1 -1
  108. package/dist/web/features/remote/TrustedDeviceList.cjs +4 -4
  109. package/dist/web/features/remote/TrustedDeviceList.cjs.map +1 -1
  110. package/dist/web/features/remote/TrustedDeviceList.mjs +4 -4
  111. package/dist/web/features/remote/TrustedDeviceList.mjs.map +1 -1
  112. package/dist/web/features/selection/SelectionBar.cjs +40 -37
  113. package/dist/web/features/selection/SelectionBar.cjs.map +1 -1
  114. package/dist/web/features/selection/SelectionBar.d.mts.map +1 -1
  115. package/dist/web/features/selection/SelectionBar.mjs +41 -38
  116. package/dist/web/features/selection/SelectionBar.mjs.map +1 -1
  117. package/dist/web/features/session/AgentLockPanel.cjs +3 -3
  118. package/dist/web/features/session/AgentLockPanel.cjs.map +1 -1
  119. package/dist/web/features/session/AgentLockPanel.mjs +3 -3
  120. package/dist/web/features/session/AgentLockPanel.mjs.map +1 -1
  121. package/dist/web/features/session/Composer.cjs +11 -11
  122. package/dist/web/features/session/Composer.cjs.map +1 -1
  123. package/dist/web/features/session/Composer.mjs +11 -11
  124. package/dist/web/features/session/Composer.mjs.map +1 -1
  125. package/dist/web/features/session/DormantPanel.cjs +4 -4
  126. package/dist/web/features/session/DormantPanel.cjs.map +1 -1
  127. package/dist/web/features/session/DormantPanel.mjs +4 -4
  128. package/dist/web/features/session/DormantPanel.mjs.map +1 -1
  129. package/dist/web/features/session/MentionPreviews.cjs +10 -10
  130. package/dist/web/features/session/MentionPreviews.cjs.map +1 -1
  131. package/dist/web/features/session/MentionPreviews.mjs +10 -10
  132. package/dist/web/features/session/MentionPreviews.mjs.map +1 -1
  133. package/dist/web/features/session/QueueSheet.cjs +28 -35
  134. package/dist/web/features/session/QueueSheet.cjs.map +1 -1
  135. package/dist/web/features/session/QueueSheet.mjs +28 -35
  136. package/dist/web/features/session/QueueSheet.mjs.map +1 -1
  137. package/dist/web/features/session/SessionActivity.cjs +8 -4
  138. package/dist/web/features/session/SessionActivity.cjs.map +1 -1
  139. package/dist/web/features/session/SessionActivity.d.mts +1 -1
  140. package/dist/web/features/session/SessionActivity.d.mts.map +1 -1
  141. package/dist/web/features/session/SessionActivity.mjs +8 -4
  142. package/dist/web/features/session/SessionActivity.mjs.map +1 -1
  143. package/dist/web/features/session/ThreadView.cjs +1 -0
  144. package/dist/web/features/session/ThreadView.cjs.map +1 -1
  145. package/dist/web/features/session/ThreadView.mjs +1 -0
  146. package/dist/web/features/session/ThreadView.mjs.map +1 -1
  147. package/dist/web/features/session/Timeline.cjs +173 -69
  148. package/dist/web/features/session/Timeline.cjs.map +1 -1
  149. package/dist/web/features/session/Timeline.d.mts +3 -1
  150. package/dist/web/features/session/Timeline.d.mts.map +1 -1
  151. package/dist/web/features/session/Timeline.mjs +174 -70
  152. package/dist/web/features/session/Timeline.mjs.map +1 -1
  153. package/dist/web/features/session/ToolCard.cjs +6 -6
  154. package/dist/web/features/session/ToolCard.cjs.map +1 -1
  155. package/dist/web/features/session/ToolCard.mjs +6 -6
  156. package/dist/web/features/session/ToolCard.mjs.map +1 -1
  157. package/dist/web/features/sessions/NewSessionDialog.cjs +3 -3
  158. package/dist/web/features/sessions/NewSessionDialog.cjs.map +1 -1
  159. package/dist/web/features/sessions/NewSessionDialog.mjs +3 -3
  160. package/dist/web/features/sessions/NewSessionDialog.mjs.map +1 -1
  161. package/dist/web/features/sessions/ResumeSessionDialog.cjs +11 -8
  162. package/dist/web/features/sessions/ResumeSessionDialog.cjs.map +1 -1
  163. package/dist/web/features/sessions/ResumeSessionDialog.d.mts +1 -0
  164. package/dist/web/features/sessions/ResumeSessionDialog.mjs +11 -8
  165. package/dist/web/features/sessions/ResumeSessionDialog.mjs.map +1 -1
  166. package/dist/web/features/sessions/WelcomePanel.cjs +29 -15
  167. package/dist/web/features/sessions/WelcomePanel.cjs.map +1 -1
  168. package/dist/web/features/sessions/WelcomePanel.d.mts +3 -0
  169. package/dist/web/features/sessions/WelcomePanel.d.mts.map +1 -1
  170. package/dist/web/features/sessions/WelcomePanel.mjs +29 -15
  171. package/dist/web/features/sessions/WelcomePanel.mjs.map +1 -1
  172. package/dist/web/features/sessions/useSessionRail.cjs +14 -16
  173. package/dist/web/features/sessions/useSessionRail.cjs.map +1 -1
  174. package/dist/web/features/sessions/useSessionRail.d.mts.map +1 -1
  175. package/dist/web/features/sessions/useSessionRail.mjs +16 -18
  176. package/dist/web/features/sessions/useSessionRail.mjs.map +1 -1
  177. package/dist/web/features/settings/AppearanceSettings.cjs +3 -3
  178. package/dist/web/features/settings/AppearanceSettings.cjs.map +1 -1
  179. package/dist/web/features/settings/AppearanceSettings.mjs +3 -3
  180. package/dist/web/features/settings/AppearanceSettings.mjs.map +1 -1
  181. package/dist/web/features/settings/ContributedSettings.cjs +9 -9
  182. package/dist/web/features/settings/ContributedSettings.cjs.map +1 -1
  183. package/dist/web/features/settings/ContributedSettings.d.mts +1 -0
  184. package/dist/web/features/settings/ContributedSettings.mjs +9 -9
  185. package/dist/web/features/settings/ContributedSettings.mjs.map +1 -1
  186. package/dist/web/features/settings/ImageSettings.cjs +2 -2
  187. package/dist/web/features/settings/ImageSettings.cjs.map +1 -1
  188. package/dist/web/features/settings/ImageSettings.d.mts +1 -1
  189. package/dist/web/features/settings/ImageSettings.mjs +2 -2
  190. package/dist/web/features/settings/ImageSettings.mjs.map +1 -1
  191. package/dist/web/features/settings/LoginFlowDialog.cjs +18 -18
  192. package/dist/web/features/settings/LoginFlowDialog.cjs.map +1 -1
  193. package/dist/web/features/settings/LoginFlowDialog.mjs +18 -18
  194. package/dist/web/features/settings/LoginFlowDialog.mjs.map +1 -1
  195. package/dist/web/features/settings/PluginSettings.cjs +1 -1
  196. package/dist/web/features/settings/PluginSettings.cjs.map +1 -1
  197. package/dist/web/features/settings/PluginSettings.mjs +1 -1
  198. package/dist/web/features/settings/PluginSettings.mjs.map +1 -1
  199. package/dist/web/features/settings/ProviderSettings.cjs +18 -18
  200. package/dist/web/features/settings/ProviderSettings.cjs.map +1 -1
  201. package/dist/web/features/settings/ProviderSettings.mjs +18 -18
  202. package/dist/web/features/settings/ProviderSettings.mjs.map +1 -1
  203. package/dist/web/features/settings/RepositorySettings.cjs +6 -6
  204. package/dist/web/features/settings/RepositorySettings.cjs.map +1 -1
  205. package/dist/web/features/settings/RepositorySettings.mjs +6 -6
  206. package/dist/web/features/settings/RepositorySettings.mjs.map +1 -1
  207. package/dist/web/features/settings/RepositoryWorkspace.cjs +3 -3
  208. package/dist/web/features/settings/RepositoryWorkspace.cjs.map +1 -1
  209. package/dist/web/features/settings/RepositoryWorkspace.mjs +3 -3
  210. package/dist/web/features/settings/RepositoryWorkspace.mjs.map +1 -1
  211. package/dist/web/features/settings/SessionMcpSettings.cjs +14 -14
  212. package/dist/web/features/settings/SessionMcpSettings.cjs.map +1 -1
  213. package/dist/web/features/settings/SessionMcpSettings.mjs +14 -14
  214. package/dist/web/features/settings/SessionMcpSettings.mjs.map +1 -1
  215. package/dist/web/features/settings/SettingsMenu.cjs +8 -8
  216. package/dist/web/features/settings/SettingsMenu.cjs.map +1 -1
  217. package/dist/web/features/settings/SettingsMenu.mjs +8 -8
  218. package/dist/web/features/settings/SettingsMenu.mjs.map +1 -1
  219. package/dist/web/features/settings/SettingsPanelHost.d.mts +1 -0
  220. package/dist/web/features/settings/TemplateSettings.cjs +8 -8
  221. package/dist/web/features/settings/TemplateSettings.cjs.map +1 -1
  222. package/dist/web/features/settings/TemplateSettings.mjs +8 -8
  223. package/dist/web/features/settings/TemplateSettings.mjs.map +1 -1
  224. package/dist/web/features/settings/TunnelSettings.cjs +6 -6
  225. package/dist/web/features/settings/TunnelSettings.cjs.map +1 -1
  226. package/dist/web/features/settings/TunnelSettings.mjs +6 -6
  227. package/dist/web/features/settings/TunnelSettings.mjs.map +1 -1
  228. package/dist/web/features/status/TopBar.cjs +6 -6
  229. package/dist/web/features/status/TopBar.cjs.map +1 -1
  230. package/dist/web/features/status/TopBar.mjs +6 -6
  231. package/dist/web/features/status/TopBar.mjs.map +1 -1
  232. package/dist/web/lib/browserNotifications.cjs.map +1 -1
  233. package/dist/web/lib/browserNotifications.d.mts +2 -2
  234. package/dist/web/lib/browserNotifications.d.mts.map +1 -1
  235. package/dist/web/lib/browserNotifications.mjs.map +1 -1
  236. package/dist/web/lib/browserTelemetry.cjs.map +1 -1
  237. package/dist/web/lib/browserTelemetry.d.mts +2 -1
  238. package/dist/web/lib/browserTelemetry.d.mts.map +1 -1
  239. package/dist/web/lib/browserTelemetry.mjs.map +1 -1
  240. package/dist/web/lib/commands.d.mts +1 -0
  241. package/dist/web/lib/composerSubmissions.d.mts +1 -0
  242. package/dist/web/lib/composition.cjs +21 -5
  243. package/dist/web/lib/composition.cjs.map +1 -1
  244. package/dist/web/lib/composition.d.mts +15 -0
  245. package/dist/web/lib/composition.d.mts.map +1 -1
  246. package/dist/web/lib/composition.mjs +21 -6
  247. package/dist/web/lib/composition.mjs.map +1 -1
  248. package/dist/web/lib/contextComposition.cjs +1 -1
  249. package/dist/web/lib/contextComposition.cjs.map +1 -1
  250. package/dist/web/lib/contextComposition.mjs +1 -1
  251. package/dist/web/lib/contextComposition.mjs.map +1 -1
  252. package/dist/web/lib/dashboardRoute.d.mts +1 -0
  253. package/dist/web/lib/hubApi.cjs +62 -1
  254. package/dist/web/lib/hubApi.cjs.map +1 -1
  255. package/dist/web/lib/hubApi.d.mts +19 -0
  256. package/dist/web/lib/hubApi.d.mts.map +1 -1
  257. package/dist/web/lib/hubApi.mjs +59 -3
  258. package/dist/web/lib/hubApi.mjs.map +1 -1
  259. package/dist/web/lib/modelContextAdapter.d.mts +1 -0
  260. package/dist/web/lib/piTransport.cjs +34 -53
  261. package/dist/web/lib/piTransport.cjs.map +1 -1
  262. package/dist/web/lib/piTransport.d.mts +3 -3
  263. package/dist/web/lib/piTransport.d.mts.map +1 -1
  264. package/dist/web/lib/piTransport.mjs +34 -53
  265. package/dist/web/lib/piTransport.mjs.map +1 -1
  266. package/dist/web/lib/pluginRegistry.cjs +53 -4
  267. package/dist/web/lib/pluginRegistry.cjs.map +1 -1
  268. package/dist/web/lib/pluginRegistry.d.mts +15 -1
  269. package/dist/web/lib/pluginRegistry.d.mts.map +1 -1
  270. package/dist/web/lib/pluginRegistry.mjs +53 -5
  271. package/dist/web/lib/pluginRegistry.mjs.map +1 -1
  272. package/dist/web/lib/protocolHubSocket.cjs +151 -89
  273. package/dist/web/lib/protocolHubSocket.cjs.map +1 -1
  274. package/dist/web/lib/protocolHubSocket.d.mts +21 -6
  275. package/dist/web/lib/protocolHubSocket.d.mts.map +1 -1
  276. package/dist/web/lib/protocolHubSocket.mjs +152 -90
  277. package/dist/web/lib/protocolHubSocket.mjs.map +1 -1
  278. package/dist/web/lib/sessionActivityRenderer.d.mts +1 -0
  279. package/dist/web/lib/sessionModel.cjs +120 -20
  280. package/dist/web/lib/sessionModel.cjs.map +1 -1
  281. package/dist/web/lib/sessionModel.d.mts +32 -2
  282. package/dist/web/lib/sessionModel.d.mts.map +1 -1
  283. package/dist/web/lib/sessionModel.mjs +120 -22
  284. package/dist/web/lib/sessionModel.mjs.map +1 -1
  285. package/dist/web/lib/sessionProtocolCommands.cjs +33 -34
  286. package/dist/web/lib/sessionProtocolCommands.cjs.map +1 -1
  287. package/dist/web/lib/sessionProtocolCommands.d.mts +3 -2
  288. package/dist/web/lib/sessionProtocolCommands.d.mts.map +1 -1
  289. package/dist/web/lib/sessionProtocolCommands.mjs +33 -34
  290. package/dist/web/lib/sessionProtocolCommands.mjs.map +1 -1
  291. package/dist/web/lib/sessionRailModel.cjs +2 -1
  292. package/dist/web/lib/sessionRailModel.cjs.map +1 -1
  293. package/dist/web/lib/sessionRailModel.d.mts +1 -1
  294. package/dist/web/lib/sessionRailModel.d.mts.map +1 -1
  295. package/dist/web/lib/sessionRailModel.mjs +2 -1
  296. package/dist/web/lib/sessionRailModel.mjs.map +1 -1
  297. package/dist/web/lib/sessionSelectionApi.cjs +72 -0
  298. package/dist/web/lib/sessionSelectionApi.cjs.map +1 -0
  299. package/dist/web/lib/sessionSelectionApi.d.mts +18 -0
  300. package/dist/web/lib/sessionSelectionApi.d.mts.map +1 -0
  301. package/dist/web/lib/sessionSelectionApi.mjs +72 -0
  302. package/dist/web/lib/sessionSelectionApi.mjs.map +1 -0
  303. package/dist/web/lib/sessionSummary.cjs +1 -0
  304. package/dist/web/lib/sessionSummary.cjs.map +1 -1
  305. package/dist/web/lib/sessionSummary.d.mts +1 -1
  306. package/dist/web/lib/sessionSummary.d.mts.map +1 -1
  307. package/dist/web/lib/sessionSummary.mjs +1 -0
  308. package/dist/web/lib/sessionSummary.mjs.map +1 -1
  309. package/dist/web/lib/sessionTranscriptRenderer.d.mts +1 -0
  310. package/dist/web/lib/statusLine.d.mts +1 -0
  311. package/dist/web/lib/stepUp.d.mts.map +1 -1
  312. package/dist/web/lib/threadRenderer.d.mts +1 -0
  313. package/dist/web/lib/toolCompletionTabs.d.mts +1 -0
  314. package/dist/web/lib/transport.cjs +10 -2
  315. package/dist/web/lib/transport.cjs.map +1 -1
  316. package/dist/web/lib/transport.d.mts +6 -2
  317. package/dist/web/lib/transport.d.mts.map +1 -1
  318. package/dist/web/lib/transport.mjs +10 -3
  319. package/dist/web/lib/transport.mjs.map +1 -1
  320. package/dist/web/stores/captureStore.cjs +22 -4
  321. package/dist/web/stores/captureStore.cjs.map +1 -1
  322. package/dist/web/stores/captureStore.d.mts.map +1 -1
  323. package/dist/web/stores/captureStore.mjs +22 -4
  324. package/dist/web/stores/captureStore.mjs.map +1 -1
  325. package/dist/web/stores/fileLinkModesStore.cjs +27 -10
  326. package/dist/web/stores/fileLinkModesStore.cjs.map +1 -1
  327. package/dist/web/stores/fileLinkModesStore.d.mts +5 -0
  328. package/dist/web/stores/fileLinkModesStore.d.mts.map +1 -1
  329. package/dist/web/stores/fileLinkModesStore.mjs +28 -12
  330. package/dist/web/stores/fileLinkModesStore.mjs.map +1 -1
  331. package/dist/web/stores/pagedTranscriptStore.cjs +29 -37
  332. package/dist/web/stores/pagedTranscriptStore.cjs.map +1 -1
  333. package/dist/web/stores/pagedTranscriptStore.d.mts.map +1 -1
  334. package/dist/web/stores/pagedTranscriptStore.mjs +30 -38
  335. package/dist/web/stores/pagedTranscriptStore.mjs.map +1 -1
  336. package/dist/web/stores/sessionStore.cjs +81 -3
  337. package/dist/web/stores/sessionStore.cjs.map +1 -1
  338. package/dist/web/stores/sessionStore.d.mts +13 -2
  339. package/dist/web/stores/sessionStore.d.mts.map +1 -1
  340. package/dist/web/stores/sessionStore.mjs +80 -5
  341. package/dist/web/stores/sessionStore.mjs.map +1 -1
  342. package/dist/web/stores/sessionsStore.cjs +37 -5
  343. package/dist/web/stores/sessionsStore.cjs.map +1 -1
  344. package/dist/web/stores/sessionsStore.d.mts +10 -0
  345. package/dist/web/stores/sessionsStore.d.mts.map +1 -1
  346. package/dist/web/stores/sessionsStore.mjs +36 -6
  347. package/dist/web/stores/sessionsStore.mjs.map +1 -1
  348. package/dist/web/stores/templateStore.cjs +1 -1
  349. package/dist/web/stores/templateStore.cjs.map +1 -1
  350. package/dist/web/stores/templateStore.d.mts +1 -1
  351. package/dist/web/stores/templateStore.mjs +1 -1
  352. package/dist/web/stores/templateStore.mjs.map +1 -1
  353. package/dist/web/stores/threadStore.cjs +12 -9
  354. package/dist/web/stores/threadStore.cjs.map +1 -1
  355. package/dist/web/stores/threadStore.d.mts +7 -3
  356. package/dist/web/stores/threadStore.d.mts.map +1 -1
  357. package/dist/web/stores/threadStore.mjs +13 -10
  358. package/dist/web/stores/threadStore.mjs.map +1 -1
  359. package/dist/web/stores/transientTabsStore.d.mts +1 -0
  360. package/dist/web/stores/useToolPrompt.cjs +18 -9
  361. package/dist/web/stores/useToolPrompt.cjs.map +1 -1
  362. package/dist/web/stores/useToolPrompt.d.mts +3 -2
  363. package/dist/web/stores/useToolPrompt.d.mts.map +1 -1
  364. package/dist/web/stores/useToolPrompt.mjs +18 -9
  365. package/dist/web/stores/useToolPrompt.mjs.map +1 -1
  366. package/package.json +13 -15
@@ -1 +1 @@
1
- {"version":3,"file":"ContextItemDialog.cjs","names":["useState","fetchContextItemDetail","Dialog","DialogContent","DialogHeader","DialogTitle","DialogBody","Spinner","Panel"],"sources":["../../../../src/web/features/activity/ContextItemDialog.tsx"],"sourcesContent":["import type { ContextItemDetail, ContextItemKind, ContextToolWarning } from '@agimon-ai/po-core/contextApi';\nimport {\n Dialog,\n DialogBody,\n DialogContent,\n DialogHeader,\n DialogTitle,\n Panel,\n Spinner,\n} from '@agimon-ai/po-web-components';\nimport { useEffect, useState } from 'react';\n\nimport { fetchContextItemDetail } from '../../lib/contextDetailApi';\n\n/**\n * What one row of the composition actually is.\n *\n * The panel answers \"what does this cost\"; a reader who clicks a row is asking\n * the follow-up, \"and what am I paying for\". That is the description the model\n * reads, the schema it is handed, and for a tool the split between the two,\n * because the two are cut differently: prose comes out with the package, a\n * schema only with the tool.\n *\n * Fetched on open rather than carried by the projection. The full text of every\n * tool in a composition is an order of magnitude larger than the figures, and\n * is wanted one row at a time.\n */\n\nfunction tokens(value: number): string {\n return `~${value.toLocaleString()}`;\n}\n\ninterface Target {\n itemKind: ContextItemKind;\n name: string;\n owner: string;\n}\n\nexport interface ContextItemDialogProps {\n sessionId: string | null;\n target: Target | null;\n warnings?: readonly ContextToolWarning[];\n onClose: () => void;\n}\n\nexport function ContextItemDialog({ sessionId, target, warnings, onClose }: ContextItemDialogProps) {\n const [detail, setDetail] = useState<ContextItemDetail | null>(null);\n const [error, setError] = useState<string | null>(null);\n const itemKind = target?.itemKind ?? null;\n const name = target?.name ?? null;\n\n // A second click must not show the first row's answer for a frame, so the\n // reset happens during render rather than in the effect that refetches.\n const request =\n sessionId === null || itemKind === null || name === null ? null : `${sessionId}\\u0000${itemKind}\\u0000${name}`;\n const [shown, setShown] = useState<string | null>(null);\n if (shown !== request) {\n setShown(request);\n setDetail(null);\n setError(null);\n }\n\n useEffect(() => {\n if (sessionId === null || itemKind === null || name === null) return;\n // A reply that lands after the reader moved on belongs to a row that is no\n // longer open, so it is dropped rather than painted.\n let live = true;\n void fetchContextItemDetail(sessionId, itemKind, name).then((result) => {\n if (!live) return;\n if (result.ok) setDetail(result.detail);\n else setError(result.error);\n });\n return () => {\n live = false;\n };\n }, [sessionId, itemKind, name]);\n\n if (target === null) return null;\n\n return (\n <Dialog\n open\n onOpenChange={(next) => {\n if (!next) onClose();\n }}\n >\n <DialogContent width=\"lg\" data-testid=\"context-item-dialog\" aria-describedby={undefined}>\n <DialogHeader>\n <DialogTitle data-testid=\"context-item-title\">\n {target.itemKind === 'prompt' ? 'system prompt' : target.name}\n </DialogTitle>\n <span className=\"text-sm text-doom-dim\">\n {target.itemKind} · {target.owner}\n </span>\n </DialogHeader>\n <DialogBody>\n {target.itemKind === 'tool' && warnings && warnings.length > 0 ? (\n <Section title=\"warnings\">\n <ul data-testid=\"context-item-warnings\" aria-live=\"polite\" className=\"flex flex-col gap-3\">\n {warnings.map((warning, index) => (\n <li key={index} className=\"flex flex-col gap-1 text-sm break-words\">\n <span className=\"text-doom-yellow\">{warning.source}</span>\n <span className=\"text-sm text-doom-dim\">{warning.path}</span>\n <p className=\"text-doom-text\">{warning.message}</p>\n </li>\n ))}\n </ul>\n </Section>\n ) : null}\n {error !== null ? (\n <p data-testid=\"context-item-error\" className=\"text-sm text-doom-dim\">\n {error}\n </p>\n ) : detail === null ? (\n <p data-testid=\"context-item-loading\" className=\"flex items-center gap-2 text-sm text-doom-dim\">\n <Spinner />\n reading the session's inventory\n </p>\n ) : (\n <ContextItemBody detail={detail} />\n )}\n </DialogBody>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction ContextItemBody({ detail }: { detail: ContextItemDetail }) {\n if (detail.itemKind === 'prompt') return <PromptBody detail={detail} />;\n return (\n <div className=\"flex flex-col gap-3\">\n {detail.itemKind === 'tool' ? <ToolCost detail={detail} /> : <SkillFacts detail={detail} />}\n\n {detail.itemKind === 'skill' || detail.description !== undefined ? (\n <Section title=\"description\">\n <p\n data-testid=\"context-item-description\"\n className=\"text-base leading-relaxed whitespace-pre-wrap text-doom-text\"\n >\n {detail.description}\n </p>\n </Section>\n ) : null}\n\n {detail.itemKind === 'skill' && detail.body !== undefined ? (\n <Section title=\"body\">\n <Pre testId=\"context-item-body\">{detail.body}</Pre>\n </Section>\n ) : null}\n\n {detail.itemKind === 'tool' && detail.promptSnippet !== undefined ? (\n <Section title=\"prompt snippet\">\n <Pre testId=\"context-item-snippet\">{detail.promptSnippet}</Pre>\n </Section>\n ) : null}\n\n {detail.itemKind === 'tool' && detail.promptGuidelines !== undefined ? (\n <Section title=\"prompt guidelines\">\n <ul data-testid=\"context-item-guidelines\" className=\"flex flex-col gap-1\">\n {detail.promptGuidelines.map((line) => (\n <li key={line} className=\"text-sm leading-relaxed text-doom-dim\">\n {line}\n </li>\n ))}\n </ul>\n </Section>\n ) : null}\n\n {detail.itemKind === 'tool' && detail.parameters !== undefined ? (\n <Section title=\"parameters\">\n <Pre testId=\"context-item-schema\">{JSON.stringify(detail.parameters, null, 2)}</Pre>\n </Section>\n ) : null}\n </div>\n );\n}\n\nfunction Section({ title, children }: { title: string; children: React.ReactNode }) {\n return (\n <div className=\"flex flex-col gap-1\">\n <span className=\"text-lg font-semibold text-doom-hi\">{title}</span>\n {children}\n </div>\n );\n}\n\nfunction Pre({ testId, children, tall = false }: { testId: string; children: string; tall?: boolean }) {\n return (\n <Panel className={`overflow-auto bg-doom-deep px-3 py-2 ${tall ? 'max-h-[60vh]' : 'max-h-64'}`}>\n <pre data-testid={testId} className=\"text-sm leading-relaxed whitespace-pre-wrap text-doom-dim\">\n {children}\n </pre>\n </Panel>\n );\n}\n\n/**\n * The whole prompt, and the two things a figure alone would mislead about.\n *\n * The count overlaps the panel's own total, because the tool prose and skill\n * listings priced there are inside this text. And a session that has sent\n * nothing has no built prompt to show: assembling one would fire the hooks that\n * a real turn fires, so the pre-hook base is shown and named as such.\n */\nfunction PromptBody({ detail }: { detail: Extract<ContextItemDetail, { itemKind: 'prompt' }> }) {\n return (\n <div className=\"flex flex-col gap-3\">\n <div data-testid=\"context-item-cost\" className=\"flex flex-col gap-1\">\n <Row label=\"prompt\" value={tokens(detail.tokens)} strong />\n <p className=\"text-sm text-doom-dim\">\n counted apart from the panel total: the tool and skill prose priced there is part of this text\n </p>\n {detail.stage === 'base' ? (\n <p data-testid=\"context-item-stage\" className=\"text-sm text-doom-dim\">\n this session has sent nothing yet, so this is the prompt before packages add to it at the first message\n </p>\n ) : null}\n </div>\n <Section title=\"text\">\n <Pre testId=\"context-item-prompt\" tall>\n {detail.text}\n </Pre>\n </Section>\n </div>\n );\n}\n\n/** A tool is paid twice, so the split is the useful figure rather than the total. */\nfunction ToolCost({ detail }: { detail: Extract<ContextItemDetail, { itemKind: 'tool' }> }) {\n return (\n <div data-testid=\"context-item-cost\" className=\"flex flex-col gap-1\">\n <Row label=\"schema\" value={tokens(detail.tokens.schemaTokens)} />\n <Row label=\"system prompt\" value={tokens(detail.tokens.promptTokens)} />\n <Row label=\"total\" value={tokens(detail.tokens.totalTokens)} strong />\n {detail.active ? null : (\n <p className=\"text-sm text-doom-dim\">not sent to the model; costs nothing until switched on</p>\n )}\n </div>\n );\n}\n\nfunction SkillFacts({ detail }: { detail: Extract<ContextItemDetail, { itemKind: 'skill' }> }) {\n return (\n <div data-testid=\"context-item-cost\" className=\"flex flex-col gap-1\">\n <Row label=\"listing\" value={tokens(detail.tokens)} strong />\n {detail.filePath ? <Row label=\"file\" value={detail.filePath} /> : null}\n {detail.modelInvocable ? null : <p className=\"text-sm text-doom-dim\">not offered to the model</p>}\n </div>\n );\n}\n\nfunction Row({ label, value, strong = false }: { label: string; value: string; strong?: boolean }) {\n return (\n <div className=\"flex items-baseline justify-between gap-3\">\n <span className=\"text-sm text-doom-dim\">{label}</span>\n <span className={`truncate text-sm ${strong ? 'font-semibold text-doom-text' : 'text-doom-dim'}`}>{value}</span>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,SAAS,OAAO,OAAuB;CACrC,OAAO,IAAI,MAAM,eAAe;AAClC;AAeA,SAAgB,kBAAkB,EAAE,WAAW,QAAQ,UAAU,WAAmC;CAClG,MAAM,CAAC,QAAQ,cAAA,GAAaA,MAAAA,SAAAA,CAAmC,IAAI;CACnE,MAAM,CAAC,OAAO,aAAA,GAAYA,MAAAA,SAAAA,CAAwB,IAAI;CACtD,MAAM,WAAW,QAAQ,YAAY;CACrC,MAAM,OAAO,QAAQ,QAAQ;CAI7B,MAAM,UACJ,cAAc,QAAQ,aAAa,QAAQ,SAAS,OAAO,OAAO,GAAG,UAAU,QAAQ,SAAS,QAAQ;CAC1G,MAAM,CAAC,OAAO,aAAA,GAAYA,MAAAA,SAAAA,CAAwB,IAAI;CACtD,IAAI,UAAU,SAAS;EACrB,SAAS,OAAO;EAChB,UAAU,IAAI;EACd,SAAS,IAAI;CACf;CAEA,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,IAAI,cAAc,QAAQ,aAAa,QAAQ,SAAS,MAAM;EAG9D,IAAI,OAAO;EACX,yBAAKC,uBAAuB,WAAW,UAAU,IAAI,CAAC,CAAC,MAAM,WAAW;GACtE,IAAI,CAAC,MAAM;GACX,IAAI,OAAO,IAAI,UAAU,OAAO,MAAM;QACjC,SAAS,OAAO,KAAK;EAC5B,CAAC;EACD,aAAa;GACX,OAAO;EACT;CACF,GAAG;EAAC;EAAW;EAAU;CAAI,CAAC;CAE9B,IAAI,WAAW,MAAM,OAAO;CAE5B,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,QAAD;EACE,MAAA;EACA,eAAe,SAAS;GACtB,IAA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U;EAA/C,UAAA;GACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;IAAK,OAAM;IAAU,OAAO,OAAO,OAAO,MAAM;IAAG,QAAA;GAAQ,CAAA;GAC1D,OAAO,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;IAAK,OAAM;IAAO,OAAO,OAAO;GAAW,CAAA,IAAI;GACjE,OAAO,iBAAiB,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;IAAG,WAAU;IAAwB,UAAA;GAA2B,CAAA;EAC7F;;AAET;AAEA,SAAS,IAAI,EAAE,OAAO,OAAO,SAAS,SAA6D;CACjG,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,WAAU;GAAyB,UAAA;EAAY,CAAA,GACrD,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,WAAW,oBAAoB,SAAS,iCAAiC;GAAoB,UAAA;EAAY,CAAA,CAC5G;;AAET"}
1
+ {"version":3,"file":"ContextItemDialog.cjs","names":["useState","fetchContextItemDetail","Dialog","DialogContent","DialogHeader","DialogTitle","DialogBody","Spinner","Panel"],"sources":["../../../../src/web/features/activity/ContextItemDialog.tsx"],"sourcesContent":["import type { ContextItemDetail, ContextItemKind, ContextToolWarning } from '@agimon-ai/po-core/contextApi';\nimport {\n Dialog,\n DialogBody,\n DialogContent,\n DialogHeader,\n DialogTitle,\n Panel,\n Spinner,\n} from '@agimon-ai/po-web-components';\nimport { useEffect, useState } from 'react';\n\nimport { fetchContextItemDetail } from '../../lib/contextDetailApi';\n\n/**\n * What one row of the composition actually is.\n *\n * The panel answers \"what does this cost\"; a reader who clicks a row is asking\n * the follow-up, \"and what am I paying for\". That is the description the model\n * reads, the schema it is handed, and for a tool the split between the two,\n * because the two are cut differently: prose comes out with the package, a\n * schema only with the tool.\n *\n * Fetched on open rather than carried by the projection. The full text of every\n * tool in a composition is an order of magnitude larger than the figures, and\n * is wanted one row at a time.\n */\n\nfunction tokens(value: number): string {\n return `~${value.toLocaleString()}`;\n}\n\ninterface Target {\n itemKind: ContextItemKind;\n name: string;\n owner: string;\n}\n\nexport interface ContextItemDialogProps {\n sessionId: string | null;\n target: Target | null;\n warnings?: readonly ContextToolWarning[];\n onClose: () => void;\n}\n\nexport function ContextItemDialog({ sessionId, target, warnings, onClose }: ContextItemDialogProps) {\n const [detail, setDetail] = useState<ContextItemDetail | null>(null);\n const [error, setError] = useState<string | null>(null);\n const itemKind = target?.itemKind ?? null;\n const name = target?.name ?? null;\n\n // A second click must not show the first row's answer for a frame, so the\n // reset happens during render rather than in the effect that refetches.\n const request =\n sessionId === null || itemKind === null || name === null ? null : `${sessionId}\\u0000${itemKind}\\u0000${name}`;\n const [shown, setShown] = useState<string | null>(null);\n if (shown !== request) {\n setShown(request);\n setDetail(null);\n setError(null);\n }\n\n useEffect(() => {\n if (sessionId === null || itemKind === null || name === null) return;\n // A reply that lands after the reader moved on belongs to a row that is no\n // longer open, so it is dropped rather than painted.\n let live = true;\n void fetchContextItemDetail(sessionId, itemKind, name).then((result) => {\n if (!live) return;\n if (result.ok) setDetail(result.detail);\n else setError(result.error);\n });\n return () => {\n live = false;\n };\n }, [sessionId, itemKind, name]);\n\n if (target === null) return null;\n\n return (\n <Dialog\n open\n onOpenChange={(next) => {\n if (!next) onClose();\n }}\n >\n <DialogContent width=\"lg\" data-testid=\"context-item-dialog\" aria-describedby={undefined}>\n <DialogHeader>\n <DialogTitle data-testid=\"context-item-title\">\n {target.itemKind === 'prompt' ? 'system prompt' : target.name}\n </DialogTitle>\n <span className=\"text-sm text-po-dim\">\n {target.itemKind} · {target.owner}\n </span>\n </DialogHeader>\n <DialogBody>\n {target.itemKind === 'tool' && warnings && warnings.length > 0 ? (\n <Section title=\"warnings\">\n <ul data-testid=\"context-item-warnings\" aria-live=\"polite\" className=\"flex flex-col gap-3\">\n {warnings.map((warning, index) => (\n <li key={index} className=\"flex flex-col gap-1 text-sm break-words\">\n <span className=\"text-po-yellow\">{warning.source}</span>\n <span className=\"text-sm text-po-dim\">{warning.path}</span>\n <p className=\"text-po-text\">{warning.message}</p>\n </li>\n ))}\n </ul>\n </Section>\n ) : null}\n {error !== null ? (\n <p data-testid=\"context-item-error\" className=\"text-sm text-po-dim\">\n {error}\n </p>\n ) : detail === null ? (\n <p data-testid=\"context-item-loading\" className=\"flex items-center gap-2 text-sm text-po-dim\">\n <Spinner />\n reading the session's inventory\n </p>\n ) : (\n <ContextItemBody detail={detail} />\n )}\n </DialogBody>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction ContextItemBody({ detail }: { detail: ContextItemDetail }) {\n if (detail.itemKind === 'prompt') return <PromptBody detail={detail} />;\n return (\n <div className=\"flex flex-col gap-3\">\n {detail.itemKind === 'tool' ? <ToolCost detail={detail} /> : <SkillFacts detail={detail} />}\n\n {detail.itemKind === 'skill' || detail.description !== undefined ? (\n <Section title=\"description\">\n <p\n data-testid=\"context-item-description\"\n className=\"text-base leading-relaxed whitespace-pre-wrap text-po-text\"\n >\n {detail.description}\n </p>\n </Section>\n ) : null}\n\n {detail.itemKind === 'skill' && detail.body !== undefined ? (\n <Section title=\"body\">\n <Pre testId=\"context-item-body\">{detail.body}</Pre>\n </Section>\n ) : null}\n\n {detail.itemKind === 'tool' && detail.promptSnippet !== undefined ? (\n <Section title=\"prompt snippet\">\n <Pre testId=\"context-item-snippet\">{detail.promptSnippet}</Pre>\n </Section>\n ) : null}\n\n {detail.itemKind === 'tool' && detail.promptGuidelines !== undefined ? (\n <Section title=\"prompt guidelines\">\n <ul data-testid=\"context-item-guidelines\" className=\"flex flex-col gap-1\">\n {detail.promptGuidelines.map((line) => (\n <li key={line} className=\"text-sm leading-relaxed text-po-dim\">\n {line}\n </li>\n ))}\n </ul>\n </Section>\n ) : null}\n\n {detail.itemKind === 'tool' && detail.parameters !== undefined ? (\n <Section title=\"parameters\">\n <Pre testId=\"context-item-schema\">{JSON.stringify(detail.parameters, null, 2)}</Pre>\n </Section>\n ) : null}\n </div>\n );\n}\n\nfunction Section({ title, children }: { title: string; children: React.ReactNode }) {\n return (\n <div className=\"flex flex-col gap-1\">\n <span className=\"text-lg font-semibold text-po-hi\">{title}</span>\n {children}\n </div>\n );\n}\n\nfunction Pre({ testId, children, tall = false }: { testId: string; children: string; tall?: boolean }) {\n return (\n <Panel className={`overflow-auto bg-po-deep px-3 py-2 ${tall ? 'max-h-[60vh]' : 'max-h-64'}`}>\n <pre data-testid={testId} className=\"text-sm leading-relaxed whitespace-pre-wrap text-po-dim\">\n {children}\n </pre>\n </Panel>\n );\n}\n\n/**\n * The whole prompt, and the two things a figure alone would mislead about.\n *\n * The count overlaps the panel's own total, because the tool prose and skill\n * listings priced there are inside this text. And a session that has sent\n * nothing has no built prompt to show: assembling one would fire the hooks that\n * a real turn fires, so the pre-hook base is shown and named as such.\n */\nfunction PromptBody({ detail }: { detail: Extract<ContextItemDetail, { itemKind: 'prompt' }> }) {\n return (\n <div className=\"flex flex-col gap-3\">\n <div data-testid=\"context-item-cost\" className=\"flex flex-col gap-1\">\n <Row label=\"prompt\" value={tokens(detail.tokens)} strong />\n <p className=\"text-sm text-po-dim\">\n counted apart from the panel total: the tool and skill prose priced there is part of this text\n </p>\n {detail.stage === 'base' ? (\n <p data-testid=\"context-item-stage\" className=\"text-sm text-po-dim\">\n this session has sent nothing yet, so this is the prompt before packages add to it at the first message\n </p>\n ) : null}\n </div>\n <Section title=\"text\">\n <Pre testId=\"context-item-prompt\" tall>\n {detail.text}\n </Pre>\n </Section>\n </div>\n );\n}\n\n/** A tool is paid twice, so the split is the useful figure rather than the total. */\nfunction ToolCost({ detail }: { detail: Extract<ContextItemDetail, { itemKind: 'tool' }> }) {\n return (\n <div data-testid=\"context-item-cost\" className=\"flex flex-col gap-1\">\n <Row label=\"schema\" value={tokens(detail.tokens.schemaTokens)} />\n <Row label=\"system prompt\" value={tokens(detail.tokens.promptTokens)} />\n <Row label=\"total\" value={tokens(detail.tokens.totalTokens)} strong />\n {detail.active ? null : (\n <p className=\"text-sm text-po-dim\">not sent to the model; costs nothing until switched on</p>\n )}\n </div>\n );\n}\n\nfunction SkillFacts({ detail }: { detail: Extract<ContextItemDetail, { itemKind: 'skill' }> }) {\n return (\n <div data-testid=\"context-item-cost\" className=\"flex flex-col gap-1\">\n <Row label=\"listing\" value={tokens(detail.tokens)} strong />\n {detail.filePath ? <Row label=\"file\" value={detail.filePath} /> : null}\n {detail.modelInvocable ? null : <p className=\"text-sm text-po-dim\">not offered to the model</p>}\n </div>\n );\n}\n\nfunction Row({ label, value, strong = false }: { label: string; value: string; strong?: boolean }) {\n return (\n <div className=\"flex items-baseline justify-between gap-3\">\n <span className=\"text-sm text-po-dim\">{label}</span>\n <span className={`truncate text-sm ${strong ? 'font-semibold text-po-text' : 'text-po-dim'}`}>{value}</span>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,SAAS,OAAO,OAAuB;CACrC,OAAO,IAAI,MAAM,eAAe;AAClC;AAeA,SAAgB,kBAAkB,EAAE,WAAW,QAAQ,UAAU,WAAmC;CAClG,MAAM,CAAC,QAAQ,cAAA,GAAaA,MAAAA,SAAAA,CAAmC,IAAI;CACnE,MAAM,CAAC,OAAO,aAAA,GAAYA,MAAAA,SAAAA,CAAwB,IAAI;CACtD,MAAM,WAAW,QAAQ,YAAY;CACrC,MAAM,OAAO,QAAQ,QAAQ;CAI7B,MAAM,UACJ,cAAc,QAAQ,aAAa,QAAQ,SAAS,OAAO,OAAO,GAAG,UAAU,QAAQ,SAAS,QAAQ;CAC1G,MAAM,CAAC,OAAO,aAAA,GAAYA,MAAAA,SAAAA,CAAwB,IAAI;CACtD,IAAI,UAAU,SAAS;EACrB,SAAS,OAAO;EAChB,UAAU,IAAI;EACd,SAAS,IAAI;CACf;CAEA,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,IAAI,cAAc,QAAQ,aAAa,QAAQ,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AAK,OAAM;IAAgB,OAAO,OAAO,OAAO,OAAO,YAAY;GAAI,CAAA;GACvE,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;IAAK,OAAM;IAAQ,OAAO,OAAO,OAAO,OAAO,WAAW;IAAG,QAAA;GAAQ,CAAA;GACpE,OAAO,SAAS,OACf,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;IAAG,WAAU;IAAsB,UAAA;GAAyD,CAAA;EAE3F;;AAET;AAEA,SAAS,WAAW,EAAE,UAAyE;CAC7F,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,eAAY;EAAoB,WAAU;EAA/C,UAAA;GACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;IAAK,OAAM;IAAU,OAAO,OAAO,OAAO,MAAM;IAAG,QAAA;GAAQ,CAAA;GAC1D,OAAO,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;IAAK,OAAM;IAAO,OAAO,OAAO;GAAW,CAAA,IAAI;GACjE,OAAO,iBAAiB,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;IAAG,WAAU;IAAsB,UAAA;GAA2B,CAAA;EAC3F;;AAET;AAEA,SAAS,IAAI,EAAE,OAAO,OAAO,SAAS,SAA6D;CACjG,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,WAAU;GAAuB,UAAA;EAAY,CAAA,GACnD,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,WAAW,oBAAoB,SAAS,+BAA+B;GAAkB,UAAA;EAAY,CAAA,CACxG;;AAET"}
@@ -13,4 +13,5 @@ export interface ContextItemDialogProps {
13
13
  }
14
14
  export declare function ContextItemDialog({ sessionId, target, warnings, onClose }: ContextItemDialogProps): import("react").JSX.Element | null;
15
15
  //#endregion
16
+ export {};
16
17
  //# sourceMappingURL=ContextItemDialog.d.mts.map
@@ -61,7 +61,7 @@ function ContextItemDialog({ sessionId, target, warnings, onClose }) {
61
61
  "data-testid": "context-item-title",
62
62
  children: target.itemKind === "prompt" ? "system prompt" : target.name
63
63
  }), /* @__PURE__ */ jsxs("span", {
64
- className: "text-sm text-doom-dim",
64
+ className: "text-sm text-po-dim",
65
65
  children: [
66
66
  target.itemKind,
67
67
  " · ",
@@ -77,15 +77,15 @@ function ContextItemDialog({ sessionId, target, warnings, onClose }) {
77
77
  className: "flex flex-col gap-1 text-sm break-words",
78
78
  children: [
79
79
  /* @__PURE__ */ jsx("span", {
80
- className: "text-doom-yellow",
80
+ className: "text-po-yellow",
81
81
  children: warning.source
82
82
  }),
83
83
  /* @__PURE__ */ jsx("span", {
84
- className: "text-sm text-doom-dim",
84
+ className: "text-sm text-po-dim",
85
85
  children: warning.path
86
86
  }),
87
87
  /* @__PURE__ */ jsx("p", {
88
- className: "text-doom-text",
88
+ className: "text-po-text",
89
89
  children: warning.message
90
90
  })
91
91
  ]
@@ -93,11 +93,11 @@ function ContextItemDialog({ sessionId, target, warnings, onClose }) {
93
93
  })
94
94
  }) : null, error !== null ? /* @__PURE__ */ jsx("p", {
95
95
  "data-testid": "context-item-error",
96
- className: "text-sm text-doom-dim",
96
+ className: "text-sm text-po-dim",
97
97
  children: error
98
98
  }) : detail === null ? /* @__PURE__ */ jsxs("p", {
99
99
  "data-testid": "context-item-loading",
100
- className: "flex items-center gap-2 text-sm text-doom-dim",
100
+ className: "flex items-center gap-2 text-sm text-po-dim",
101
101
  children: [/* @__PURE__ */ jsx(Spinner, {}), "reading the session's inventory"]
102
102
  }) : /* @__PURE__ */ jsx(ContextItemBody, { detail })] })]
103
103
  })
@@ -113,7 +113,7 @@ function ContextItemBody({ detail }) {
113
113
  title: "description",
114
114
  children: /* @__PURE__ */ jsx("p", {
115
115
  "data-testid": "context-item-description",
116
- className: "text-base leading-relaxed whitespace-pre-wrap text-doom-text",
116
+ className: "text-base leading-relaxed whitespace-pre-wrap text-po-text",
117
117
  children: detail.description
118
118
  })
119
119
  }) : null,
@@ -137,7 +137,7 @@ function ContextItemBody({ detail }) {
137
137
  "data-testid": "context-item-guidelines",
138
138
  className: "flex flex-col gap-1",
139
139
  children: detail.promptGuidelines.map((line) => /* @__PURE__ */ jsx("li", {
140
- className: "text-sm leading-relaxed text-doom-dim",
140
+ className: "text-sm leading-relaxed text-po-dim",
141
141
  children: line
142
142
  }, line))
143
143
  })
@@ -156,17 +156,17 @@ function Section({ title, children }) {
156
156
  return /* @__PURE__ */ jsxs("div", {
157
157
  className: "flex flex-col gap-1",
158
158
  children: [/* @__PURE__ */ jsx("span", {
159
- className: "text-lg font-semibold text-doom-hi",
159
+ className: "text-lg font-semibold text-po-hi",
160
160
  children: title
161
161
  }), children]
162
162
  });
163
163
  }
164
164
  function Pre({ testId, children, tall = false }) {
165
165
  return /* @__PURE__ */ jsx(Panel, {
166
- className: `overflow-auto bg-doom-deep px-3 py-2 ${tall ? "max-h-[60vh]" : "max-h-64"}`,
166
+ className: `overflow-auto bg-po-deep px-3 py-2 ${tall ? "max-h-[60vh]" : "max-h-64"}`,
167
167
  children: /* @__PURE__ */ jsx("pre", {
168
168
  "data-testid": testId,
169
- className: "text-sm leading-relaxed whitespace-pre-wrap text-doom-dim",
169
+ className: "text-sm leading-relaxed whitespace-pre-wrap text-po-dim",
170
170
  children
171
171
  })
172
172
  });
@@ -192,12 +192,12 @@ function PromptBody({ detail }) {
192
192
  strong: true
193
193
  }),
194
194
  /* @__PURE__ */ jsx("p", {
195
- className: "text-sm text-doom-dim",
195
+ className: "text-sm text-po-dim",
196
196
  children: "counted apart from the panel total: the tool and skill prose priced there is part of this text"
197
197
  }),
198
198
  detail.stage === "base" ? /* @__PURE__ */ jsx("p", {
199
199
  "data-testid": "context-item-stage",
200
- className: "text-sm text-doom-dim",
200
+ className: "text-sm text-po-dim",
201
201
  children: "this session has sent nothing yet, so this is the prompt before packages add to it at the first message"
202
202
  }) : null
203
203
  ]
@@ -231,7 +231,7 @@ function ToolCost({ detail }) {
231
231
  strong: true
232
232
  }),
233
233
  detail.active ? null : /* @__PURE__ */ jsx("p", {
234
- className: "text-sm text-doom-dim",
234
+ className: "text-sm text-po-dim",
235
235
  children: "not sent to the model; costs nothing until switched on"
236
236
  })
237
237
  ]
@@ -252,7 +252,7 @@ function SkillFacts({ detail }) {
252
252
  value: detail.filePath
253
253
  }) : null,
254
254
  detail.modelInvocable ? null : /* @__PURE__ */ jsx("p", {
255
- className: "text-sm text-doom-dim",
255
+ className: "text-sm text-po-dim",
256
256
  children: "not offered to the model"
257
257
  })
258
258
  ]
@@ -262,10 +262,10 @@ function Row({ label, value, strong = false }) {
262
262
  return /* @__PURE__ */ jsxs("div", {
263
263
  className: "flex items-baseline justify-between gap-3",
264
264
  children: [/* @__PURE__ */ jsx("span", {
265
- className: "text-sm text-doom-dim",
265
+ className: "text-sm text-po-dim",
266
266
  children: label
267
267
  }), /* @__PURE__ */ jsx("span", {
268
- className: `truncate text-sm ${strong ? "font-semibold text-doom-text" : "text-doom-dim"}`,
268
+ className: `truncate text-sm ${strong ? "font-semibold text-po-text" : "text-po-dim"}`,
269
269
  children: value
270
270
  })]
271
271
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ContextItemDialog.mjs","names":[],"sources":["../../../../src/web/features/activity/ContextItemDialog.tsx"],"sourcesContent":["import type { ContextItemDetail, ContextItemKind, ContextToolWarning } from '@agimon-ai/po-core/contextApi';\nimport {\n Dialog,\n DialogBody,\n DialogContent,\n DialogHeader,\n DialogTitle,\n Panel,\n Spinner,\n} from '@agimon-ai/po-web-components';\nimport { useEffect, useState } from 'react';\n\nimport { fetchContextItemDetail } from '../../lib/contextDetailApi';\n\n/**\n * What one row of the composition actually is.\n *\n * The panel answers \"what does this cost\"; a reader who clicks a row is asking\n * the follow-up, \"and what am I paying for\". That is the description the model\n * reads, the schema it is handed, and for a tool the split between the two,\n * because the two are cut differently: prose comes out with the package, a\n * schema only with the tool.\n *\n * Fetched on open rather than carried by the projection. The full text of every\n * tool in a composition is an order of magnitude larger than the figures, and\n * is wanted one row at a time.\n */\n\nfunction tokens(value: number): string {\n return `~${value.toLocaleString()}`;\n}\n\ninterface Target {\n itemKind: ContextItemKind;\n name: string;\n owner: string;\n}\n\nexport interface ContextItemDialogProps {\n sessionId: string | null;\n target: Target | null;\n warnings?: readonly ContextToolWarning[];\n onClose: () => void;\n}\n\nexport function ContextItemDialog({ sessionId, target, warnings, onClose }: ContextItemDialogProps) {\n const [detail, setDetail] = useState<ContextItemDetail | null>(null);\n const [error, setError] = useState<string | null>(null);\n const itemKind = target?.itemKind ?? null;\n const name = target?.name ?? null;\n\n // A second click must not show the first row's answer for a frame, so the\n // reset happens during render rather than in the effect that refetches.\n const request =\n sessionId === null || itemKind === null || name === null ? null : `${sessionId}\\u0000${itemKind}\\u0000${name}`;\n const [shown, setShown] = useState<string | null>(null);\n if (shown !== request) {\n setShown(request);\n setDetail(null);\n setError(null);\n }\n\n useEffect(() => {\n if (sessionId === null || itemKind === null || name === null) return;\n // A reply that lands after the reader moved on belongs to a row that is no\n // longer open, so it is dropped rather than painted.\n let live = true;\n void fetchContextItemDetail(sessionId, itemKind, name).then((result) => {\n if (!live) return;\n if (result.ok) setDetail(result.detail);\n else setError(result.error);\n });\n return () => {\n live = false;\n };\n }, [sessionId, itemKind, name]);\n\n if (target === null) return null;\n\n return (\n <Dialog\n open\n onOpenChange={(next) => {\n if (!next) onClose();\n }}\n >\n <DialogContent width=\"lg\" data-testid=\"context-item-dialog\" aria-describedby={undefined}>\n <DialogHeader>\n <DialogTitle data-testid=\"context-item-title\">\n {target.itemKind === 'prompt' ? 'system prompt' : target.name}\n </DialogTitle>\n <span className=\"text-sm text-doom-dim\">\n {target.itemKind} · {target.owner}\n </span>\n </DialogHeader>\n <DialogBody>\n {target.itemKind === 'tool' && warnings && warnings.length > 0 ? (\n <Section title=\"warnings\">\n <ul data-testid=\"context-item-warnings\" aria-live=\"polite\" className=\"flex flex-col gap-3\">\n {warnings.map((warning, index) => (\n <li key={index} className=\"flex flex-col gap-1 text-sm break-words\">\n <span className=\"text-doom-yellow\">{warning.source}</span>\n <span className=\"text-sm text-doom-dim\">{warning.path}</span>\n <p className=\"text-doom-text\">{warning.message}</p>\n </li>\n ))}\n </ul>\n </Section>\n ) : null}\n {error !== null ? (\n <p data-testid=\"context-item-error\" className=\"text-sm text-doom-dim\">\n {error}\n </p>\n ) : detail === null ? (\n <p data-testid=\"context-item-loading\" className=\"flex items-center gap-2 text-sm text-doom-dim\">\n <Spinner />\n reading the session's inventory\n </p>\n ) : (\n <ContextItemBody detail={detail} />\n )}\n </DialogBody>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction ContextItemBody({ detail }: { detail: ContextItemDetail }) {\n if (detail.itemKind === 'prompt') return <PromptBody detail={detail} />;\n return (\n <div className=\"flex flex-col gap-3\">\n {detail.itemKind === 'tool' ? <ToolCost detail={detail} /> : <SkillFacts detail={detail} />}\n\n {detail.itemKind === 'skill' || detail.description !== undefined ? (\n <Section title=\"description\">\n <p\n data-testid=\"context-item-description\"\n className=\"text-base leading-relaxed whitespace-pre-wrap text-doom-text\"\n >\n {detail.description}\n </p>\n </Section>\n ) : null}\n\n {detail.itemKind === 'skill' && detail.body !== undefined ? (\n <Section title=\"body\">\n <Pre testId=\"context-item-body\">{detail.body}</Pre>\n </Section>\n ) : null}\n\n {detail.itemKind === 'tool' && detail.promptSnippet !== undefined ? (\n <Section title=\"prompt snippet\">\n <Pre testId=\"context-item-snippet\">{detail.promptSnippet}</Pre>\n </Section>\n ) : null}\n\n {detail.itemKind === 'tool' && detail.promptGuidelines !== undefined ? (\n <Section title=\"prompt guidelines\">\n <ul data-testid=\"context-item-guidelines\" className=\"flex flex-col gap-1\">\n {detail.promptGuidelines.map((line) => (\n <li key={line} className=\"text-sm leading-relaxed text-doom-dim\">\n {line}\n </li>\n ))}\n </ul>\n </Section>\n ) : null}\n\n {detail.itemKind === 'tool' && detail.parameters !== undefined ? (\n <Section title=\"parameters\">\n <Pre testId=\"context-item-schema\">{JSON.stringify(detail.parameters, null, 2)}</Pre>\n </Section>\n ) : null}\n </div>\n );\n}\n\nfunction Section({ title, children }: { title: string; children: React.ReactNode }) {\n return (\n <div className=\"flex flex-col gap-1\">\n <span className=\"text-lg font-semibold text-doom-hi\">{title}</span>\n {children}\n </div>\n );\n}\n\nfunction Pre({ testId, children, tall = false }: { testId: string; children: string; tall?: boolean }) {\n return (\n <Panel className={`overflow-auto bg-doom-deep px-3 py-2 ${tall ? 'max-h-[60vh]' : 'max-h-64'}`}>\n <pre data-testid={testId} className=\"text-sm leading-relaxed whitespace-pre-wrap text-doom-dim\">\n {children}\n </pre>\n </Panel>\n );\n}\n\n/**\n * The whole prompt, and the two things a figure alone would mislead about.\n *\n * The count overlaps the panel's own total, because the tool prose and skill\n * listings priced there are inside this text. And a session that has sent\n * nothing has no built prompt to show: assembling one would fire the hooks that\n * a real turn fires, so the pre-hook base is shown and named as such.\n */\nfunction PromptBody({ detail }: { detail: Extract<ContextItemDetail, { itemKind: 'prompt' }> }) {\n return (\n <div className=\"flex flex-col gap-3\">\n <div data-testid=\"context-item-cost\" className=\"flex flex-col gap-1\">\n <Row label=\"prompt\" value={tokens(detail.tokens)} strong />\n <p className=\"text-sm text-doom-dim\">\n counted apart from the panel total: the tool and skill prose priced there is part of this text\n </p>\n {detail.stage === 'base' ? (\n <p data-testid=\"context-item-stage\" className=\"text-sm text-doom-dim\">\n this session has sent nothing yet, so this is the prompt before packages add to it at the first message\n </p>\n ) : null}\n </div>\n <Section title=\"text\">\n <Pre testId=\"context-item-prompt\" tall>\n {detail.text}\n </Pre>\n </Section>\n </div>\n );\n}\n\n/** A tool is paid twice, so the split is the useful figure rather than the total. */\nfunction ToolCost({ detail }: { detail: Extract<ContextItemDetail, { itemKind: 'tool' }> }) {\n return (\n <div data-testid=\"context-item-cost\" className=\"flex flex-col gap-1\">\n <Row label=\"schema\" value={tokens(detail.tokens.schemaTokens)} />\n <Row label=\"system prompt\" value={tokens(detail.tokens.promptTokens)} />\n <Row label=\"total\" value={tokens(detail.tokens.totalTokens)} strong />\n {detail.active ? null : (\n <p className=\"text-sm text-doom-dim\">not sent to the model; costs nothing until switched on</p>\n )}\n </div>\n );\n}\n\nfunction SkillFacts({ detail }: { detail: Extract<ContextItemDetail, { itemKind: 'skill' }> }) {\n return (\n <div data-testid=\"context-item-cost\" className=\"flex flex-col gap-1\">\n <Row label=\"listing\" value={tokens(detail.tokens)} strong />\n {detail.filePath ? <Row label=\"file\" value={detail.filePath} /> : null}\n {detail.modelInvocable ? null : <p className=\"text-sm text-doom-dim\">not offered to the model</p>}\n </div>\n );\n}\n\nfunction Row({ label, value, strong = false }: { label: string; value: string; strong?: boolean }) {\n return (\n <div className=\"flex items-baseline justify-between gap-3\">\n <span className=\"text-sm text-doom-dim\">{label}</span>\n <span className={`truncate text-sm ${strong ? 'font-semibold text-doom-text' : 'text-doom-dim'}`}>{value}</span>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,SAAS,OAAO,OAAuB;CACrC,OAAO,IAAI,MAAM,eAAe;AAClC;AAeA,SAAgB,kBAAkB,EAAE,WAAW,QAAQ,UAAU,WAAmC;CAClG,MAAM,CAAC,QAAQ,aAAa,SAAmC,IAAI;CACnE,MAAM,CAAC,OAAO,YAAY,SAAwB,IAAI;CACtD,MAAM,WAAW,QAAQ,YAAY;CACrC,MAAM,OAAO,QAAQ,QAAQ;CAI7B,MAAM,UACJ,cAAc,QAAQ,aAAa,QAAQ,SAAS,OAAO,OAAO,GAAG,UAAU,QAAQ,SAAS,QAAQ;CAC1G,MAAM,CAAC,OAAO,YAAY,SAAwB,IAAI;CACtD,IAAI,UAAU,SAAS;EACrB,SAAS,OAAO;EAChB,UAAU,IAAI;EACd,SAAS,IAAI;CACf;CAEA,gBAAgB;EACd,IAAI,cAAc,QAAQ,aAAa,QAAQ,SAAS,MAAM;EAG9D,IAAI,OAAO;EACX,uBAA4B,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O,OAAO,OAAO,OAAO,YAAY;GAAI,CAAA;GACvE,oBAAC,KAAD;IAAK,OAAM;IAAQ,OAAO,OAAO,OAAO,OAAO,WAAW;IAAG,QAAA;GAAQ,CAAA;GACpE,OAAO,SAAS,OACf,oBAAC,KAAD;IAAG,WAAU;IAAwB,UAAA;GAAyD,CAAA;EAE7F;;AAET;AAEA,SAAS,WAAW,EAAE,UAAyE;CAC7F,OACE,qBAAC,OAAD;EAAK,eAAY;EAAoB,WAAU;EAA/C,UAAA;GACE,oBAAC,KAAD;IAAK,OAAM;IAAU,OAAO,OAAO,OAAO,MAAM;IAAG,QAAA;GAAQ,CAAA;GAC1D,OAAO,WAAW,oBAAC,KAAD;IAAK,OAAM;IAAO,OAAO,OAAO;GAAW,CAAA,IAAI;GACjE,OAAO,iBAAiB,OAAO,oBAAC,KAAD;IAAG,WAAU;IAAwB,UAAA;GAA2B,CAAA;EAC7F;;AAET;AAEA,SAAS,IAAI,EAAE,OAAO,OAAO,SAAS,SAA6D;CACjG,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,QAAD;GAAM,WAAU;GAAyB,UAAA;EAAY,CAAA,GACrD,oBAAC,QAAD;GAAM,WAAW,oBAAoB,SAAS,iCAAiC;GAAoB,UAAA;EAAY,CAAA,CAC5G;;AAET"}
1
+ {"version":3,"file":"ContextItemDialog.mjs","names":[],"sources":["../../../../src/web/features/activity/ContextItemDialog.tsx"],"sourcesContent":["import type { ContextItemDetail, ContextItemKind, ContextToolWarning } from '@agimon-ai/po-core/contextApi';\nimport {\n Dialog,\n DialogBody,\n DialogContent,\n DialogHeader,\n DialogTitle,\n Panel,\n Spinner,\n} from '@agimon-ai/po-web-components';\nimport { useEffect, useState } from 'react';\n\nimport { fetchContextItemDetail } from '../../lib/contextDetailApi';\n\n/**\n * What one row of the composition actually is.\n *\n * The panel answers \"what does this cost\"; a reader who clicks a row is asking\n * the follow-up, \"and what am I paying for\". That is the description the model\n * reads, the schema it is handed, and for a tool the split between the two,\n * because the two are cut differently: prose comes out with the package, a\n * schema only with the tool.\n *\n * Fetched on open rather than carried by the projection. The full text of every\n * tool in a composition is an order of magnitude larger than the figures, and\n * is wanted one row at a time.\n */\n\nfunction tokens(value: number): string {\n return `~${value.toLocaleString()}`;\n}\n\ninterface Target {\n itemKind: ContextItemKind;\n name: string;\n owner: string;\n}\n\nexport interface ContextItemDialogProps {\n sessionId: string | null;\n target: Target | null;\n warnings?: readonly ContextToolWarning[];\n onClose: () => void;\n}\n\nexport function ContextItemDialog({ sessionId, target, warnings, onClose }: ContextItemDialogProps) {\n const [detail, setDetail] = useState<ContextItemDetail | null>(null);\n const [error, setError] = useState<string | null>(null);\n const itemKind = target?.itemKind ?? null;\n const name = target?.name ?? null;\n\n // A second click must not show the first row's answer for a frame, so the\n // reset happens during render rather than in the effect that refetches.\n const request =\n sessionId === null || itemKind === null || name === null ? null : `${sessionId}\\u0000${itemKind}\\u0000${name}`;\n const [shown, setShown] = useState<string | null>(null);\n if (shown !== request) {\n setShown(request);\n setDetail(null);\n setError(null);\n }\n\n useEffect(() => {\n if (sessionId === null || itemKind === null || name === null) return;\n // A reply that lands after the reader moved on belongs to a row that is no\n // longer open, so it is dropped rather than painted.\n let live = true;\n void fetchContextItemDetail(sessionId, itemKind, name).then((result) => {\n if (!live) return;\n if (result.ok) setDetail(result.detail);\n else setError(result.error);\n });\n return () => {\n live = false;\n };\n }, [sessionId, itemKind, name]);\n\n if (target === null) return null;\n\n return (\n <Dialog\n open\n onOpenChange={(next) => {\n if (!next) onClose();\n }}\n >\n <DialogContent width=\"lg\" data-testid=\"context-item-dialog\" aria-describedby={undefined}>\n <DialogHeader>\n <DialogTitle data-testid=\"context-item-title\">\n {target.itemKind === 'prompt' ? 'system prompt' : target.name}\n </DialogTitle>\n <span className=\"text-sm text-po-dim\">\n {target.itemKind} · {target.owner}\n </span>\n </DialogHeader>\n <DialogBody>\n {target.itemKind === 'tool' && warnings && warnings.length > 0 ? (\n <Section title=\"warnings\">\n <ul data-testid=\"context-item-warnings\" aria-live=\"polite\" className=\"flex flex-col gap-3\">\n {warnings.map((warning, index) => (\n <li key={index} className=\"flex flex-col gap-1 text-sm break-words\">\n <span className=\"text-po-yellow\">{warning.source}</span>\n <span className=\"text-sm text-po-dim\">{warning.path}</span>\n <p className=\"text-po-text\">{warning.message}</p>\n </li>\n ))}\n </ul>\n </Section>\n ) : null}\n {error !== null ? (\n <p data-testid=\"context-item-error\" className=\"text-sm text-po-dim\">\n {error}\n </p>\n ) : detail === null ? (\n <p data-testid=\"context-item-loading\" className=\"flex items-center gap-2 text-sm text-po-dim\">\n <Spinner />\n reading the session's inventory\n </p>\n ) : (\n <ContextItemBody detail={detail} />\n )}\n </DialogBody>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction ContextItemBody({ detail }: { detail: ContextItemDetail }) {\n if (detail.itemKind === 'prompt') return <PromptBody detail={detail} />;\n return (\n <div className=\"flex flex-col gap-3\">\n {detail.itemKind === 'tool' ? <ToolCost detail={detail} /> : <SkillFacts detail={detail} />}\n\n {detail.itemKind === 'skill' || detail.description !== undefined ? (\n <Section title=\"description\">\n <p\n data-testid=\"context-item-description\"\n className=\"text-base leading-relaxed whitespace-pre-wrap text-po-text\"\n >\n {detail.description}\n </p>\n </Section>\n ) : null}\n\n {detail.itemKind === 'skill' && detail.body !== undefined ? (\n <Section title=\"body\">\n <Pre testId=\"context-item-body\">{detail.body}</Pre>\n </Section>\n ) : null}\n\n {detail.itemKind === 'tool' && detail.promptSnippet !== undefined ? (\n <Section title=\"prompt snippet\">\n <Pre testId=\"context-item-snippet\">{detail.promptSnippet}</Pre>\n </Section>\n ) : null}\n\n {detail.itemKind === 'tool' && detail.promptGuidelines !== undefined ? (\n <Section title=\"prompt guidelines\">\n <ul data-testid=\"context-item-guidelines\" className=\"flex flex-col gap-1\">\n {detail.promptGuidelines.map((line) => (\n <li key={line} className=\"text-sm leading-relaxed text-po-dim\">\n {line}\n </li>\n ))}\n </ul>\n </Section>\n ) : null}\n\n {detail.itemKind === 'tool' && detail.parameters !== undefined ? (\n <Section title=\"parameters\">\n <Pre testId=\"context-item-schema\">{JSON.stringify(detail.parameters, null, 2)}</Pre>\n </Section>\n ) : null}\n </div>\n );\n}\n\nfunction Section({ title, children }: { title: string; children: React.ReactNode }) {\n return (\n <div className=\"flex flex-col gap-1\">\n <span className=\"text-lg font-semibold text-po-hi\">{title}</span>\n {children}\n </div>\n );\n}\n\nfunction Pre({ testId, children, tall = false }: { testId: string; children: string; tall?: boolean }) {\n return (\n <Panel className={`overflow-auto bg-po-deep px-3 py-2 ${tall ? 'max-h-[60vh]' : 'max-h-64'}`}>\n <pre data-testid={testId} className=\"text-sm leading-relaxed whitespace-pre-wrap text-po-dim\">\n {children}\n </pre>\n </Panel>\n );\n}\n\n/**\n * The whole prompt, and the two things a figure alone would mislead about.\n *\n * The count overlaps the panel's own total, because the tool prose and skill\n * listings priced there are inside this text. And a session that has sent\n * nothing has no built prompt to show: assembling one would fire the hooks that\n * a real turn fires, so the pre-hook base is shown and named as such.\n */\nfunction PromptBody({ detail }: { detail: Extract<ContextItemDetail, { itemKind: 'prompt' }> }) {\n return (\n <div className=\"flex flex-col gap-3\">\n <div data-testid=\"context-item-cost\" className=\"flex flex-col gap-1\">\n <Row label=\"prompt\" value={tokens(detail.tokens)} strong />\n <p className=\"text-sm text-po-dim\">\n counted apart from the panel total: the tool and skill prose priced there is part of this text\n </p>\n {detail.stage === 'base' ? (\n <p data-testid=\"context-item-stage\" className=\"text-sm text-po-dim\">\n this session has sent nothing yet, so this is the prompt before packages add to it at the first message\n </p>\n ) : null}\n </div>\n <Section title=\"text\">\n <Pre testId=\"context-item-prompt\" tall>\n {detail.text}\n </Pre>\n </Section>\n </div>\n );\n}\n\n/** A tool is paid twice, so the split is the useful figure rather than the total. */\nfunction ToolCost({ detail }: { detail: Extract<ContextItemDetail, { itemKind: 'tool' }> }) {\n return (\n <div data-testid=\"context-item-cost\" className=\"flex flex-col gap-1\">\n <Row label=\"schema\" value={tokens(detail.tokens.schemaTokens)} />\n <Row label=\"system prompt\" value={tokens(detail.tokens.promptTokens)} />\n <Row label=\"total\" value={tokens(detail.tokens.totalTokens)} strong />\n {detail.active ? null : (\n <p className=\"text-sm text-po-dim\">not sent to the model; costs nothing until switched on</p>\n )}\n </div>\n );\n}\n\nfunction SkillFacts({ detail }: { detail: Extract<ContextItemDetail, { itemKind: 'skill' }> }) {\n return (\n <div data-testid=\"context-item-cost\" className=\"flex flex-col gap-1\">\n <Row label=\"listing\" value={tokens(detail.tokens)} strong />\n {detail.filePath ? <Row label=\"file\" value={detail.filePath} /> : null}\n {detail.modelInvocable ? null : <p className=\"text-sm text-po-dim\">not offered to the model</p>}\n </div>\n );\n}\n\nfunction Row({ label, value, strong = false }: { label: string; value: string; strong?: boolean }) {\n return (\n <div className=\"flex items-baseline justify-between gap-3\">\n <span className=\"text-sm text-po-dim\">{label}</span>\n <span className={`truncate text-sm ${strong ? 'font-semibold text-po-text' : 'text-po-dim'}`}>{value}</span>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,SAAS,OAAO,OAAuB;CACrC,OAAO,IAAI,MAAM,eAAe;AAClC;AAeA,SAAgB,kBAAkB,EAAE,WAAW,QAAQ,UAAU,WAAmC;CAClG,MAAM,CAAC,QAAQ,aAAa,SAAmC,IAAI;CACnE,MAAM,CAAC,OAAO,YAAY,SAAwB,IAAI;CACtD,MAAM,WAAW,QAAQ,YAAY;CACrC,MAAM,OAAO,QAAQ,QAAQ;CAI7B,MAAM,UACJ,cAAc,QAAQ,aAAa,QAAQ,SAAS,OAAO,OAAO,GAAG,UAAU,QAAQ,SAAS,QAAQ;CAC1G,MAAM,CAAC,OAAO,YAAY,SAAwB,IAAI;CACtD,IAAI,UAAU,SAAS;EACrB,SAAS,OAAO;EAChB,UAAU,IAAI;EACd,SAAS,IAAI;CACf;CAEA,gBAAgB;EACd,IAAI,cAAc,QAAQ,aAAa,QAAQ,SAAS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