@agent-native/core 0.103.1 → 0.104.0

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 (565) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +30 -0
  3. package/corpus/core/package.json +9 -2
  4. package/corpus/core/src/agent/engine/credential-errors.ts +2 -2
  5. package/corpus/core/src/agent/production-agent.ts +30 -0
  6. package/corpus/core/src/agent/run-store.ts +12 -2
  7. package/corpus/core/src/cli/create.ts +1 -0
  8. package/corpus/core/src/cli/skills-content/visual-plan-skill.ts +30 -11
  9. package/corpus/core/src/cli/templates-meta.ts +4 -3
  10. package/corpus/core/src/client/AgentAskPopover.tsx +89 -0
  11. package/corpus/core/src/client/AgentChatHome.tsx +4 -0
  12. package/corpus/core/src/client/AgentPanel.tsx +321 -223
  13. package/corpus/core/src/client/AssistantChat.tsx +6 -10
  14. package/corpus/core/src/client/MultiTabAssistantChat.tsx +53 -372
  15. package/corpus/core/src/client/agent-chat-adapter.ts +13 -1
  16. package/corpus/core/src/client/agent-page/AgentContextTab.tsx +133 -149
  17. package/corpus/core/src/client/agent-page/AgentEmptyState.tsx +44 -0
  18. package/corpus/core/src/client/agent-page/AgentJobsTab.tsx +153 -82
  19. package/corpus/core/src/client/agent-page/AgentTabFrame.tsx +39 -0
  20. package/corpus/core/src/client/agent-page/AgentTabsPage.tsx +368 -356
  21. package/corpus/core/src/client/agent-page/types.ts +1 -1
  22. package/corpus/core/src/client/analytics.ts +51 -5
  23. package/corpus/core/src/client/chat/run-recovery.tsx +12 -4
  24. package/corpus/core/src/client/composer/PromptComposer.tsx +5 -15
  25. package/corpus/core/src/client/composer/TiptapComposer.tsx +32 -3
  26. package/corpus/core/src/client/dynamic-suggestions.ts +3 -3
  27. package/corpus/core/src/client/index.ts +16 -1
  28. package/corpus/core/src/client/resources/ResourceTree.tsx +249 -38
  29. package/corpus/core/src/client/resources/ResourcesPanel.tsx +307 -140
  30. package/corpus/core/src/client/session-replay.ts +158 -5
  31. package/corpus/core/src/client/settings/AutomationsSection.tsx +30 -10
  32. package/corpus/core/src/client/settings/SettingsPanel.tsx +3 -2
  33. package/corpus/core/src/client/settings/SettingsTabsPage.tsx +2 -0
  34. package/corpus/core/src/client/settings/agent-settings-search.ts +2 -2
  35. package/corpus/core/src/client/use-chat-threads.ts +2 -0
  36. package/corpus/core/src/connections/catalog.ts +49 -7
  37. package/corpus/core/src/db/index.ts +6 -1
  38. package/corpus/core/src/extensions/actions.ts +106 -16
  39. package/corpus/core/src/extensions/content-patch.ts +22 -0
  40. package/corpus/core/src/extensions/routes.ts +18 -0
  41. package/corpus/core/src/extensions/store.ts +8 -0
  42. package/corpus/core/src/index.ts +3 -0
  43. package/corpus/core/src/ingestion/docx.ts +158 -0
  44. package/corpus/core/src/ingestion/figma-node-to-html.ts +1860 -0
  45. package/corpus/core/src/ingestion/figma.ts +548 -0
  46. package/corpus/core/src/ingestion/index.ts +107 -0
  47. package/corpus/core/src/ingestion/media.ts +264 -0
  48. package/corpus/core/src/ingestion/notion.ts +121 -0
  49. package/corpus/core/src/ingestion/office.ts +214 -0
  50. package/corpus/core/src/ingestion/orchestration.ts +160 -0
  51. package/corpus/core/src/ingestion/pptx.ts +333 -0
  52. package/corpus/core/src/ingestion/selection.ts +81 -0
  53. package/corpus/core/src/ingestion/website.ts +151 -0
  54. package/corpus/core/src/integrations/plugin.ts +45 -37
  55. package/corpus/core/src/localization/default-messages.ts +35 -12
  56. package/corpus/core/src/observability/hosted-model-experiment.ts +118 -0
  57. package/corpus/core/src/observability/traces.ts +5 -3
  58. package/corpus/core/src/provider-api/index.ts +452 -8
  59. package/corpus/core/src/scripts/agent-engines/list-agent-engines.ts +18 -1
  60. package/corpus/core/src/search-utils/index.ts +112 -0
  61. package/corpus/core/src/secrets/register-framework-secrets.ts +61 -0
  62. package/corpus/core/src/server/action-discovery.ts +33 -8
  63. package/corpus/core/src/server/agent-chat/framework-prompts.ts +2 -2
  64. package/corpus/core/src/server/agent-chat/prompt-resources.ts +144 -0
  65. package/corpus/core/src/server/agent-chat-plugin.ts +6 -0
  66. package/corpus/core/src/server/core-routes-plugin.ts +12 -0
  67. package/corpus/core/src/server/index.ts +30 -0
  68. package/corpus/core/src/server/workspace-provider-oauth.ts +583 -0
  69. package/corpus/core/src/styles/agent-native.css +9 -0
  70. package/corpus/core/src/templates/default/app/i18n/en-US.ts +3 -3
  71. package/corpus/core/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +14 -5
  72. package/corpus/core/src/templates/workspace-root/.env.example +12 -0
  73. package/corpus/core/src/workspace-connections/index.ts +6 -0
  74. package/corpus/core/src/workspace-connections/lifecycle.ts +43 -0
  75. package/corpus/core/src/workspace-connections/store.ts +16 -0
  76. package/corpus/templates/analytics/.agents/skills/dashboard-management/SKILL.md +46 -3
  77. package/corpus/templates/analytics/AGENTS.md +9 -0
  78. package/corpus/templates/analytics/actions/dashboard-mutation-api.ts +120 -6
  79. package/corpus/templates/analytics/actions/mutate-dashboard.ts +92 -30
  80. package/corpus/templates/analytics/actions/update-dashboard.ts +5 -5
  81. package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +313 -220
  82. package/corpus/templates/analytics/app/components/layout/CommandPalette.tsx +2 -2
  83. package/corpus/templates/analytics/app/components/layout/Layout.tsx +9 -6
  84. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +90 -64
  85. package/corpus/templates/analytics/app/i18n-data.ts +3 -3
  86. package/corpus/templates/analytics/app/lib/dashboard-list-loading.ts +25 -0
  87. package/corpus/templates/analytics/app/lib/item-popularity.ts +13 -4
  88. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/DashboardFilterBar.tsx +1 -1
  89. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/pivot.ts +8 -3
  90. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/types.ts +1 -0
  91. package/corpus/templates/analytics/app/pages/sessions/SessionDetailPage.tsx +15 -3
  92. package/corpus/templates/analytics/changelog/2026-07-16-dashboard-filter-defaults-can-now-be-changed-reliably-withou.md +6 -0
  93. package/corpus/templates/analytics/changelog/2026-07-16-dashboard-lists-load-in-one-stable-order-without-popping-bet.md +6 -0
  94. package/corpus/templates/analytics/changelog/2026-07-16-fixed-dashboard-filter-dropdown-text-alignment.md +6 -0
  95. package/corpus/templates/analytics/changelog/2026-07-16-recurring-signed-in-users-can-now-be-viewed-as-weekly-bars-b.md +6 -0
  96. package/corpus/templates/analytics/changelog/2026-07-16-the-analytics-agent-can-now-duplicate-a-chart-and-place-the-.md +6 -0
  97. package/corpus/templates/analytics/seeds/dashboards/agent-native-templates-first-party.json +41 -1
  98. package/corpus/templates/analytics/server/lib/dashboard-catalog.ts +1 -1
  99. package/corpus/templates/analytics/server/lib/first-party-metric-catalog.ts +47 -1
  100. package/corpus/templates/analytics/server/lib/session-replay.ts +68 -0
  101. package/corpus/templates/analytics/server/plugins/agent-chat.ts +1 -0
  102. package/corpus/templates/analytics/server/routes/sessions/lookup.get.ts +47 -0
  103. package/corpus/templates/assets/.agents/skills/asset-generation/SKILL.md +16 -9
  104. package/corpus/templates/assets/.agents/skills/creative-context/SKILL.md +86 -0
  105. package/corpus/templates/assets/AGENTS.md +10 -0
  106. package/corpus/templates/assets/actions/create-generation-session.ts +59 -1
  107. package/corpus/templates/assets/actions/edit-image.ts +2 -0
  108. package/corpus/templates/assets/actions/generate-asset.ts +52 -0
  109. package/corpus/templates/assets/actions/generate-image-batch.ts +55 -0
  110. package/corpus/templates/assets/actions/generate-image.ts +219 -1
  111. package/corpus/templates/assets/actions/open-asset-picker.ts +14 -0
  112. package/corpus/templates/assets/actions/refine-image.ts +3 -0
  113. package/corpus/templates/assets/actions/restyle-image.ts +2 -0
  114. package/corpus/templates/assets/agent-native.app-skill.json +4 -0
  115. package/corpus/templates/assets/app/components/layout/Layout.tsx +2 -0
  116. package/corpus/templates/assets/app/i18n/zh-TW.ts +3 -0
  117. package/corpus/templates/assets/app/i18n-data.ts +29 -13
  118. package/corpus/templates/assets/app/routes/agent.tsx +7 -1
  119. package/corpus/templates/assets/app/routes/library.tsx +9 -0
  120. package/corpus/templates/assets/app/routes/settings.tsx +3 -0
  121. package/corpus/templates/assets/changelog/2026-07-16-creative-context-library.md +6 -0
  122. package/corpus/templates/assets/package.json +1 -0
  123. package/corpus/templates/assets/server/lib/image-processing.ts +1 -22
  124. package/corpus/templates/assets/server/plugins/creative-context.ts +205 -0
  125. package/corpus/templates/brain/app/i18n-data.ts +3 -3
  126. package/corpus/templates/brain/app/lib/brain.ts +1 -1
  127. package/corpus/templates/brain/server/lib/search.ts +17 -67
  128. package/corpus/templates/calendar/app/i18n-data.ts +3 -3
  129. package/corpus/templates/calendar/app/pages/BookingLinksPage.tsx +19 -18
  130. package/corpus/templates/chat/app/i18n/en-US.ts +3 -3
  131. package/corpus/templates/chat/app/lib/agent-page.tsx +10 -1
  132. package/corpus/templates/clips/.agents/skills/meetings/SKILL.md +1 -1
  133. package/corpus/templates/clips/AGENTS.md +4 -0
  134. package/corpus/templates/clips/actions/cleanup-transcript.ts +35 -4
  135. package/corpus/templates/clips/actions/create-meeting.ts +6 -2
  136. package/corpus/templates/clips/actions/create-organization.ts +3 -2
  137. package/corpus/templates/clips/actions/create-recording.ts +4 -1
  138. package/corpus/templates/clips/actions/finalize-recording.ts +44 -7
  139. package/corpus/templates/clips/actions/import-loom-recording.ts +4 -1
  140. package/corpus/templates/clips/actions/lib/create-recording-schema.ts +2 -2
  141. package/corpus/templates/clips/actions/list-meetings.ts +23 -5
  142. package/corpus/templates/clips/actions/list-organization-state.ts +1 -1
  143. package/corpus/templates/clips/actions/remove-silences.ts +10 -1
  144. package/corpus/templates/clips/actions/request-transcript.ts +53 -11
  145. package/corpus/templates/clips/actions/search-recordings-utils.ts +7 -0
  146. package/corpus/templates/clips/actions/search-recordings.ts +5 -8
  147. package/corpus/templates/clips/actions/set-organization-branding.ts +2 -2
  148. package/corpus/templates/clips/actions/stitch-recordings.ts +10 -5
  149. package/corpus/templates/clips/actions/update-ai-request-status.ts +38 -0
  150. package/corpus/templates/clips/app/components/editor/editor-layout.tsx +3 -4
  151. package/corpus/templates/clips/app/components/editor/editor-selection.ts +19 -0
  152. package/corpus/templates/clips/app/components/editor/stitch-manager.tsx +10 -10
  153. package/corpus/templates/clips/app/components/library/bulk-action-toolbar.tsx +1 -2
  154. package/corpus/templates/clips/app/components/library/library-grid.tsx +101 -93
  155. package/corpus/templates/clips/app/components/player/video-player.tsx +11 -0
  156. package/corpus/templates/clips/app/components/workspace/branding-editor.tsx +53 -1
  157. package/corpus/templates/clips/app/i18n/ar-SA.ts +7 -1
  158. package/corpus/templates/clips/app/i18n/de-DE.ts +7 -1
  159. package/corpus/templates/clips/app/i18n/en-US.ts +10 -4
  160. package/corpus/templates/clips/app/i18n/es-ES.ts +7 -1
  161. package/corpus/templates/clips/app/i18n/fr-FR.ts +7 -1
  162. package/corpus/templates/clips/app/i18n/hi-IN.ts +7 -1
  163. package/corpus/templates/clips/app/i18n/ja-JP.ts +7 -1
  164. package/corpus/templates/clips/app/i18n/ko-KR.ts +7 -1
  165. package/corpus/templates/clips/app/i18n/pt-BR.ts +7 -1
  166. package/corpus/templates/clips/app/i18n/zh-CN.ts +6 -1
  167. package/corpus/templates/clips/app/i18n/zh-TW.ts +6 -1
  168. package/corpus/templates/clips/app/routes/_app.settings._index.tsx +5 -9
  169. package/corpus/templates/clips/app/routes/_app.settings.organization.tsx +6 -2
  170. package/corpus/templates/clips/app/routes/r.$recordingId.tsx +129 -27
  171. package/corpus/templates/clips/app/routes/record.tsx +23 -2
  172. package/corpus/templates/clips/app/routes/share.$shareId.tsx +6 -2
  173. package/corpus/templates/clips/changelog/2026-07-16-authorized-viewers-can-open-shared-private-clips-without-a-m.md +6 -0
  174. package/corpus/templates/clips/changelog/2026-07-16-camera-bubble-hover-controls-appear-above-the-face.md +6 -0
  175. package/corpus/templates/clips/changelog/2026-07-16-chrome-extension-recovers-stale-recorder-state.md +6 -0
  176. package/corpus/templates/clips/changelog/2026-07-16-clips-agent-chat-no-longer-shows-a-separate-workspace-header.md +6 -0
  177. package/corpus/templates/clips/changelog/2026-07-16-clips-search-now-matches-recording-content-without-requiring.md +6 -0
  178. package/corpus/templates/clips/changelog/2026-07-16-declined-meetings-no-longer-show-desktop-reminders.md +6 -0
  179. package/corpus/templates/clips/changelog/2026-07-16-failed-desktop-saves-now-show-their-local-recovery-copy.md +6 -0
  180. package/corpus/templates/clips/changelog/2026-07-16-long-desktop-clips-now-preserve-complete-playback-synced-aud.md +6 -0
  181. package/corpus/templates/clips/changelog/2026-07-16-long-recording-lists-keep-stitch-and-library-actions-visible.md +6 -0
  182. package/corpus/templates/clips/changelog/2026-07-16-organization-admins-can-choose-new-recording-visibility.md +6 -0
  183. package/corpus/templates/clips/changelog/2026-07-16-remove-silences-now-shows-queued-active-completed-and-failed.md +6 -0
  184. package/corpus/templates/clips/changelog/2026-07-16-settings-no-longer-repeats-the-builder-connection-status-in-.md +6 -0
  185. package/corpus/templates/clips/changelog/2026-07-16-transcripts-now-appear-from-native-browser-speech-sooner-wit.md +6 -0
  186. package/corpus/templates/clips/chrome-extension/public/manifest.json +1 -1
  187. package/corpus/templates/clips/chrome-extension/src/background.ts +73 -1
  188. package/corpus/templates/clips/chrome-extension/src/native-recording-state.ts +32 -0
  189. package/corpus/templates/clips/chrome-extension/src/native-transcription.ts +248 -0
  190. package/corpus/templates/clips/chrome-extension/src/offscreen.ts +106 -0
  191. package/corpus/templates/clips/desktop/src/app.tsx +66 -28
  192. package/corpus/templates/clips/desktop/src/lib/recorder.ts +335 -285
  193. package/corpus/templates/clips/desktop/src/lib/single-flight.ts +7 -0
  194. package/corpus/templates/clips/desktop/src/lib/upload-verification.ts +51 -0
  195. package/corpus/templates/clips/desktop/src/overlays/bubble.tsx +2 -2
  196. package/corpus/templates/clips/desktop/src/overlays/finalizing.tsx +10 -2
  197. package/corpus/templates/clips/desktop/src/styles.css +13 -11
  198. package/corpus/templates/clips/desktop/src-tauri/src/clips/mod.rs +8 -9
  199. package/corpus/templates/clips/desktop/src-tauri/src/meetings_watcher.rs +1 -0
  200. package/corpus/templates/clips/desktop/src-tauri/src/native_screen/custom_capture.rs +88 -13
  201. package/corpus/templates/clips/desktop/src-tauri/src/native_screen/live_upload.rs +13 -2
  202. package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +241 -6
  203. package/corpus/templates/clips/server/db/schema.ts +2 -2
  204. package/corpus/templates/clips/server/lib/builder-media-compression.ts +64 -67
  205. package/corpus/templates/clips/server/lib/calendar-event-classification.ts +19 -0
  206. package/corpus/templates/clips/server/lib/google-calendar-client.ts +1 -0
  207. package/corpus/templates/clips/server/lib/recordings.ts +40 -1
  208. package/corpus/templates/clips/server/plugins/agent-chat.ts +1 -0
  209. package/corpus/templates/clips/server/plugins/db.ts +2 -2
  210. package/corpus/templates/clips/server/routes/api/auth/google-calendar.get.ts +1 -1
  211. package/corpus/templates/clips/server/routes/api/public-recording.get.ts +14 -5
  212. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +51 -1
  213. package/corpus/templates/clips/server/routes/api/video/[recordingId].get.ts +1 -64
  214. package/corpus/templates/clips/shared/media-worker-contract.ts +32 -15
  215. package/corpus/templates/content/.agents/skills/content/SKILL.md +16 -0
  216. package/corpus/templates/content/.agents/skills/creative-context/SKILL.md +85 -0
  217. package/corpus/templates/content/.agents/skills/notion-integration/SKILL.md +8 -0
  218. package/corpus/templates/content/AGENTS.md +9 -0
  219. package/corpus/templates/content/actions/create-document.ts +94 -0
  220. package/corpus/templates/content/actions/edit-document.ts +144 -4
  221. package/corpus/templates/content/actions/update-document.ts +138 -0
  222. package/corpus/templates/content/agent-native.app-skill.json +4 -0
  223. package/corpus/templates/content/app/components/layout/Layout.tsx +2 -0
  224. package/corpus/templates/content/app/i18n/zh-TW.ts +3 -0
  225. package/corpus/templates/content/app/i18n-data.ts +13 -4
  226. package/corpus/templates/content/app/routes/_app.agent.tsx +2 -1
  227. package/corpus/templates/content/app/routes/_app.settings.tsx +3 -0
  228. package/corpus/templates/content/changelog/2026-07-16-creative-context-library.md +6 -0
  229. package/corpus/templates/content/package.json +1 -0
  230. package/corpus/templates/content/server/plugins/creative-context.ts +31 -0
  231. package/corpus/templates/design/.agents/skills/creative-context/SKILL.md +116 -0
  232. package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +16 -0
  233. package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +8 -0
  234. package/corpus/templates/design/AGENTS.md +6 -0
  235. package/corpus/templates/design/actions/clone-creative-context-design.ts +176 -0
  236. package/corpus/templates/design/actions/edit-design.ts +128 -0
  237. package/corpus/templates/design/actions/generate-design.ts +278 -14
  238. package/corpus/templates/design/actions/generate-screens.ts +42 -1
  239. package/corpus/templates/design/agent-native.app-skill.json +4 -0
  240. package/corpus/templates/design/app/components/layout/Layout.tsx +7 -3
  241. package/corpus/templates/design/app/i18n/zh-TW.ts +3 -0
  242. package/corpus/templates/design/app/i18n-data.ts +10 -4
  243. package/corpus/templates/design/app/routes/agent.tsx +2 -1
  244. package/corpus/templates/design/app/routes/settings.tsx +3 -0
  245. package/corpus/templates/design/changelog/2026-07-16-creative-context-library.md +6 -0
  246. package/corpus/templates/design/changelog/2026-07-16-design-agent-chat-no-longer-shows-a-separate-workspace-header.md +6 -0
  247. package/corpus/templates/design/package.json +1 -0
  248. package/corpus/templates/design/server/lib/figma-design-context.ts +5 -335
  249. package/corpus/templates/design/server/lib/figma-node-to-html.ts +1 -1859
  250. package/corpus/templates/design/server/lib/import-design-files.ts +6 -8
  251. package/corpus/templates/design/server/plugins/creative-context.ts +31 -0
  252. package/corpus/templates/design/shared/generation-session.ts +7 -0
  253. package/corpus/templates/dispatch/app/i18n-data.ts +3 -3
  254. package/corpus/templates/forms/app/i18n/en-US.ts +3 -3
  255. package/corpus/templates/macros/app/i18n/en-US.ts +3 -3
  256. package/corpus/templates/mail/app/components/email/EmailThread.tsx +35 -5
  257. package/corpus/templates/mail/app/i18n/en-US.ts +3 -3
  258. package/corpus/templates/mail/changelog/2026-07-16-mail-previews-now-expand-to-show-the-full-message-without-an.md +6 -0
  259. package/corpus/templates/plan/.agents/skills/visual-plan/SKILL.md +30 -11
  260. package/corpus/templates/plan/AGENTS.md +21 -1
  261. package/corpus/templates/plan/actions/get-visual-plan.ts +1 -1
  262. package/corpus/templates/plan/actions/patch-visual-plan-source.ts +161 -0
  263. package/corpus/templates/plan/actions/read-visual-plan-source.ts +1 -1
  264. package/corpus/templates/plan/actions/update-visual-plan.ts +126 -10
  265. package/corpus/templates/plan/app/hooks/use-plans.ts +2 -0
  266. package/corpus/templates/plan/app/i18n/en-US.ts +3 -3
  267. package/corpus/templates/plan/app/pages/PlansPage.tsx +65 -62
  268. package/corpus/templates/plan/changelog/2026-07-16-local-plan-previews-now-load-annotations-containing-html-lik.md +6 -0
  269. package/corpus/templates/plan/changelog/2026-07-16-plan-agents-now-prevent-stale-edits-from-overwriting-newer-p.md +6 -0
  270. package/corpus/templates/plan/server/plan-mdx.ts +75 -2
  271. package/corpus/templates/slides/.agents/skills/create-deck/SKILL.md +21 -4
  272. package/corpus/templates/slides/.agents/skills/creative-context/SKILL.md +122 -0
  273. package/corpus/templates/slides/.agents/skills/design-systems/SKILL.md +11 -0
  274. package/corpus/templates/slides/.agents/skills/slide-editing/SKILL.md +12 -3
  275. package/corpus/templates/slides/AGENTS.md +6 -0
  276. package/corpus/templates/slides/actions/add-slide.ts +230 -14
  277. package/corpus/templates/slides/actions/clone-context-slide.ts +302 -0
  278. package/corpus/templates/slides/actions/create-deck.ts +130 -0
  279. package/corpus/templates/slides/actions/extract-pdf.ts +6 -2
  280. package/corpus/templates/slides/actions/import-file.ts +5 -4
  281. package/corpus/templates/slides/actions/patch-deck.ts +200 -10
  282. package/corpus/templates/slides/actions/update-slide.ts +208 -15
  283. package/corpus/templates/slides/app/components/layout/Layout.tsx +2 -0
  284. package/corpus/templates/slides/app/components/visual-editor/CanvasCommentPins.tsx +16 -1
  285. package/corpus/templates/slides/app/i18n/ar-SA.ts +3 -0
  286. package/corpus/templates/slides/app/i18n/de-DE.ts +3 -0
  287. package/corpus/templates/slides/app/i18n/en-US.ts +6 -3
  288. package/corpus/templates/slides/app/i18n/es-ES.ts +3 -0
  289. package/corpus/templates/slides/app/i18n/fr-FR.ts +3 -0
  290. package/corpus/templates/slides/app/i18n/hi-IN.ts +3 -0
  291. package/corpus/templates/slides/app/i18n/ja-JP.ts +3 -0
  292. package/corpus/templates/slides/app/i18n/ko-KR.ts +3 -0
  293. package/corpus/templates/slides/app/i18n/pt-BR.ts +3 -0
  294. package/corpus/templates/slides/app/i18n/zh-CN.ts +3 -0
  295. package/corpus/templates/slides/app/i18n/zh-TW.ts +3 -0
  296. package/corpus/templates/slides/app/lib/validate-native-slide-html.ts +176 -0
  297. package/corpus/templates/slides/app/routes/agent.tsx +7 -1
  298. package/corpus/templates/slides/app/routes/settings.tsx +3 -0
  299. package/corpus/templates/slides/changelog/2026-07-16-creative-context-library.md +6 -0
  300. package/corpus/templates/slides/changelog/2026-07-16-google-slides-native-cloning.md +6 -0
  301. package/corpus/templates/slides/package.json +1 -0
  302. package/corpus/templates/slides/server/handlers/import/docx-parser.ts +4 -85
  303. package/corpus/templates/slides/server/handlers/import/pptx-parser.ts +7 -421
  304. package/corpus/templates/slides/server/plugins/creative-context.ts +166 -0
  305. package/dist/agent/engine/credential-errors.d.ts +1 -1
  306. package/dist/agent/engine/credential-errors.d.ts.map +1 -1
  307. package/dist/agent/engine/credential-errors.js +2 -2
  308. package/dist/agent/engine/credential-errors.js.map +1 -1
  309. package/dist/agent/production-agent.d.ts.map +1 -1
  310. package/dist/agent/production-agent.js +25 -0
  311. package/dist/agent/production-agent.js.map +1 -1
  312. package/dist/agent/run-store.d.ts.map +1 -1
  313. package/dist/agent/run-store.js +12 -2
  314. package/dist/agent/run-store.js.map +1 -1
  315. package/dist/cli/create.d.ts.map +1 -1
  316. package/dist/cli/create.js +1 -0
  317. package/dist/cli/create.js.map +1 -1
  318. package/dist/cli/skills-content/visual-plan-skill.d.ts +1 -1
  319. package/dist/cli/skills-content/visual-plan-skill.d.ts.map +1 -1
  320. package/dist/cli/skills-content/visual-plan-skill.js +30 -11
  321. package/dist/cli/skills-content/visual-plan-skill.js.map +1 -1
  322. package/dist/cli/templates-meta.d.ts.map +1 -1
  323. package/dist/cli/templates-meta.js +4 -3
  324. package/dist/cli/templates-meta.js.map +1 -1
  325. package/dist/client/AgentAskPopover.d.ts +11 -0
  326. package/dist/client/AgentAskPopover.d.ts.map +1 -0
  327. package/dist/client/AgentAskPopover.js +30 -0
  328. package/dist/client/AgentAskPopover.js.map +1 -0
  329. package/dist/client/AgentChatHome.d.ts +1 -1
  330. package/dist/client/AgentChatHome.d.ts.map +1 -1
  331. package/dist/client/AgentChatHome.js +2 -2
  332. package/dist/client/AgentChatHome.js.map +1 -1
  333. package/dist/client/AgentPanel.d.ts +9 -19
  334. package/dist/client/AgentPanel.d.ts.map +1 -1
  335. package/dist/client/AgentPanel.js +119 -80
  336. package/dist/client/AgentPanel.js.map +1 -1
  337. package/dist/client/AssistantChat.d.ts.map +1 -1
  338. package/dist/client/AssistantChat.js +4 -4
  339. package/dist/client/AssistantChat.js.map +1 -1
  340. package/dist/client/MultiTabAssistantChat.d.ts +3 -9
  341. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  342. package/dist/client/MultiTabAssistantChat.js +49 -189
  343. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  344. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  345. package/dist/client/agent-chat-adapter.js +12 -1
  346. package/dist/client/agent-chat-adapter.js.map +1 -1
  347. package/dist/client/agent-page/AgentContextTab.d.ts.map +1 -1
  348. package/dist/client/agent-page/AgentContextTab.js +26 -28
  349. package/dist/client/agent-page/AgentContextTab.js.map +1 -1
  350. package/dist/client/agent-page/AgentEmptyState.d.ts +13 -0
  351. package/dist/client/agent-page/AgentEmptyState.d.ts.map +1 -0
  352. package/dist/client/agent-page/AgentEmptyState.js +6 -0
  353. package/dist/client/agent-page/AgentEmptyState.js.map +1 -0
  354. package/dist/client/agent-page/AgentJobsTab.d.ts +1 -1
  355. package/dist/client/agent-page/AgentJobsTab.d.ts.map +1 -1
  356. package/dist/client/agent-page/AgentJobsTab.js +90 -58
  357. package/dist/client/agent-page/AgentJobsTab.js.map +1 -1
  358. package/dist/client/agent-page/AgentTabFrame.d.ts +12 -0
  359. package/dist/client/agent-page/AgentTabFrame.d.ts.map +1 -0
  360. package/dist/client/agent-page/AgentTabFrame.js +7 -0
  361. package/dist/client/agent-page/AgentTabFrame.js.map +1 -0
  362. package/dist/client/agent-page/AgentTabsPage.d.ts +9 -1
  363. package/dist/client/agent-page/AgentTabsPage.d.ts.map +1 -1
  364. package/dist/client/agent-page/AgentTabsPage.js +135 -99
  365. package/dist/client/agent-page/AgentTabsPage.js.map +1 -1
  366. package/dist/client/agent-page/types.d.ts +1 -1
  367. package/dist/client/agent-page/types.d.ts.map +1 -1
  368. package/dist/client/agent-page/types.js.map +1 -1
  369. package/dist/client/analytics.d.ts +10 -3
  370. package/dist/client/analytics.d.ts.map +1 -1
  371. package/dist/client/analytics.js +37 -2
  372. package/dist/client/analytics.js.map +1 -1
  373. package/dist/client/chat/run-recovery.d.ts.map +1 -1
  374. package/dist/client/chat/run-recovery.js +10 -3
  375. package/dist/client/chat/run-recovery.js.map +1 -1
  376. package/dist/client/composer/PromptComposer.d.ts.map +1 -1
  377. package/dist/client/composer/PromptComposer.js +2 -2
  378. package/dist/client/composer/PromptComposer.js.map +1 -1
  379. package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
  380. package/dist/client/composer/TiptapComposer.js +15 -3
  381. package/dist/client/composer/TiptapComposer.js.map +1 -1
  382. package/dist/client/dynamic-suggestions.js +3 -3
  383. package/dist/client/dynamic-suggestions.js.map +1 -1
  384. package/dist/client/index.d.ts +4 -3
  385. package/dist/client/index.d.ts.map +1 -1
  386. package/dist/client/index.js +3 -2
  387. package/dist/client/index.js.map +1 -1
  388. package/dist/client/resources/ResourceTree.d.ts +5 -1
  389. package/dist/client/resources/ResourceTree.d.ts.map +1 -1
  390. package/dist/client/resources/ResourceTree.js +74 -5
  391. package/dist/client/resources/ResourceTree.js.map +1 -1
  392. package/dist/client/resources/ResourcesPanel.d.ts +11 -2
  393. package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
  394. package/dist/client/resources/ResourcesPanel.js +105 -31
  395. package/dist/client/resources/ResourcesPanel.js.map +1 -1
  396. package/dist/client/session-replay.d.ts +28 -0
  397. package/dist/client/session-replay.d.ts.map +1 -1
  398. package/dist/client/session-replay.js +122 -8
  399. package/dist/client/session-replay.js.map +1 -1
  400. package/dist/client/settings/AutomationsSection.d.ts +3 -1
  401. package/dist/client/settings/AutomationsSection.d.ts.map +1 -1
  402. package/dist/client/settings/AutomationsSection.js +16 -6
  403. package/dist/client/settings/AutomationsSection.js.map +1 -1
  404. package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
  405. package/dist/client/settings/SettingsPanel.js +3 -3
  406. package/dist/client/settings/SettingsPanel.js.map +1 -1
  407. package/dist/client/settings/SettingsTabsPage.d.ts +2 -0
  408. package/dist/client/settings/SettingsTabsPage.d.ts.map +1 -1
  409. package/dist/client/settings/SettingsTabsPage.js.map +1 -1
  410. package/dist/client/settings/agent-settings-search.js +2 -2
  411. package/dist/client/settings/agent-settings-search.js.map +1 -1
  412. package/dist/client/use-chat-threads.d.ts +2 -0
  413. package/dist/client/use-chat-threads.d.ts.map +1 -1
  414. package/dist/client/use-chat-threads.js.map +1 -1
  415. package/dist/collab/routes.d.ts +1 -1
  416. package/dist/connections/catalog.d.ts +41 -7
  417. package/dist/connections/catalog.d.ts.map +1 -1
  418. package/dist/connections/catalog.js +40 -7
  419. package/dist/connections/catalog.js.map +1 -1
  420. package/dist/db/index.d.ts +2 -2
  421. package/dist/db/index.d.ts.map +1 -1
  422. package/dist/db/index.js +2 -2
  423. package/dist/db/index.js.map +1 -1
  424. package/dist/extensions/actions.d.ts.map +1 -1
  425. package/dist/extensions/actions.js +85 -15
  426. package/dist/extensions/actions.js.map +1 -1
  427. package/dist/extensions/content-patch.d.ts +4 -0
  428. package/dist/extensions/content-patch.d.ts.map +1 -1
  429. package/dist/extensions/content-patch.js +18 -0
  430. package/dist/extensions/content-patch.js.map +1 -1
  431. package/dist/extensions/routes.d.ts.map +1 -1
  432. package/dist/extensions/routes.js +14 -0
  433. package/dist/extensions/routes.js.map +1 -1
  434. package/dist/extensions/store.d.ts +1 -0
  435. package/dist/extensions/store.d.ts.map +1 -1
  436. package/dist/extensions/store.js +4 -1
  437. package/dist/extensions/store.js.map +1 -1
  438. package/dist/file-upload/actions/upload-image.d.ts +1 -1
  439. package/dist/index.d.ts +1 -1
  440. package/dist/index.d.ts.map +1 -1
  441. package/dist/index.js +1 -1
  442. package/dist/index.js.map +1 -1
  443. package/dist/ingestion/docx.d.ts +16 -0
  444. package/dist/ingestion/docx.d.ts.map +1 -0
  445. package/dist/ingestion/docx.js +129 -0
  446. package/dist/ingestion/docx.js.map +1 -0
  447. package/dist/ingestion/figma-node-to-html.d.ts +304 -0
  448. package/dist/ingestion/figma-node-to-html.d.ts.map +1 -0
  449. package/dist/ingestion/figma-node-to-html.js +1292 -0
  450. package/dist/ingestion/figma-node-to-html.js.map +1 -0
  451. package/dist/ingestion/figma.d.ts +115 -0
  452. package/dist/ingestion/figma.d.ts.map +1 -0
  453. package/dist/ingestion/figma.js +399 -0
  454. package/dist/ingestion/figma.js.map +1 -0
  455. package/dist/ingestion/index.d.ts +11 -0
  456. package/dist/ingestion/index.d.ts.map +1 -0
  457. package/dist/ingestion/index.js +11 -0
  458. package/dist/ingestion/index.js.map +1 -0
  459. package/dist/ingestion/media.d.ts +36 -0
  460. package/dist/ingestion/media.d.ts.map +1 -0
  461. package/dist/ingestion/media.js +178 -0
  462. package/dist/ingestion/media.js.map +1 -0
  463. package/dist/ingestion/notion.d.ts +12 -0
  464. package/dist/ingestion/notion.d.ts.map +1 -0
  465. package/dist/ingestion/notion.js +104 -0
  466. package/dist/ingestion/notion.js.map +1 -0
  467. package/dist/ingestion/office.d.ts +45 -0
  468. package/dist/ingestion/office.d.ts.map +1 -0
  469. package/dist/ingestion/office.js +141 -0
  470. package/dist/ingestion/office.js.map +1 -0
  471. package/dist/ingestion/orchestration.d.ts +52 -0
  472. package/dist/ingestion/orchestration.d.ts.map +1 -0
  473. package/dist/ingestion/orchestration.js +89 -0
  474. package/dist/ingestion/orchestration.js.map +1 -0
  475. package/dist/ingestion/pptx.d.ts +28 -0
  476. package/dist/ingestion/pptx.d.ts.map +1 -0
  477. package/dist/ingestion/pptx.js +255 -0
  478. package/dist/ingestion/pptx.js.map +1 -0
  479. package/dist/ingestion/selection.d.ts +20 -0
  480. package/dist/ingestion/selection.d.ts.map +1 -0
  481. package/dist/ingestion/selection.js +52 -0
  482. package/dist/ingestion/selection.js.map +1 -0
  483. package/dist/ingestion/website.d.ts +27 -0
  484. package/dist/ingestion/website.d.ts.map +1 -0
  485. package/dist/ingestion/website.js +100 -0
  486. package/dist/ingestion/website.js.map +1 -0
  487. package/dist/integrations/plugin.d.ts.map +1 -1
  488. package/dist/integrations/plugin.js +32 -27
  489. package/dist/integrations/plugin.js.map +1 -1
  490. package/dist/localization/default-messages.d.ts +22 -0
  491. package/dist/localization/default-messages.d.ts.map +1 -1
  492. package/dist/localization/default-messages.js +31 -9
  493. package/dist/localization/default-messages.js.map +1 -1
  494. package/dist/notifications/routes.d.ts +1 -1
  495. package/dist/observability/hosted-model-experiment.d.ts +39 -0
  496. package/dist/observability/hosted-model-experiment.d.ts.map +1 -0
  497. package/dist/observability/hosted-model-experiment.js +90 -0
  498. package/dist/observability/hosted-model-experiment.js.map +1 -0
  499. package/dist/observability/traces.d.ts.map +1 -1
  500. package/dist/observability/traces.js +5 -3
  501. package/dist/observability/traces.js.map +1 -1
  502. package/dist/progress/routes.d.ts +1 -1
  503. package/dist/provider-api/index.d.ts +35 -4
  504. package/dist/provider-api/index.d.ts.map +1 -1
  505. package/dist/provider-api/index.js +339 -8
  506. package/dist/provider-api/index.js.map +1 -1
  507. package/dist/scripts/agent-engines/list-agent-engines.d.ts.map +1 -1
  508. package/dist/scripts/agent-engines/list-agent-engines.js +18 -1
  509. package/dist/scripts/agent-engines/list-agent-engines.js.map +1 -1
  510. package/dist/search-utils/index.d.ts +12 -0
  511. package/dist/search-utils/index.d.ts.map +1 -0
  512. package/dist/search-utils/index.js +95 -0
  513. package/dist/search-utils/index.js.map +1 -0
  514. package/dist/secrets/register-framework-secrets.d.ts.map +1 -1
  515. package/dist/secrets/register-framework-secrets.js +57 -0
  516. package/dist/secrets/register-framework-secrets.js.map +1 -1
  517. package/dist/server/action-discovery.d.ts +8 -0
  518. package/dist/server/action-discovery.d.ts.map +1 -1
  519. package/dist/server/action-discovery.js +26 -9
  520. package/dist/server/action-discovery.js.map +1 -1
  521. package/dist/server/agent-chat/framework-prompts.js +2 -2
  522. package/dist/server/agent-chat/framework-prompts.js.map +1 -1
  523. package/dist/server/agent-chat/prompt-resources.d.ts +19 -0
  524. package/dist/server/agent-chat/prompt-resources.d.ts.map +1 -1
  525. package/dist/server/agent-chat/prompt-resources.js +95 -0
  526. package/dist/server/agent-chat/prompt-resources.js.map +1 -1
  527. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  528. package/dist/server/agent-chat-plugin.js +7 -0
  529. package/dist/server/agent-chat-plugin.js.map +1 -1
  530. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  531. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  532. package/dist/server/core-routes-plugin.js +5 -0
  533. package/dist/server/core-routes-plugin.js.map +1 -1
  534. package/dist/server/index.d.ts +5 -1
  535. package/dist/server/index.d.ts.map +1 -1
  536. package/dist/server/index.js +5 -1
  537. package/dist/server/index.js.map +1 -1
  538. package/dist/server/workspace-provider-oauth.d.ts +48 -0
  539. package/dist/server/workspace-provider-oauth.d.ts.map +1 -0
  540. package/dist/server/workspace-provider-oauth.js +415 -0
  541. package/dist/server/workspace-provider-oauth.js.map +1 -0
  542. package/dist/styles/agent-native.css +9 -0
  543. package/dist/templates/chat/app/i18n/en-US.ts +3 -3
  544. package/dist/templates/chat/app/lib/agent-page.tsx +10 -1
  545. package/dist/templates/default/app/i18n/en-US.ts +3 -3
  546. package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +14 -5
  547. package/dist/templates/workspace-root/.env.example +12 -0
  548. package/dist/workspace-connections/index.d.ts +1 -0
  549. package/dist/workspace-connections/index.d.ts.map +1 -1
  550. package/dist/workspace-connections/index.js +1 -0
  551. package/dist/workspace-connections/index.js.map +1 -1
  552. package/dist/workspace-connections/lifecycle.d.ts +16 -0
  553. package/dist/workspace-connections/lifecycle.d.ts.map +1 -0
  554. package/dist/workspace-connections/lifecycle.js +14 -0
  555. package/dist/workspace-connections/lifecycle.js.map +1 -0
  556. package/dist/workspace-connections/store.d.ts.map +1 -1
  557. package/dist/workspace-connections/store.js +16 -0
  558. package/dist/workspace-connections/store.js.map +1 -1
  559. package/package.json +10 -3
  560. package/src/templates/chat/app/i18n/en-US.ts +3 -3
  561. package/src/templates/chat/app/lib/agent-page.spec.tsx +10 -1
  562. package/src/templates/chat/app/lib/agent-page.tsx +10 -1
  563. package/src/templates/default/app/i18n/en-US.ts +3 -3
  564. package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +14 -5
  565. package/src/templates/workspace-root/.env.example +12 -0
@@ -1 +1 @@
1
- {"version":3,"file":"AgentContextTab.d.ts","sourceRoot":"","sources":["../../../src/client/agent-page/AgentContextTab.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AASpD,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,iBAAiB,EAAE,GAC3B,iBAAiB,GAAG,SAAS,CAM/B;AAkRD,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,iBAAiB,+BA4L3D"}
1
+ {"version":3,"file":"AgentContextTab.d.ts","sourceRoot":"","sources":["../../../src/client/agent-page/AgentContextTab.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AASpD,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,iBAAiB,EAAE,GAC3B,iBAAiB,GAAG,SAAS,CAM/B;AAkRD,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,iBAAiB,+BA2K3D"}
@@ -9,6 +9,7 @@ import { useT } from "../i18n.js";
9
9
  import { useActionQuery } from "../use-action.js";
10
10
  import { useChatThreads } from "../use-chat-threads.js";
11
11
  import { cn } from "../utils.js";
12
+ import { AgentTabFrame } from "./AgentTabFrame.js";
12
13
  export function mostRecentlyUpdatedThread(threads) {
13
14
  return threads.reduce((latest, thread) => !latest || thread.updatedAt > latest.updatedAt ? thread : latest, undefined);
14
15
  }
@@ -143,7 +144,7 @@ function SystemSectionList({ sections, totalTokens, }) {
143
144
  }, [sections]);
144
145
  return (_jsxs("div", { className: "space-y-4", children: [grouped.map((group) => {
145
146
  const tokens = group.items.reduce((sum, item) => sum + item.tokenCount, 0);
146
- return (_jsxs("section", { children: [_jsxs("div", { className: "mb-1 flex items-center justify-between gap-3", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx("span", { className: "size-2 rounded-full bg-indigo-500" }), _jsx("h3", { className: "truncate text-sm font-medium", children: provenanceLabel(group.provenance, t) }), _jsx("span", { className: "text-[11px] text-muted-foreground", children: governanceLabel(group.items[0]?.governance ?? "inherited", t) })] }), _jsxs("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: [formatTokens(tokens), " \u00B7", " ", totalTokens > 0 ? Math.round((tokens / totalTokens) * 100) : 0, "%"] })] }), _jsx("div", { className: "divide-y divide-border/60 rounded-md border border-border/60", children: group.items
147
+ return (_jsxs("section", { children: [_jsxs("div", { className: "mb-1 flex items-center justify-between gap-3", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx("span", { className: "size-2 rounded-full bg-indigo-500" }), _jsx("h3", { className: "truncate text-sm font-medium", children: provenanceLabel(group.provenance, t) }), _jsx("span", { className: "text-[11px] text-muted-foreground", children: governanceLabel(group.items[0]?.governance ?? "inherited", t) })] }), _jsxs("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: [formatTokens(tokens), " \u00B7", " ", totalTokens > 0 ? Math.round((tokens / totalTokens) * 100) : 0, "%"] })] }), _jsx("div", { className: "divide-y divide-border/60 border-y border-border/60", children: group.items
147
148
  .slice()
148
149
  .sort((a, b) => b.tokenCount - a.tokenCount)
149
150
  .map((section) => (_jsxs("div", { className: "flex gap-3 px-3 py-2.5", children: [_jsx(IconLock, { className: "mt-0.5 size-4 shrink-0 text-muted-foreground" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex items-baseline justify-between gap-3", children: [_jsx("div", { className: "truncate text-sm font-medium", children: section.label }), _jsxs("div", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: [formatTokens(section.tokenCount), " \u00B7", " ", totalTokens > 0
@@ -168,35 +169,32 @@ export function AgentContextTab({ scope }) {
168
169
  const preview = previewQuery.data;
169
170
  const previewManifest = preview ? previewAsManifest(preview) : null;
170
171
  const budget = resolveContextWindow(preview?.model);
171
- const title = t("contextXray.pageTitle", { defaultValue: "Context" });
172
- return (_jsxs("div", { className: "mx-auto flex w-full max-w-5xl flex-col gap-8 p-6 lg:p-10", children: [_jsxs("header", { className: "space-y-3", children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-4", children: [_jsxs("div", { children: [_jsx("p", { className: "text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground", children: t("contextXray.agent", { defaultValue: "Agent" }) }), _jsx("h1", { className: "text-2xl font-semibold tracking-tight", children: title }), _jsx("p", { className: "mt-1 max-w-2xl text-sm text-muted-foreground", children: t("contextXray.headerDescription", {
173
- defaultValue: "See the system instructions and conversation tokens that shape the agent.",
174
- }) })] }), previewManifest ? (_jsx(ContextMeter, { manifest: previewManifest, enabled: true })) : null] }), previewManifest ? (_jsx(ContextSplitMeter, { manifest: previewManifest, budget: budget })) : null] }), _jsxs("section", { className: "space-y-4", children: [_jsxs("div", { className: "flex flex-wrap items-end justify-between gap-3", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-lg font-semibold", children: t("contextXray.whatAgentKnows", {
175
- defaultValue: "What the agent knows",
176
- }) }), _jsx("p", { className: "text-sm text-muted-foreground", children: t("contextXray.orderedSystemDescription", {
177
- defaultValue: "Ordered system context is grouped by where it comes from. System sections are visible here but cannot be evicted from a thread.",
178
- }) })] }), _jsxs("div", { className: "inline-flex rounded-md bg-muted/50 p-0.5", children: [_jsxs("button", { type: "button", onClick: () => setView("list"), className: cn("flex cursor-pointer items-center gap-1.5 rounded px-2.5 py-1.5 text-xs", view === "list"
172
+ const title = t("contextXray.pageTitle", { defaultValue: "Snapshots" });
173
+ const description = t("contextXray.headerDescription", {
174
+ defaultValue: "Inspect the latest combined snapshot of what the agent loaded and why.",
175
+ });
176
+ return (_jsx(AgentTabFrame, { title: title, description: description, actions: previewManifest ? (_jsx(ContextMeter, { manifest: previewManifest, enabled: true })) : null, children: _jsxs("div", { className: "space-y-7", children: [previewManifest ? (_jsx(ContextSplitMeter, { manifest: previewManifest, budget: budget })) : null, _jsxs("section", { className: "space-y-4", children: [_jsx("div", { className: "flex justify-end", children: _jsxs("div", { className: "inline-flex rounded-md bg-muted/50 p-0.5", children: [_jsxs("button", { type: "button", onClick: () => setView("list"), className: cn("flex cursor-pointer items-center gap-1.5 rounded px-2.5 py-1.5 text-xs", view === "list"
179
177
  ? "bg-background text-foreground shadow-sm"
180
178
  : "text-muted-foreground"), children: [_jsx(IconList, { className: "size-3.5" }), t("contextXray.list", { defaultValue: "List" })] }), _jsxs("button", { type: "button", onClick: () => setView("map"), className: cn("flex cursor-pointer items-center gap-1.5 rounded px-2.5 py-1.5 text-xs", view === "map"
181
179
  ? "bg-background text-foreground shadow-sm"
182
- : "text-muted-foreground"), children: [_jsx(IconChartTreemap, { className: "size-3.5" }), t("contextXray.treemap", { defaultValue: "Treemap" })] })] })] }), previewQuery.isLoading ? (_jsx("div", { className: "rounded-md border border-border/60 p-8 text-center text-sm text-muted-foreground", children: t("contextXray.loadingPreview", {
183
- defaultValue: "Loading context preview…",
184
- }) })) : previewQuery.error ? (_jsx("div", { className: "rounded-md border border-dashed border-border p-8 text-center text-sm text-muted-foreground", children: t("contextXray.previewUnavailable", {
185
- defaultValue: "Context preview is not available yet.",
186
- }) })) : previewManifest ? (view === "map" ? (_jsx(ContextTreemap, { segments: [], systemSections: previewManifest.systemSections })) : (_jsx(SystemSectionList, { sections: previewManifest.systemSections ?? [], totalTokens: previewManifest.totalTokens }))) : (_jsx("div", { className: "rounded-md border border-dashed border-border p-8 text-center text-sm text-muted-foreground", children: t("contextXray.noPreview", {
187
- defaultValue: "No context preview is available for this scope yet.",
188
- }) }))] }), _jsxs("section", { className: "space-y-3", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-lg font-semibold", children: t("contextXray.liveThread", { defaultValue: "Live thread" }) }), _jsx("p", { className: "text-sm text-muted-foreground", children: t("contextXray.liveThreadDescription", {
189
- defaultValue: "The latest thread snapshot, when one exists. This is a single current snapshot, not an append-only history.",
190
- }) })] }), latestThread && liveManifestQuery.data ? (_jsxs("div", { className: "space-y-3 rounded-md border border-border/60 p-4", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate text-sm font-medium", children: latestThread.title ||
191
- latestThread.preview ||
192
- t("contextXray.latestThread", {
193
- defaultValue: "Latest thread",
194
- }) }), _jsxs("div", { className: "text-xs text-muted-foreground", children: [formatTokens(liveManifestQuery.data.totalTokens), " tokens \u00B7", " ", latestThread.id] })] }), _jsx(ContextMeter, { threadId: latestThread.id })] }), _jsx(ContextTreemap, { segments: liveManifestQuery.data.segments, systemSections: liveManifestQuery.data.systemSections })] })) : (_jsx("div", { className: "rounded-md border border-dashed border-border p-8 text-center text-sm text-muted-foreground", children: t("contextXray.noLiveThread", {
195
- defaultValue: "No live thread snapshot is available yet.",
196
- }) }))] }), _jsxs("section", { className: "flex gap-3 rounded-md border border-border/60 bg-muted/20 p-4", children: [_jsx(IconInfoCircle, { className: "mt-0.5 size-4 shrink-0 text-muted-foreground" }), _jsxs("div", { className: "space-y-1 text-sm text-muted-foreground", children: [_jsx("p", { className: "font-medium text-foreground", children: t("contextXray.orderedTokensTitle", {
197
- defaultValue: "Context is ordered tokens, not weighted tokens.",
198
- }) }), _jsx("p", { children: t("contextXray.orderedTokensDescription", {
199
- defaultValue: "Required framework and enterprise policy come first, followed by inherited template, workspace, and organization instructions. Personal instructions and memory arrive later and can narrow or override earlier guidance where the prompt permits. These system sections are not evictable; only run-local conversation segments support pin, evict, and restore.",
200
- }) })] })] })] }));
180
+ : "text-muted-foreground"), children: [_jsx(IconChartTreemap, { className: "size-3.5" }), t("contextXray.treemap", { defaultValue: "Treemap" })] })] }) }), previewQuery.isLoading ? (_jsx("div", { className: "rounded-md border border-border/60 p-8 text-center text-sm text-muted-foreground", children: t("contextXray.loadingPreview", {
181
+ defaultValue: "Loading recent snapshot…",
182
+ }) })) : previewQuery.error ? (_jsx("div", { className: "rounded-md border border-dashed border-border p-8 text-center text-sm text-muted-foreground", children: t("contextXray.previewUnavailable", {
183
+ defaultValue: "A recent snapshot is not available yet.",
184
+ }) })) : previewManifest ? (view === "map" ? (_jsx(ContextTreemap, { segments: [], systemSections: previewManifest.systemSections })) : (_jsx(SystemSectionList, { sections: previewManifest.systemSections ?? [], totalTokens: previewManifest.totalTokens }))) : (_jsx("div", { className: "rounded-md border border-dashed border-border p-8 text-center text-sm text-muted-foreground", children: t("contextXray.noPreview", {
185
+ defaultValue: "No recent snapshot is available for this scope yet.",
186
+ }) }))] }), _jsxs("section", { className: "space-y-3", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-lg font-semibold", children: t("contextXray.liveThread", { defaultValue: "Live thread" }) }), _jsx("p", { className: "text-sm text-muted-foreground", children: t("contextXray.liveThreadDescription", {
187
+ defaultValue: "The latest thread snapshot, when one exists. This is a single current snapshot, not an append-only history.",
188
+ }) })] }), latestThread && liveManifestQuery.data ? (_jsxs("div", { className: "space-y-3 border-y border-border/60 py-4", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate text-sm font-medium", children: latestThread.title ||
189
+ latestThread.preview ||
190
+ t("contextXray.latestThread", {
191
+ defaultValue: "Latest thread",
192
+ }) }), _jsxs("div", { className: "text-xs text-muted-foreground", children: [formatTokens(liveManifestQuery.data.totalTokens), " tokens \u00B7", " ", latestThread.id] })] }), _jsx(ContextMeter, { threadId: latestThread.id })] }), _jsx(ContextTreemap, { segments: liveManifestQuery.data.segments, systemSections: liveManifestQuery.data.systemSections })] })) : (_jsx("div", { className: "rounded-md border border-dashed border-border p-8 text-center text-sm text-muted-foreground", children: t("contextXray.noLiveThread", {
193
+ defaultValue: "No live thread snapshot is available yet.",
194
+ }) }))] }), _jsxs("section", { className: "flex gap-3 border-t border-border/70 pt-5", children: [_jsx(IconInfoCircle, { className: "mt-0.5 size-4 shrink-0 text-muted-foreground" }), _jsxs("div", { className: "space-y-1 text-sm text-muted-foreground", children: [_jsx("p", { className: "font-medium text-foreground", children: t("contextXray.orderedTokensTitle", {
195
+ defaultValue: "Snapshots show ordered tokens, not weighted tokens.",
196
+ }) }), _jsx("p", { children: t("contextXray.orderedTokensDescription", {
197
+ defaultValue: "Required framework and enterprise policy come first, followed by inherited template, workspace, and organization instructions. Personal instructions and memory arrive later and can narrow or override earlier guidance where the prompt permits. These system sections are not evictable; only run-local conversation segments support pin, evict, and restore.",
198
+ }) })] })] })] }) }));
201
199
  }
202
200
  //# sourceMappingURL=AgentContextTab.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentContextTab.js","sourceRoot":"","sources":["../../../src/client/agent-page/AgentContextTab.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAO1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAA0B,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAUjC,MAAM,UAAU,yBAAyB,CACvC,OAA4B;IAE5B,OAAO,OAAO,CAAC,MAAM,CACnB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CACjB,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAClE,SAAS,CACV,CAAC;AACJ,CAAC;AAED,MAAM,gBAAgB,GAAG;IACvB,gBAAgB;IAChB,gBAAgB;IAChB,2BAA2B;IAC3B,UAAU;IACV,eAAe;IACf,oBAAoB;IACpB,cAAc;IACd,UAAU;IACV,QAAQ;IACR,WAAW;IACX,OAAO;IACP,eAAe;IACf,iBAAiB;CACT,CAAC;AAIX,SAAS,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CAAC,QAAQ,EACzC,cAAc,EAAE,iBAAiB,CAAC,IAAI,CAAC,cAAc,GACrD,IACE,CACP,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,6FAA6F,YACzG,CAAC,CAAC,0BAA0B,EAAE;4BAC7B,YAAY,EAAE,2CAA2C;yBAC1D,CAAC,GACE,CACP,IACO,EAEV,mBAAS,SAAS,EAAC,+DAA+D,aAChF,KAAC,cAAc,IAAC,SAAS,EAAC,8CAA8C,GAAG,EAC3E,eAAK,SAAS,EAAC,yCAAyC,aACtD,YAAG,SAAS,EAAC,6BAA6B,YACvC,CAAC,CAAC,gCAAgC,EAAE;oCACnC,YAAY,EAAE,iDAAiD;iCAChE,CAAC,GACA,EACJ,sBACG,CAAC,CAAC,sCAAsC,EAAE;oCACzC,YAAY,EACV,mWAAmW;iCACtW,CAAC,GACA,IACA,IACE,IACN,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n IconChartTreemap,\n IconInfoCircle,\n IconList,\n IconLock,\n} from \"@tabler/icons-react\";\nimport { useMemo, useState } from \"react\";\n\nimport type {\n ContextManifest,\n ContextManifestSystemSection,\n ContextPreview,\n} from \"../../shared/context-xray.js\";\nimport { manifestConversationTokens } from \"../../shared/context-xray.js\";\nimport { ContextMeter } from \"../context-xray/ContextMeter.js\";\nimport { ContextTreemap } from \"../context-xray/ContextTreemap.js\";\nimport { formatTokens, resolveContextWindow } from \"../context-xray/format.js\";\nimport { useT } from \"../i18n.js\";\nimport { useActionQuery } from \"../use-action.js\";\nimport { useChatThreads, type ChatThreadSummary } from \"../use-chat-threads.js\";\nimport { cn } from \"../utils.js\";\nimport type { AgentPageTabProps } from \"./types.js\";\n\ntype PreviewQuery = {\n data?: ContextPreview;\n isLoading?: boolean;\n error?: unknown;\n};\ntype ManifestQuery = { data?: ContextManifest; isLoading?: boolean };\n\nexport function mostRecentlyUpdatedThread(\n threads: ChatThreadSummary[],\n): ChatThreadSummary | undefined {\n return threads.reduce<ChatThreadSummary | undefined>(\n (latest, thread) =>\n !latest || thread.updatedAt > latest.updatedAt ? thread : latest,\n undefined,\n );\n}\n\nconst PROVENANCE_ORDER = [\n \"framework-core\",\n \"actions-prompt\",\n \"enterprise-workspace-core\",\n \"template\",\n \"sql-workspace\",\n \"legacy-app-default\",\n \"organization\",\n \"personal\",\n \"memory\",\n \"db-schema\",\n \"tools\",\n \"model-overlay\",\n \"runtime-context\",\n] as const;\n\ntype Translate = (key: string, options?: Record<string, unknown>) => string;\n\nfunction provenanceLabel(\n provenance: ContextManifestSystemSection[\"provenance\"],\n t: Translate,\n): string {\n switch (provenance) {\n case \"framework-core\":\n return t(\"contextXray.provenance.frameworkCore\", {\n defaultValue: \"Framework\",\n });\n case \"actions-prompt\":\n return t(\"contextXray.provenance.actionsPrompt\", {\n defaultValue: \"Actions\",\n });\n case \"template\":\n return t(\"contextXray.provenance.template\", {\n defaultValue: \"Template\",\n });\n case \"enterprise-workspace-core\":\n return t(\"contextXray.provenance.enterpriseWorkspaceCore\", {\n defaultValue: \"Enterprise workspace core\",\n });\n case \"sql-workspace\":\n return t(\"contextXray.provenance.sqlWorkspace\", {\n defaultValue: \"Workspace\",\n });\n case \"legacy-app-default\":\n return t(\"contextXray.provenance.legacyAppDefault\", {\n defaultValue: \"App defaults\",\n });\n case \"organization\":\n return t(\"contextXray.provenance.organization\", {\n defaultValue: \"Organization\",\n });\n case \"personal\":\n return t(\"contextXray.provenance.personal\", {\n defaultValue: \"Personal\",\n });\n case \"memory\":\n return t(\"contextXray.provenance.memory\", {\n defaultValue: \"Memory\",\n });\n case \"db-schema\":\n return t(\"contextXray.provenance.dbSchema\", {\n defaultValue: \"SQL schema\",\n });\n case \"tools\":\n return t(\"contextXray.provenance.tools\", { defaultValue: \"Tools\" });\n case \"model-overlay\":\n return t(\"contextXray.provenance.modelOverlay\", {\n defaultValue: \"Model overlay\",\n });\n case \"runtime-context\":\n return t(\"contextXray.provenance.runtimeContext\", {\n defaultValue: \"Runtime context\",\n });\n }\n}\n\nfunction governanceLabel(\n governance: ContextManifestSystemSection[\"governance\"],\n t: Translate,\n): string {\n switch (governance) {\n case \"required\":\n return t(\"contextXray.governance.required\", {\n defaultValue: \"Required\",\n });\n case \"inherited\":\n return t(\"contextXray.governance.inherited\", {\n defaultValue: \"Inherited\",\n });\n case \"user\":\n return t(\"contextXray.governance.user\", {\n defaultValue: \"Your context\",\n });\n }\n}\n\nfunction sourceLabel(section: ContextManifestSystemSection): string {\n return (\n section.sourceRef?.path ??\n section.sourceRef?.resourceId ??\n section.sourceRef?.scope ??\n \"framework\"\n );\n}\n\nfunction previewAsManifest(preview: ContextPreview): ContextManifest {\n return {\n threadId: \"context-preview\",\n computedAt: preview.computedAt,\n ...(preview.model ? { model: preview.model } : {}),\n totalTokens: preview.totalTokens,\n rawTokens: preview.totalTokens,\n reclaimedTokens: 0,\n tokenCountMethod: preview.tokenCountMethod,\n conversationTokens: 0,\n systemTokens: preview.systemTokens,\n source: \"preview\",\n enforceable: false,\n segments: [],\n systemSections: preview.sections,\n };\n}\n\nfunction ContextSplitMeter({\n manifest,\n budget,\n}: {\n manifest: ContextManifest;\n budget: number;\n}) {\n const t = useT();\n const systemTokens = manifest.systemTokens ?? 0;\n const conversationTokens = manifestConversationTokens(manifest);\n const total = Math.max(1, systemTokens + conversationTokens);\n return (\n <div className=\"space-y-2\">\n <div className=\"flex h-2 overflow-hidden rounded-full bg-muted\">\n <div\n className=\"bg-slate-700 dark:bg-slate-400\"\n style={{ width: `${(systemTokens / total) * 100}%` }}\n />\n <div\n className=\"bg-sky-500\"\n style={{ width: `${(conversationTokens / total) * 100}%` }}\n />\n </div>\n <div className=\"flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground\">\n <span>\n <span className=\"mr-1.5 inline-block size-2 rounded-full bg-slate-700 dark:bg-slate-400\" />\n {t(\"contextXray.system\", { defaultValue: \"System\" })}{\" \"}\n {formatTokens(systemTokens)}\n </span>\n <span>\n <span className=\"mr-1.5 inline-block size-2 rounded-full bg-sky-500\" />\n {t(\"contextXray.conversation\", { defaultValue: \"Conversation\" })}{\" \"}\n {formatTokens(conversationTokens)}\n </span>\n <span>\n {formatTokens(Math.max(0, budget - manifest.totalTokens))}{\" \"}\n {t(\"contextXray.free\", { defaultValue: \"free\" })}\n </span>\n </div>\n </div>\n );\n}\n\nfunction SystemSectionList({\n sections,\n totalTokens,\n}: {\n sections: ContextManifestSystemSection[];\n totalTokens: number;\n}) {\n const t = useT();\n const grouped = useMemo(() => {\n const map = new Map<\n ContextManifestSystemSection[\"provenance\"],\n ContextManifestSystemSection[]\n >();\n for (const section of sections) {\n const items = map.get(section.provenance) ?? [];\n items.push(section);\n map.set(section.provenance, items);\n }\n return PROVENANCE_ORDER.flatMap((provenance) => {\n const items = map.get(provenance);\n return items && items.length > 0 ? [{ provenance, items }] : [];\n });\n }, [sections]);\n\n return (\n <div className=\"space-y-4\">\n {grouped.map((group) => {\n const tokens = group.items.reduce(\n (sum, item) => sum + item.tokenCount,\n 0,\n );\n return (\n <section key={group.provenance}>\n <div className=\"mb-1 flex items-center justify-between gap-3\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <span className=\"size-2 rounded-full bg-indigo-500\" />\n <h3 className=\"truncate text-sm font-medium\">\n {provenanceLabel(group.provenance, t)}\n </h3>\n <span className=\"text-[11px] text-muted-foreground\">\n {governanceLabel(\n group.items[0]?.governance ?? \"inherited\",\n t,\n )}\n </span>\n </div>\n <span className=\"shrink-0 text-xs tabular-nums text-muted-foreground\">\n {formatTokens(tokens)} ·{\" \"}\n {totalTokens > 0 ? Math.round((tokens / totalTokens) * 100) : 0}\n %\n </span>\n </div>\n <div className=\"divide-y divide-border/60 rounded-md border border-border/60\">\n {group.items\n .slice()\n .sort((a, b) => b.tokenCount - a.tokenCount)\n .map((section) => (\n <div\n key={section.segmentId}\n className=\"flex gap-3 px-3 py-2.5\"\n >\n <IconLock className=\"mt-0.5 size-4 shrink-0 text-muted-foreground\" />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-baseline justify-between gap-3\">\n <div className=\"truncate text-sm font-medium\">\n {section.label}\n </div>\n <div className=\"shrink-0 text-xs tabular-nums text-muted-foreground\">\n {formatTokens(section.tokenCount)} ·{\" \"}\n {totalTokens > 0\n ? Math.round(\n (section.tokenCount / totalTokens) * 100,\n )\n : 0}\n %\n </div>\n </div>\n <div className=\"truncate text-xs text-muted-foreground\">\n {sourceLabel(section)}\n {section.tokenMethod === \"estimate\"\n ? \" · estimated\"\n : \"\"}\n </div>\n {section.preview ? (\n <div className=\"mt-1 line-clamp-2 text-xs text-muted-foreground/80\">\n {section.preview}\n </div>\n ) : null}\n </div>\n </div>\n ))}\n </div>\n </section>\n );\n })}\n {grouped.length === 0 ? (\n <div className=\"rounded-md border border-dashed border-border p-6 text-center text-sm text-muted-foreground\">\n {t(\"contextXray.noSystemContext\", {\n defaultValue: \"No system context is available for this scope yet.\",\n })}\n </div>\n ) : null}\n </div>\n );\n}\n\nexport function AgentContextTab({ scope }: AgentPageTabProps) {\n const t = useT();\n const [view, setView] = useState<\"list\" | \"map\">(\"list\");\n const previewQuery = useActionQuery(\n \"context-preview-get\",\n { scope },\n { staleTime: 5_000 },\n ) as PreviewQuery;\n const threads = useChatThreads(undefined, \"agent-context-page\", null, {\n autoCreate: false,\n restoreActiveThread: false,\n });\n const latestThread = mostRecentlyUpdatedThread(threads.threads);\n const liveManifestQuery = useActionQuery(\n \"context-manifest-get\",\n latestThread ? { threadId: latestThread.id } : undefined,\n { enabled: Boolean(latestThread), staleTime: 1_000 },\n ) as ManifestQuery;\n const preview = previewQuery.data;\n const previewManifest = preview ? previewAsManifest(preview) : null;\n const budget = resolveContextWindow(preview?.model);\n const title = t(\"contextXray.pageTitle\", { defaultValue: \"Context\" });\n\n return (\n <div className=\"mx-auto flex w-full max-w-5xl flex-col gap-8 p-6 lg:p-10\">\n <header className=\"space-y-3\">\n <div className=\"flex flex-wrap items-start justify-between gap-4\">\n <div>\n <p className=\"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground\">\n {t(\"contextXray.agent\", { defaultValue: \"Agent\" })}\n </p>\n <h1 className=\"text-2xl font-semibold tracking-tight\">{title}</h1>\n <p className=\"mt-1 max-w-2xl text-sm text-muted-foreground\">\n {t(\"contextXray.headerDescription\", {\n defaultValue:\n \"See the system instructions and conversation tokens that shape the agent.\",\n })}\n </p>\n </div>\n {previewManifest ? (\n <ContextMeter manifest={previewManifest} enabled />\n ) : null}\n </div>\n {previewManifest ? (\n <ContextSplitMeter manifest={previewManifest} budget={budget} />\n ) : null}\n </header>\n\n <section className=\"space-y-4\">\n <div className=\"flex flex-wrap items-end justify-between gap-3\">\n <div>\n <h2 className=\"text-lg font-semibold\">\n {t(\"contextXray.whatAgentKnows\", {\n defaultValue: \"What the agent knows\",\n })}\n </h2>\n <p className=\"text-sm text-muted-foreground\">\n {t(\"contextXray.orderedSystemDescription\", {\n defaultValue:\n \"Ordered system context is grouped by where it comes from. System sections are visible here but cannot be evicted from a thread.\",\n })}\n </p>\n </div>\n <div className=\"inline-flex rounded-md bg-muted/50 p-0.5\">\n <button\n type=\"button\"\n onClick={() => setView(\"list\")}\n className={cn(\n \"flex cursor-pointer items-center gap-1.5 rounded px-2.5 py-1.5 text-xs\",\n view === \"list\"\n ? \"bg-background text-foreground shadow-sm\"\n : \"text-muted-foreground\",\n )}\n >\n <IconList className=\"size-3.5\" />\n {t(\"contextXray.list\", { defaultValue: \"List\" })}\n </button>\n <button\n type=\"button\"\n onClick={() => setView(\"map\")}\n className={cn(\n \"flex cursor-pointer items-center gap-1.5 rounded px-2.5 py-1.5 text-xs\",\n view === \"map\"\n ? \"bg-background text-foreground shadow-sm\"\n : \"text-muted-foreground\",\n )}\n >\n <IconChartTreemap className=\"size-3.5\" />\n {t(\"contextXray.treemap\", { defaultValue: \"Treemap\" })}\n </button>\n </div>\n </div>\n {previewQuery.isLoading ? (\n <div className=\"rounded-md border border-border/60 p-8 text-center text-sm text-muted-foreground\">\n {t(\"contextXray.loadingPreview\", {\n defaultValue: \"Loading context preview…\",\n })}\n </div>\n ) : previewQuery.error ? (\n <div className=\"rounded-md border border-dashed border-border p-8 text-center text-sm text-muted-foreground\">\n {t(\"contextXray.previewUnavailable\", {\n defaultValue: \"Context preview is not available yet.\",\n })}\n </div>\n ) : previewManifest ? (\n view === \"map\" ? (\n <ContextTreemap\n segments={[]}\n systemSections={previewManifest.systemSections}\n />\n ) : (\n <SystemSectionList\n sections={previewManifest.systemSections ?? []}\n totalTokens={previewManifest.totalTokens}\n />\n )\n ) : (\n <div className=\"rounded-md border border-dashed border-border p-8 text-center text-sm text-muted-foreground\">\n {t(\"contextXray.noPreview\", {\n defaultValue:\n \"No context preview is available for this scope yet.\",\n })}\n </div>\n )}\n </section>\n\n <section className=\"space-y-3\">\n <div>\n <h2 className=\"text-lg font-semibold\">\n {t(\"contextXray.liveThread\", { defaultValue: \"Live thread\" })}\n </h2>\n <p className=\"text-sm text-muted-foreground\">\n {t(\"contextXray.liveThreadDescription\", {\n defaultValue:\n \"The latest thread snapshot, when one exists. This is a single current snapshot, not an append-only history.\",\n })}\n </p>\n </div>\n {latestThread && liveManifestQuery.data ? (\n <div className=\"space-y-3 rounded-md border border-border/60 p-4\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <div className=\"min-w-0\">\n <div className=\"truncate text-sm font-medium\">\n {latestThread.title ||\n latestThread.preview ||\n t(\"contextXray.latestThread\", {\n defaultValue: \"Latest thread\",\n })}\n </div>\n <div className=\"text-xs text-muted-foreground\">\n {formatTokens(liveManifestQuery.data.totalTokens)} tokens ·{\" \"}\n {latestThread.id}\n </div>\n </div>\n <ContextMeter threadId={latestThread.id} />\n </div>\n <ContextTreemap\n segments={liveManifestQuery.data.segments}\n systemSections={liveManifestQuery.data.systemSections}\n />\n </div>\n ) : (\n <div className=\"rounded-md border border-dashed border-border p-8 text-center text-sm text-muted-foreground\">\n {t(\"contextXray.noLiveThread\", {\n defaultValue: \"No live thread snapshot is available yet.\",\n })}\n </div>\n )}\n </section>\n\n <section className=\"flex gap-3 rounded-md border border-border/60 bg-muted/20 p-4\">\n <IconInfoCircle className=\"mt-0.5 size-4 shrink-0 text-muted-foreground\" />\n <div className=\"space-y-1 text-sm text-muted-foreground\">\n <p className=\"font-medium text-foreground\">\n {t(\"contextXray.orderedTokensTitle\", {\n defaultValue: \"Context is ordered tokens, not weighted tokens.\",\n })}\n </p>\n <p>\n {t(\"contextXray.orderedTokensDescription\", {\n defaultValue:\n \"Required framework and enterprise policy come first, followed by inherited template, workspace, and organization instructions. Personal instructions and memory arrive later and can narrow or override earlier guidance where the prompt permits. These system sections are not evictable; only run-local conversation segments support pin, evict, and restore.\",\n })}\n </p>\n </div>\n </section>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"AgentContextTab.js","sourceRoot":"","sources":["../../../src/client/agent-page/AgentContextTab.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAO1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAA0B,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAUnD,MAAM,UAAU,yBAAyB,CACvC,OAA4B;IAE5B,OAAO,OAAO,CAA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Q,EACzC,cAAc,EAAE,iBAAiB,CAAC,IAAI,CAAC,cAAc,GACrD,IACE,CACP,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,6FAA6F,YACzG,CAAC,CAAC,0BAA0B,EAAE;gCAC7B,YAAY,EAAE,2CAA2C;6BAC1D,CAAC,GACE,CACP,IACO,EAEV,mBAAS,SAAS,EAAC,2CAA2C,aAC5D,KAAC,cAAc,IAAC,SAAS,EAAC,8CAA8C,GAAG,EAC3E,eAAK,SAAS,EAAC,yCAAyC,aACtD,YAAG,SAAS,EAAC,6BAA6B,YACvC,CAAC,CAAC,gCAAgC,EAAE;wCACnC,YAAY,EACV,qDAAqD;qCACxD,CAAC,GACA,EACJ,sBACG,CAAC,CAAC,sCAAsC,EAAE;wCACzC,YAAY,EACV,mWAAmW;qCACtW,CAAC,GACA,IACA,IACE,IACN,GACQ,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import {\n IconChartTreemap,\n IconInfoCircle,\n IconList,\n IconLock,\n} from \"@tabler/icons-react\";\nimport { useMemo, useState } from \"react\";\n\nimport type {\n ContextManifest,\n ContextManifestSystemSection,\n ContextPreview,\n} from \"../../shared/context-xray.js\";\nimport { manifestConversationTokens } from \"../../shared/context-xray.js\";\nimport { ContextMeter } from \"../context-xray/ContextMeter.js\";\nimport { ContextTreemap } from \"../context-xray/ContextTreemap.js\";\nimport { formatTokens, resolveContextWindow } from \"../context-xray/format.js\";\nimport { useT } from \"../i18n.js\";\nimport { useActionQuery } from \"../use-action.js\";\nimport { useChatThreads, type ChatThreadSummary } from \"../use-chat-threads.js\";\nimport { cn } from \"../utils.js\";\nimport { AgentTabFrame } from \"./AgentTabFrame.js\";\nimport type { AgentPageTabProps } from \"./types.js\";\n\ntype PreviewQuery = {\n data?: ContextPreview;\n isLoading?: boolean;\n error?: unknown;\n};\ntype ManifestQuery = { data?: ContextManifest; isLoading?: boolean };\n\nexport function mostRecentlyUpdatedThread(\n threads: ChatThreadSummary[],\n): ChatThreadSummary | undefined {\n return threads.reduce<ChatThreadSummary | undefined>(\n (latest, thread) =>\n !latest || thread.updatedAt > latest.updatedAt ? thread : latest,\n undefined,\n );\n}\n\nconst PROVENANCE_ORDER = [\n \"framework-core\",\n \"actions-prompt\",\n \"enterprise-workspace-core\",\n \"template\",\n \"sql-workspace\",\n \"legacy-app-default\",\n \"organization\",\n \"personal\",\n \"memory\",\n \"db-schema\",\n \"tools\",\n \"model-overlay\",\n \"runtime-context\",\n] as const;\n\ntype Translate = (key: string, options?: Record<string, unknown>) => string;\n\nfunction provenanceLabel(\n provenance: ContextManifestSystemSection[\"provenance\"],\n t: Translate,\n): string {\n switch (provenance) {\n case \"framework-core\":\n return t(\"contextXray.provenance.frameworkCore\", {\n defaultValue: \"Framework\",\n });\n case \"actions-prompt\":\n return t(\"contextXray.provenance.actionsPrompt\", {\n defaultValue: \"Actions\",\n });\n case \"template\":\n return t(\"contextXray.provenance.template\", {\n defaultValue: \"Template\",\n });\n case \"enterprise-workspace-core\":\n return t(\"contextXray.provenance.enterpriseWorkspaceCore\", {\n defaultValue: \"Enterprise workspace core\",\n });\n case \"sql-workspace\":\n return t(\"contextXray.provenance.sqlWorkspace\", {\n defaultValue: \"Workspace\",\n });\n case \"legacy-app-default\":\n return t(\"contextXray.provenance.legacyAppDefault\", {\n defaultValue: \"App defaults\",\n });\n case \"organization\":\n return t(\"contextXray.provenance.organization\", {\n defaultValue: \"Organization\",\n });\n case \"personal\":\n return t(\"contextXray.provenance.personal\", {\n defaultValue: \"Personal\",\n });\n case \"memory\":\n return t(\"contextXray.provenance.memory\", {\n defaultValue: \"Memory\",\n });\n case \"db-schema\":\n return t(\"contextXray.provenance.dbSchema\", {\n defaultValue: \"SQL schema\",\n });\n case \"tools\":\n return t(\"contextXray.provenance.tools\", { defaultValue: \"Tools\" });\n case \"model-overlay\":\n return t(\"contextXray.provenance.modelOverlay\", {\n defaultValue: \"Model overlay\",\n });\n case \"runtime-context\":\n return t(\"contextXray.provenance.runtimeContext\", {\n defaultValue: \"Runtime context\",\n });\n }\n}\n\nfunction governanceLabel(\n governance: ContextManifestSystemSection[\"governance\"],\n t: Translate,\n): string {\n switch (governance) {\n case \"required\":\n return t(\"contextXray.governance.required\", {\n defaultValue: \"Required\",\n });\n case \"inherited\":\n return t(\"contextXray.governance.inherited\", {\n defaultValue: \"Inherited\",\n });\n case \"user\":\n return t(\"contextXray.governance.user\", {\n defaultValue: \"Your context\",\n });\n }\n}\n\nfunction sourceLabel(section: ContextManifestSystemSection): string {\n return (\n section.sourceRef?.path ??\n section.sourceRef?.resourceId ??\n section.sourceRef?.scope ??\n \"framework\"\n );\n}\n\nfunction previewAsManifest(preview: ContextPreview): ContextManifest {\n return {\n threadId: \"context-preview\",\n computedAt: preview.computedAt,\n ...(preview.model ? { model: preview.model } : {}),\n totalTokens: preview.totalTokens,\n rawTokens: preview.totalTokens,\n reclaimedTokens: 0,\n tokenCountMethod: preview.tokenCountMethod,\n conversationTokens: 0,\n systemTokens: preview.systemTokens,\n source: \"preview\",\n enforceable: false,\n segments: [],\n systemSections: preview.sections,\n };\n}\n\nfunction ContextSplitMeter({\n manifest,\n budget,\n}: {\n manifest: ContextManifest;\n budget: number;\n}) {\n const t = useT();\n const systemTokens = manifest.systemTokens ?? 0;\n const conversationTokens = manifestConversationTokens(manifest);\n const total = Math.max(1, systemTokens + conversationTokens);\n return (\n <div className=\"space-y-2\">\n <div className=\"flex h-2 overflow-hidden rounded-full bg-muted\">\n <div\n className=\"bg-slate-700 dark:bg-slate-400\"\n style={{ width: `${(systemTokens / total) * 100}%` }}\n />\n <div\n className=\"bg-sky-500\"\n style={{ width: `${(conversationTokens / total) * 100}%` }}\n />\n </div>\n <div className=\"flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground\">\n <span>\n <span className=\"mr-1.5 inline-block size-2 rounded-full bg-slate-700 dark:bg-slate-400\" />\n {t(\"contextXray.system\", { defaultValue: \"System\" })}{\" \"}\n {formatTokens(systemTokens)}\n </span>\n <span>\n <span className=\"mr-1.5 inline-block size-2 rounded-full bg-sky-500\" />\n {t(\"contextXray.conversation\", { defaultValue: \"Conversation\" })}{\" \"}\n {formatTokens(conversationTokens)}\n </span>\n <span>\n {formatTokens(Math.max(0, budget - manifest.totalTokens))}{\" \"}\n {t(\"contextXray.free\", { defaultValue: \"free\" })}\n </span>\n </div>\n </div>\n );\n}\n\nfunction SystemSectionList({\n sections,\n totalTokens,\n}: {\n sections: ContextManifestSystemSection[];\n totalTokens: number;\n}) {\n const t = useT();\n const grouped = useMemo(() => {\n const map = new Map<\n ContextManifestSystemSection[\"provenance\"],\n ContextManifestSystemSection[]\n >();\n for (const section of sections) {\n const items = map.get(section.provenance) ?? [];\n items.push(section);\n map.set(section.provenance, items);\n }\n return PROVENANCE_ORDER.flatMap((provenance) => {\n const items = map.get(provenance);\n return items && items.length > 0 ? [{ provenance, items }] : [];\n });\n }, [sections]);\n\n return (\n <div className=\"space-y-4\">\n {grouped.map((group) => {\n const tokens = group.items.reduce(\n (sum, item) => sum + item.tokenCount,\n 0,\n );\n return (\n <section key={group.provenance}>\n <div className=\"mb-1 flex items-center justify-between gap-3\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <span className=\"size-2 rounded-full bg-indigo-500\" />\n <h3 className=\"truncate text-sm font-medium\">\n {provenanceLabel(group.provenance, t)}\n </h3>\n <span className=\"text-[11px] text-muted-foreground\">\n {governanceLabel(\n group.items[0]?.governance ?? \"inherited\",\n t,\n )}\n </span>\n </div>\n <span className=\"shrink-0 text-xs tabular-nums text-muted-foreground\">\n {formatTokens(tokens)} ·{\" \"}\n {totalTokens > 0 ? Math.round((tokens / totalTokens) * 100) : 0}\n %\n </span>\n </div>\n <div className=\"divide-y divide-border/60 border-y border-border/60\">\n {group.items\n .slice()\n .sort((a, b) => b.tokenCount - a.tokenCount)\n .map((section) => (\n <div\n key={section.segmentId}\n className=\"flex gap-3 px-3 py-2.5\"\n >\n <IconLock className=\"mt-0.5 size-4 shrink-0 text-muted-foreground\" />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-baseline justify-between gap-3\">\n <div className=\"truncate text-sm font-medium\">\n {section.label}\n </div>\n <div className=\"shrink-0 text-xs tabular-nums text-muted-foreground\">\n {formatTokens(section.tokenCount)} ·{\" \"}\n {totalTokens > 0\n ? Math.round(\n (section.tokenCount / totalTokens) * 100,\n )\n : 0}\n %\n </div>\n </div>\n <div className=\"truncate text-xs text-muted-foreground\">\n {sourceLabel(section)}\n {section.tokenMethod === \"estimate\"\n ? \" · estimated\"\n : \"\"}\n </div>\n {section.preview ? (\n <div className=\"mt-1 line-clamp-2 text-xs text-muted-foreground/80\">\n {section.preview}\n </div>\n ) : null}\n </div>\n </div>\n ))}\n </div>\n </section>\n );\n })}\n {grouped.length === 0 ? (\n <div className=\"rounded-md border border-dashed border-border p-6 text-center text-sm text-muted-foreground\">\n {t(\"contextXray.noSystemContext\", {\n defaultValue: \"No system context is available for this scope yet.\",\n })}\n </div>\n ) : null}\n </div>\n );\n}\n\nexport function AgentContextTab({ scope }: AgentPageTabProps) {\n const t = useT();\n const [view, setView] = useState<\"list\" | \"map\">(\"list\");\n const previewQuery = useActionQuery(\n \"context-preview-get\",\n { scope },\n { staleTime: 5_000 },\n ) as PreviewQuery;\n const threads = useChatThreads(undefined, \"agent-context-page\", null, {\n autoCreate: false,\n restoreActiveThread: false,\n });\n const latestThread = mostRecentlyUpdatedThread(threads.threads);\n const liveManifestQuery = useActionQuery(\n \"context-manifest-get\",\n latestThread ? { threadId: latestThread.id } : undefined,\n { enabled: Boolean(latestThread), staleTime: 1_000 },\n ) as ManifestQuery;\n const preview = previewQuery.data;\n const previewManifest = preview ? previewAsManifest(preview) : null;\n const budget = resolveContextWindow(preview?.model);\n const title = t(\"contextXray.pageTitle\", { defaultValue: \"Snapshots\" });\n const description = t(\"contextXray.headerDescription\", {\n defaultValue:\n \"Inspect the latest combined snapshot of what the agent loaded and why.\",\n });\n\n return (\n <AgentTabFrame\n title={title}\n description={description}\n actions={\n previewManifest ? (\n <ContextMeter manifest={previewManifest} enabled />\n ) : null\n }\n >\n <div className=\"space-y-7\">\n {previewManifest ? (\n <ContextSplitMeter manifest={previewManifest} budget={budget} />\n ) : null}\n\n <section className=\"space-y-4\">\n <div className=\"flex justify-end\">\n <div className=\"inline-flex rounded-md bg-muted/50 p-0.5\">\n <button\n type=\"button\"\n onClick={() => setView(\"list\")}\n className={cn(\n \"flex cursor-pointer items-center gap-1.5 rounded px-2.5 py-1.5 text-xs\",\n view === \"list\"\n ? \"bg-background text-foreground shadow-sm\"\n : \"text-muted-foreground\",\n )}\n >\n <IconList className=\"size-3.5\" />\n {t(\"contextXray.list\", { defaultValue: \"List\" })}\n </button>\n <button\n type=\"button\"\n onClick={() => setView(\"map\")}\n className={cn(\n \"flex cursor-pointer items-center gap-1.5 rounded px-2.5 py-1.5 text-xs\",\n view === \"map\"\n ? \"bg-background text-foreground shadow-sm\"\n : \"text-muted-foreground\",\n )}\n >\n <IconChartTreemap className=\"size-3.5\" />\n {t(\"contextXray.treemap\", { defaultValue: \"Treemap\" })}\n </button>\n </div>\n </div>\n {previewQuery.isLoading ? (\n <div className=\"rounded-md border border-border/60 p-8 text-center text-sm text-muted-foreground\">\n {t(\"contextXray.loadingPreview\", {\n defaultValue: \"Loading recent snapshot…\",\n })}\n </div>\n ) : previewQuery.error ? (\n <div className=\"rounded-md border border-dashed border-border p-8 text-center text-sm text-muted-foreground\">\n {t(\"contextXray.previewUnavailable\", {\n defaultValue: \"A recent snapshot is not available yet.\",\n })}\n </div>\n ) : previewManifest ? (\n view === \"map\" ? (\n <ContextTreemap\n segments={[]}\n systemSections={previewManifest.systemSections}\n />\n ) : (\n <SystemSectionList\n sections={previewManifest.systemSections ?? []}\n totalTokens={previewManifest.totalTokens}\n />\n )\n ) : (\n <div className=\"rounded-md border border-dashed border-border p-8 text-center text-sm text-muted-foreground\">\n {t(\"contextXray.noPreview\", {\n defaultValue:\n \"No recent snapshot is available for this scope yet.\",\n })}\n </div>\n )}\n </section>\n\n <section className=\"space-y-3\">\n <div>\n <h2 className=\"text-lg font-semibold\">\n {t(\"contextXray.liveThread\", { defaultValue: \"Live thread\" })}\n </h2>\n <p className=\"text-sm text-muted-foreground\">\n {t(\"contextXray.liveThreadDescription\", {\n defaultValue:\n \"The latest thread snapshot, when one exists. This is a single current snapshot, not an append-only history.\",\n })}\n </p>\n </div>\n {latestThread && liveManifestQuery.data ? (\n <div className=\"space-y-3 border-y border-border/60 py-4\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <div className=\"min-w-0\">\n <div className=\"truncate text-sm font-medium\">\n {latestThread.title ||\n latestThread.preview ||\n t(\"contextXray.latestThread\", {\n defaultValue: \"Latest thread\",\n })}\n </div>\n <div className=\"text-xs text-muted-foreground\">\n {formatTokens(liveManifestQuery.data.totalTokens)} tokens ·{\" \"}\n {latestThread.id}\n </div>\n </div>\n <ContextMeter threadId={latestThread.id} />\n </div>\n <ContextTreemap\n segments={liveManifestQuery.data.segments}\n systemSections={liveManifestQuery.data.systemSections}\n />\n </div>\n ) : (\n <div className=\"rounded-md border border-dashed border-border p-8 text-center text-sm text-muted-foreground\">\n {t(\"contextXray.noLiveThread\", {\n defaultValue: \"No live thread snapshot is available yet.\",\n })}\n </div>\n )}\n </section>\n\n <section className=\"flex gap-3 border-t border-border/70 pt-5\">\n <IconInfoCircle className=\"mt-0.5 size-4 shrink-0 text-muted-foreground\" />\n <div className=\"space-y-1 text-sm text-muted-foreground\">\n <p className=\"font-medium text-foreground\">\n {t(\"contextXray.orderedTokensTitle\", {\n defaultValue:\n \"Snapshots show ordered tokens, not weighted tokens.\",\n })}\n </p>\n <p>\n {t(\"contextXray.orderedTokensDescription\", {\n defaultValue:\n \"Required framework and enterprise policy come first, followed by inherited template, workspace, and organization instructions. Personal instructions and memory arrive later and can narrow or override earlier guidance where the prompt permits. These system sections are not evictable; only run-local conversation segments support pin, evict, and restore.\",\n })}\n </p>\n </div>\n </section>\n </div>\n </AgentTabFrame>\n );\n}\n"]}
@@ -0,0 +1,13 @@
1
+ import type { ComponentType, ReactNode } from "react";
2
+ interface AgentEmptyStateProps {
3
+ icon?: ComponentType<{
4
+ className?: string;
5
+ }>;
6
+ title: string;
7
+ description?: ReactNode;
8
+ action?: ReactNode;
9
+ className?: string;
10
+ }
11
+ export declare function AgentEmptyState({ icon: Icon, title, description, action, className, }: AgentEmptyStateProps): import("react").JSX.Element;
12
+ export {};
13
+ //# sourceMappingURL=AgentEmptyState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentEmptyState.d.ts","sourceRoot":"","sources":["../../../src/client/agent-page/AgentEmptyState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAItD,UAAU,oBAAoB;IAC5B,IAAI,CAAC,EAAE,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EAAE,IAAI,EACV,KAAK,EACL,WAAW,EACX,MAAM,EACN,SAAS,GACV,EAAE,oBAAoB,+BAyBtB"}
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../utils.js";
3
+ export function AgentEmptyState({ icon: Icon, title, description, action, className, }) {
4
+ return (_jsxs("div", { className: cn("flex min-w-0 items-start gap-3 border-y border-border/60 py-5", className), children: [Icon ? (_jsx(Icon, { "aria-hidden": "true", className: "mt-0.5 size-4 shrink-0 text-muted-foreground" })) : null, _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "text-sm font-medium text-foreground", children: title }), description ? (_jsx("p", { className: "mt-1 max-w-2xl break-words text-sm leading-relaxed text-muted-foreground", children: description })) : null, action ? _jsx("div", { className: "mt-3", children: action }) : null] })] }));
5
+ }
6
+ //# sourceMappingURL=AgentEmptyState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentEmptyState.js","sourceRoot":"","sources":["../../../src/client/agent-page/AgentEmptyState.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAUjC,MAAM,UAAU,eAAe,CAAC,EAC9B,IAAI,EAAE,IAAI,EACV,KAAK,EACL,WAAW,EACX,MAAM,EACN,SAAS,GACY;IACrB,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,+DAA+D,EAC/D,SAAS,CACV,aAEA,IAAI,CAAC,CAAC,CAAC,CACN,KAAC,IAAI,mBACS,MAAM,EAClB,SAAS,EAAC,8CAA8C,GACxD,CACH,CAAC,CAAC,CAAC,IAAI,EACR,eAAK,SAAS,EAAC,gBAAgB,aAC7B,YAAG,SAAS,EAAC,qCAAqC,YAAE,KAAK,GAAK,EAC7D,WAAW,CAAC,CAAC,CAAC,CACb,YAAG,SAAS,EAAC,0EAA0E,YACpF,WAAW,GACV,CACL,CAAC,CAAC,CAAC,IAAI,EACP,MAAM,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,MAAM,YAAE,MAAM,GAAO,CAAC,CAAC,CAAC,IAAI,IACjD,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import type { ComponentType, ReactNode } from \"react\";\n\nimport { cn } from \"../utils.js\";\n\ninterface AgentEmptyStateProps {\n icon?: ComponentType<{ className?: string }>;\n title: string;\n description?: ReactNode;\n action?: ReactNode;\n className?: string;\n}\n\nexport function AgentEmptyState({\n icon: Icon,\n title,\n description,\n action,\n className,\n}: AgentEmptyStateProps) {\n return (\n <div\n className={cn(\n \"flex min-w-0 items-start gap-3 border-y border-border/60 py-5\",\n className,\n )}\n >\n {Icon ? (\n <Icon\n aria-hidden=\"true\"\n className=\"mt-0.5 size-4 shrink-0 text-muted-foreground\"\n />\n ) : null}\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-medium text-foreground\">{title}</p>\n {description ? (\n <p className=\"mt-1 max-w-2xl break-words text-sm leading-relaxed text-muted-foreground\">\n {description}\n </p>\n ) : null}\n {action ? <div className=\"mt-3\">{action}</div> : null}\n </div>\n </div>\n );\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  import type { AgentPageTabProps } from "./types.js";
2
- export declare function AgentJobsTab({ scope, canManageOrg, }: AgentPageTabProps): import("react").JSX.Element;
2
+ export declare function AgentJobsTab({ canManageOrg }: AgentPageTabProps): import("react").JSX.Element;
3
3
  //# sourceMappingURL=AgentJobsTab.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentJobsTab.d.ts","sourceRoot":"","sources":["../../../src/client/agent-page/AgentJobsTab.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAOpD,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,YAAoB,GACrB,EAAE,iBAAiB,+BAkVnB"}
1
+ {"version":3,"file":"AgentJobsTab.d.ts","sourceRoot":"","sources":["../../../src/client/agent-page/AgentJobsTab.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAOpD,wBAAgB,YAAY,CAAC,EAAE,YAAoB,EAAE,EAAE,iBAAiB,+BAoZvE"}
@@ -1,16 +1,21 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button } from "@agent-native/toolkit/ui/button";
3
- import { IconClock, IconEye, IconLoader2, IconPlayerPause, IconPlayerPlay, IconTrash, } from "@tabler/icons-react";
3
+ import { IconBolt, IconCalendarEvent, IconClock, IconEye, IconLoader2, IconPlayerPause, IconPlayerPlay, IconTrash, } from "@tabler/icons-react";
4
4
  import { useState } from "react";
5
+ import { AgentAskPopover } from "../AgentAskPopover.js";
5
6
  import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "../components/ui/dialog.js";
6
7
  import { useFormatters, useT } from "../i18n.js";
7
- import { AutomationsList } from "../settings/AutomationsSection.js";
8
+ import { automationCreationContext, AutomationsList, } from "../settings/AutomationsSection.js";
9
+ import { AgentEmptyState } from "./AgentEmptyState.js";
10
+ import { AgentTabFrame } from "./AgentTabFrame.js";
8
11
  import { useManageRecurringJob, useRecurringJobs, } from "./use-jobs.js";
9
- export function AgentJobsTab({ scope, canManageOrg = false, }) {
12
+ export function AgentJobsTab({ canManageOrg = false }) {
10
13
  const t = useT();
11
14
  const { formatDate } = useFormatters();
12
- const query = useRecurringJobs(scope);
13
- const mutation = useManageRecurringJob(scope);
15
+ const personalQuery = useRecurringJobs("user");
16
+ const organizationQuery = useRecurringJobs("org");
17
+ const personalMutation = useManageRecurringJob("user");
18
+ const organizationMutation = useManageRecurringJob("org");
14
19
  const [deleteTarget, setDeleteTarget] = useState(null);
15
20
  const [detailsTarget, setDetailsTarget] = useState(null);
16
21
  const formatDateTime = (value) => {
@@ -23,71 +28,98 @@ export function AgentJobsTab({ scope, canManageOrg = false, }) {
23
28
  minute: "2-digit",
24
29
  });
25
30
  };
26
- const jobs = query.data ?? [];
27
- return (_jsxs("div", { className: "mx-auto flex w-full max-w-5xl flex-col gap-8 p-6 lg:p-10", children: [_jsxs("header", { className: "space-y-3", children: [_jsx("p", { className: "text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground", children: t("jobs.agent", { defaultValue: "Agent" }) }), _jsxs("div", { children: [_jsx("h1", { className: "text-2xl font-semibold tracking-tight", children: t("jobs.pageTitle", { defaultValue: "Jobs" }) }), _jsx("p", { className: "mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground", children: t("jobs.pageDescription", {
28
- defaultValue: "See recurring jobs and automations that run work for you.",
29
- }) })] })] }), _jsxs("section", { className: "space-y-4", children: [_jsxs("div", { className: "flex flex-wrap items-end justify-between gap-3", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-lg font-semibold", children: t("jobs.recurringTitle", { defaultValue: "Recurring jobs" }) }), _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: scope === "org"
30
- ? t("jobs.organizationRecurringDescription", {
31
- defaultValue: "Cron jobs shared with this organization. Members can view them; creators and admins can manage them.",
32
- })
33
- : t("jobs.recurringDescription", {
34
- defaultValue: "Scheduled prompts that ask the agent to do work automatically.",
35
- }) })] }), scope === "org" && !canManageOrg ? (_jsx("span", { className: "text-xs text-muted-foreground", children: t("jobs.organizationMemberNote", {
36
- defaultValue: "You can manage jobs you created.",
37
- }) })) : null] }), query.isLoading ? (_jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", "aria-busy": "true", children: [_jsx(IconLoader2, { className: "size-4 animate-spin" }), t("jobs.loading", { defaultValue: "Loading…" })] })) : query.error ? (_jsx("p", { className: "text-sm text-destructive", children: t("jobs.recurringLoadError", {
38
- defaultValue: "Could not load recurring jobs.",
39
- }) })) : jobs.length === 0 ? (_jsxs("div", { className: "rounded-lg border border-dashed border-border p-6 text-center", children: [_jsx(IconClock, { className: "mx-auto size-5 text-muted-foreground" }), _jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: scope === "org"
40
- ? t("jobs.organizationEmpty", {
41
- defaultValue: "No organization jobs yet.",
42
- })
43
- : t("jobs.recurringEmpty", {
44
- defaultValue: "No recurring jobs yet. Ask the agent: “every morning, summarize my inbox”.",
45
- }) })] })) : (_jsx("div", { className: "space-y-3", children: jobs.map((job) => {
46
- const lastRun = formatDateTime(job.lastRun);
47
- const nextRun = formatDateTime(job.nextRun);
48
- return (_jsx("article", { className: "rounded-lg border border-border bg-card p-4", children: _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "mt-0.5 text-muted-foreground", children: _jsx(IconClock, { className: "size-4" }) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("h3", { className: "truncate text-sm font-medium", children: job.name.replace(/-/g, " ") }), _jsx("span", { className: job.enabled
49
- ? "rounded-full bg-emerald-500/15 px-2 py-0.5 text-[10px] font-medium text-emerald-600 dark:text-emerald-400"
50
- : "rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground", children: job.enabled
51
- ? t("jobs.enabled", { defaultValue: "Enabled" })
52
- : t("jobs.paused", { defaultValue: "Paused" }) }), job.lastStatus ? (_jsx("span", { className: "rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground", children: job.lastStatus })) : null] }), _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: job.scheduleDescription || job.schedule }), _jsx("p", { className: "mt-1 line-clamp-2 text-xs text-muted-foreground/80", children: job.instructions }), lastRun || nextRun ? (_jsxs("div", { className: "mt-2 flex flex-wrap gap-x-4 gap-y-1 text-[11px] text-muted-foreground", children: [nextRun ? (_jsxs("span", { children: [t("jobs.nextRun", { defaultValue: "Next run" }), ":", " ", nextRun] })) : null, lastRun ? (_jsxs("span", { children: [t("jobs.lastRun", { defaultValue: "Last run" }), ":", " ", lastRun] })) : null] })) : null] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [_jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "cursor-pointer px-2 text-xs", onClick: () => setDetailsTarget(job), children: [_jsx(IconEye, { className: "size-3.5" }), t("jobs.details", { defaultValue: "Details" })] }), job.canUpdate ? (_jsxs(_Fragment, { children: [_jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "cursor-pointer px-2 text-xs", disabled: mutation.isPending, onClick: () => mutation.mutate({
53
- operation: "update",
54
- name: job.name,
55
- scope: job.scope,
56
- enabled: !job.enabled,
57
- }), children: [job.enabled ? (_jsx(IconPlayerPause, { className: "size-3.5" })) : (_jsx(IconPlayerPlay, { className: "size-3.5" })), job.enabled
58
- ? t("jobs.pause", { defaultValue: "Pause" })
59
- : t("jobs.resume", { defaultValue: "Resume" })] }), _jsx(Button, { type: "button", variant: "ghost", size: "icon", className: "size-8 cursor-pointer text-muted-foreground hover:text-destructive", "aria-label": t("jobs.delete", {
60
- defaultValue: "Delete",
61
- }), onClick: () => setDeleteTarget(job), children: _jsx(IconTrash, { className: "size-3.5" }) })] })) : null] })] }) }, job.id));
62
- }) })), mutation.error ? (_jsx("p", { className: "text-sm text-destructive", children: mutation.error.message ||
63
- t("jobs.recurringUpdateError", {
64
- defaultValue: "Could not update recurring job.",
65
- }) })) : null] }), _jsxs("section", { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-lg font-semibold", children: t("jobs.automationsTitle", { defaultValue: "Automations" }) }), _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: scope === "org"
66
- ? t("jobs.organizationAutomationsDescription", {
67
- defaultValue: "Automations are personal today, so none are shown in the organization view.",
68
- })
69
- : t("jobs.automationsDescription", {
70
- defaultValue: "Event-triggered and scheduled agent tasks managed from one place.",
71
- }) })] }), _jsx(AutomationsList, { scope: scope, emptyMessage: scope === "org"
72
- ? t("jobs.automationsPersonalOnly", {
73
- defaultValue: "Automations are personal today.",
31
+ const renderRecurringSection = (title, scope, query, mutation) => {
32
+ const jobs = query.data ?? [];
33
+ return (_jsxs("section", { className: "space-y-4", children: [_jsxs("div", { className: "flex flex-wrap items-end justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("h2", { className: "text-xs font-semibold uppercase tracking-[0.14em] text-muted-foreground/70", children: title }), _jsx("p", { className: "mt-2 max-w-2xl text-sm text-muted-foreground", children: scope === "org"
34
+ ? t("jobs.organizationRecurringDescription", {
35
+ defaultValue: "Jobs shared with this organization. Members can view them; creators and admins can manage them.",
36
+ })
37
+ : t("jobs.recurringDescription", {
38
+ defaultValue: "Scheduled prompts that ask the agent to do work automatically.",
39
+ }) })] }), scope === "org" && !canManageOrg ? (_jsx("span", { className: "text-xs text-muted-foreground", children: t("jobs.organizationMemberNote", {
40
+ defaultValue: "You can manage jobs you created.",
41
+ }) })) : null] }), query.isLoading ? (_jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", "aria-busy": "true", children: [_jsx(IconLoader2, { className: "size-4 animate-spin" }), t("jobs.loading", { defaultValue: "Loading…" })] })) : query.error ? (_jsx("p", { className: "text-sm text-destructive", children: t("jobs.recurringLoadError", {
42
+ defaultValue: "Could not load recurring jobs.",
43
+ }) })) : jobs.length === 0 ? (_jsx(AgentEmptyState, { icon: IconCalendarEvent, title: scope === "org"
44
+ ? t("jobs.organizationEmptyTitle", {
45
+ defaultValue: "No organization jobs yet",
46
+ })
47
+ : t("jobs.recurringEmptyTitle", {
48
+ defaultValue: "No recurring jobs yet",
49
+ }), description: scope === "org"
50
+ ? t("jobs.organizationEmptyDescription", {
51
+ defaultValue: "Describe a shared job for this organization.",
52
+ })
53
+ : t("jobs.recurringEmptyDescription", {
54
+ defaultValue: "Describe what should run and when.",
55
+ }), action: _jsx(AgentAskPopover, { context: scope === "org"
56
+ ? "The user wants to create an organization recurring job. Create it in the organization jobs resource with the schedule and instructions from their prompt."
57
+ : "The user wants to create a personal recurring job. Create it in the personal jobs resource with the schedule and instructions from their prompt.", prompt: scope === "org"
58
+ ? t("jobs.organizationPrompt", {
59
+ defaultValue: "Create a shared organization job that runs on a schedule and does this: ",
74
60
  })
75
- : undefined })] }), _jsx(Dialog, { open: deleteTarget !== null, onOpenChange: (open) => {
76
- if (!open && !mutation.isPending)
61
+ : t("jobs.recurringPrompt", {
62
+ defaultValue: "Create a recurring job that runs on a schedule and does this: every morning, summarize my inbox.",
63
+ }), title: scope === "org"
64
+ ? t("jobs.organizationCreateTitle", {
65
+ defaultValue: "Create an organization job",
66
+ })
67
+ : t("jobs.recurringCreateTitle", {
68
+ defaultValue: "Create a recurring job",
69
+ }) }) })) : (_jsx("div", { className: "divide-y divide-border/60 border-y border-border/60", children: jobs.map((job) => {
70
+ const lastRun = formatDateTime(job.lastRun);
71
+ const nextRun = formatDateTime(job.nextRun);
72
+ return (_jsx("article", { className: "py-4 first:pt-5 last:pb-5", children: _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "mt-0.5 text-muted-foreground", children: _jsx(IconClock, { className: "size-4" }) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("h3", { className: "truncate text-sm font-medium", children: job.name.replace(/-/g, " ") }), _jsx("span", { className: job.enabled
73
+ ? "rounded-full bg-emerald-500/15 px-2 py-0.5 text-[10px] font-medium text-emerald-600 dark:text-emerald-400"
74
+ : "rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground", children: job.enabled
75
+ ? t("jobs.enabled", { defaultValue: "Enabled" })
76
+ : t("jobs.paused", { defaultValue: "Paused" }) }), job.lastStatus ? (_jsx("span", { className: "rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground", children: job.lastStatus })) : null] }), _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: job.scheduleDescription || job.schedule }), _jsx("p", { className: "mt-1 line-clamp-2 text-xs text-muted-foreground/80", children: job.instructions }), lastRun || nextRun ? (_jsxs("div", { className: "mt-2 flex flex-wrap gap-x-4 gap-y-1 text-[11px] text-muted-foreground", children: [nextRun ? (_jsxs("span", { children: [t("jobs.nextRun", { defaultValue: "Next run" }), ":", " ", nextRun] })) : null, lastRun ? (_jsxs("span", { children: [t("jobs.lastRun", { defaultValue: "Last run" }), ":", " ", lastRun] })) : null] })) : null] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [_jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "cursor-pointer px-2 text-xs", onClick: () => setDetailsTarget(job), children: [_jsx(IconEye, { className: "size-3.5" }), t("jobs.details", { defaultValue: "Details" })] }), job.canUpdate ? (_jsxs(_Fragment, { children: [_jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "cursor-pointer px-2 text-xs", disabled: mutation.isPending, onClick: () => mutation.mutate({
77
+ operation: "update",
78
+ name: job.name,
79
+ scope: job.scope,
80
+ enabled: !job.enabled,
81
+ }), children: [job.enabled ? (_jsx(IconPlayerPause, { className: "size-3.5" })) : (_jsx(IconPlayerPlay, { className: "size-3.5" })), job.enabled
82
+ ? t("jobs.pause", { defaultValue: "Pause" })
83
+ : t("jobs.resume", { defaultValue: "Resume" })] }), _jsx(Button, { type: "button", variant: "ghost", size: "icon", className: "size-8 cursor-pointer text-muted-foreground hover:text-destructive", "aria-label": t("jobs.delete", {
84
+ defaultValue: "Delete",
85
+ }), onClick: () => setDeleteTarget(job), children: _jsx(IconTrash, { className: "size-3.5" }) })] })) : null] })] }) }, job.id));
86
+ }) })), mutation.error ? (_jsx("p", { className: "text-sm text-destructive", children: mutation.error.message ||
87
+ t("jobs.recurringUpdateError", {
88
+ defaultValue: "Could not update recurring job.",
89
+ }) })) : null] }));
90
+ };
91
+ const mutationPending = personalMutation.isPending || organizationMutation.isPending;
92
+ const deleteMutation = deleteTarget?.scope === "organization"
93
+ ? organizationMutation
94
+ : personalMutation;
95
+ return (_jsxs(AgentTabFrame, { title: t("jobs.pageTitle", { defaultValue: "Jobs" }), description: t("jobs.pageDescription", {
96
+ defaultValue: "See recurring jobs and automations that run work for you.",
97
+ }), children: [_jsxs("div", { className: "space-y-7", children: [renderRecurringSection("Personal", "user", personalQuery, personalMutation), renderRecurringSection("Organization", "org", organizationQuery, organizationMutation), _jsxs("section", { className: "space-y-4 border-t border-border/70 pt-6", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-xs font-semibold uppercase tracking-[0.14em] text-muted-foreground/70", children: t("jobs.automationsTitle", { defaultValue: "Automations" }) }), _jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: t("jobs.automationsDescription", {
98
+ defaultValue: "Event-triggered and scheduled agent tasks managed from one place.",
99
+ }) })] }), _jsx(AutomationsList, { scope: "user", emptyState: _jsx(AgentEmptyState, { icon: IconBolt, title: t("jobs.automationsEmptyTitle", {
100
+ defaultValue: "No automations yet",
101
+ }), description: t("jobs.automationsEmptyDescription", {
102
+ defaultValue: "Describe what should happen and when.",
103
+ }), action: _jsx(AgentAskPopover, { context: automationCreationContext(), prompt: t("jobs.automationPrompt", {
104
+ defaultValue: "Create an automation that does this: ",
105
+ }), title: t("jobs.automationsCreateTitle", {
106
+ defaultValue: "Create an automation",
107
+ }) }) }) })] })] }), _jsx(Dialog, { open: deleteTarget !== null, onOpenChange: (open) => {
108
+ if (!open && !mutationPending)
77
109
  setDeleteTarget(null);
78
110
  }, children: _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: t("jobs.deleteRecurringTitle", {
79
111
  defaultValue: "Delete recurring job?",
80
112
  }) }), _jsx(DialogDescription, { children: t("jobs.deleteRecurringDescription", {
81
113
  defaultValue: "This permanently removes the job and cannot be undone.",
82
- }) })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "outline", className: "cursor-pointer", disabled: mutation.isPending, onClick: () => setDeleteTarget(null), children: t("jobs.cancel", { defaultValue: "Cancel" }) }), _jsxs(Button, { type: "button", variant: "destructive", className: "cursor-pointer", disabled: mutation.isPending, onClick: () => {
114
+ }) })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "outline", className: "cursor-pointer", disabled: mutationPending, onClick: () => setDeleteTarget(null), children: t("jobs.cancel", { defaultValue: "Cancel" }) }), _jsxs(Button, { type: "button", variant: "destructive", className: "cursor-pointer", disabled: mutationPending, onClick: () => {
83
115
  if (!deleteTarget)
84
116
  return;
85
- mutation.mutate({
117
+ deleteMutation.mutate({
86
118
  operation: "delete",
87
119
  name: deleteTarget.name,
88
120
  scope: deleteTarget.scope,
89
121
  }, { onSuccess: () => setDeleteTarget(null) });
90
- }, children: [mutation.isPending ? (_jsx(IconLoader2, { className: "size-4 animate-spin" })) : null, t("jobs.delete", { defaultValue: "Delete" })] })] })] }) }), _jsx(Dialog, { open: detailsTarget !== null, onOpenChange: (open) => {
122
+ }, children: [mutationPending ? (_jsx(IconLoader2, { className: "size-4 animate-spin" })) : null, t("jobs.delete", { defaultValue: "Delete" })] })] })] }) }), _jsx(Dialog, { open: detailsTarget !== null, onOpenChange: (open) => {
91
123
  if (!open)
92
124
  setDetailsTarget(null);
93
125
  }, children: _jsxs(DialogContent, { className: "max-w-2xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: detailsTarget?.name.replace(/-/g, " ") ??