@agent-native/core 0.122.0 → 0.122.2

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 (187) hide show
  1. package/README.md +5 -25
  2. package/corpus/README.md +1 -1
  3. package/corpus/core/CHANGELOG.md +15 -0
  4. package/corpus/core/package.json +1 -1
  5. package/corpus/core/src/a2a/client.ts +57 -4
  6. package/corpus/core/src/agent/production-agent.ts +65 -1
  7. package/corpus/core/src/agent/run-store.ts +61 -1
  8. package/corpus/core/src/client/settings/SettingsPanel.tsx +9 -9
  9. package/corpus/core/src/client/settings/SettingsTabsPage.tsx +12 -2
  10. package/corpus/core/src/extensions/url-safety.ts +67 -4
  11. package/corpus/core/src/server/builder-design-systems.ts +1 -1
  12. package/corpus/core/src/templates/chat/app/components/layout/Sidebar.tsx +0 -7
  13. package/corpus/core/src/templates/default/app/root.tsx +1 -1
  14. package/corpus/core/src/templates/default/public/manifest.json +2 -2
  15. package/corpus/core/src/vite/client.ts +64 -3
  16. package/corpus/templates/analytics/.agents/skills/dashboard-management/SKILL.md +15 -0
  17. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +1 -23
  18. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/report-panel-window.ts +3 -3
  19. package/corpus/templates/analytics/app/routes/_index.tsx +1 -1
  20. package/corpus/templates/analytics/changelog/2026-07-25-analytics-dashboards-and-scheduled-reports-are-faster-and-mo.md +6 -0
  21. package/corpus/templates/analytics/changelog/2026-07-25-app-branding-now-uses-the-product-name-without-the-agent-nat.md +6 -0
  22. package/corpus/templates/analytics/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  23. package/corpus/templates/analytics/package.json +1 -1
  24. package/corpus/templates/analytics/public/manifest.json +1 -1
  25. package/corpus/templates/analytics/server/db/schema.ts +12 -0
  26. package/corpus/templates/analytics/server/lib/dashboard-panel-query.ts +8 -4
  27. package/corpus/templates/analytics/server/lib/dashboard-report.ts +136 -5
  28. package/corpus/templates/analytics/server/lib/dashboard-time-scope.ts +250 -1
  29. package/corpus/templates/analytics/server/lib/first-party-analytics-cache.ts +167 -0
  30. package/corpus/templates/analytics/server/lib/first-party-analytics.ts +34 -9
  31. package/corpus/templates/analytics/server/lib/first-party-dashboard-repair.ts +105 -23
  32. package/corpus/templates/analytics/server/lib/first-party-unbounded-panel-repair.ts +169 -0
  33. package/corpus/templates/analytics/server/plugins/auth.ts +1 -1
  34. package/corpus/templates/analytics/server/plugins/db.ts +41 -1
  35. package/corpus/templates/analytics/shared/dashboard-report-timeouts.ts +6 -3
  36. package/corpus/templates/assets/app/components/layout/Sidebar.tsx +0 -2
  37. package/corpus/templates/assets/app/routes/_index.tsx +1 -1
  38. package/corpus/templates/assets/changelog/2026-07-25-app-branding-now-uses-the-product-name-without-the-agent-nat.md +6 -0
  39. package/corpus/templates/assets/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  40. package/corpus/templates/assets/server/plugins/auth.ts +1 -1
  41. package/corpus/templates/brain/app/lib/brain.ts +0 -7
  42. package/corpus/templates/brain/app/routes/_index.tsx +1 -2
  43. package/corpus/templates/brain/changelog/2026-07-25-app-branding-now-uses-the-product-name-without-the-agent-nat.md +6 -0
  44. package/corpus/templates/brain/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  45. package/corpus/templates/brain/package.json +1 -1
  46. package/corpus/templates/brain/public/manifest.json +1 -1
  47. package/corpus/templates/brain/server/plugins/auth.ts +1 -1
  48. package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +0 -6
  49. package/corpus/templates/calendar/app/routes/_app._index.tsx +1 -1
  50. package/corpus/templates/calendar/changelog/2026-07-25-app-branding-now-uses-the-product-name-without-the-agent-nat.md +6 -0
  51. package/corpus/templates/calendar/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  52. package/corpus/templates/calendar/package.json +1 -1
  53. package/corpus/templates/calendar/public/manifest.json +1 -1
  54. package/corpus/templates/calendar/server/plugins/auth.ts +1 -1
  55. package/corpus/templates/chat/app/components/layout/Sidebar.tsx +0 -7
  56. package/corpus/templates/chat/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  57. package/corpus/templates/clips/actions/import-loom-recording.ts +53 -98
  58. package/corpus/templates/clips/actions/lib/loom-import-job.ts +260 -0
  59. package/corpus/templates/clips/app/components/library/library-layout.tsx +0 -7
  60. package/corpus/templates/clips/app/routes/_app.library._index.tsx +1 -1
  61. package/corpus/templates/clips/app/routes/_index.tsx +1 -1
  62. package/corpus/templates/clips/app/routes/r.$recordingId.tsx +6 -0
  63. package/corpus/templates/clips/app/routes/record.tsx +5 -0
  64. package/corpus/templates/clips/changelog/2026-07-25-app-branding-now-uses-the-product-name-without-the-agent-nat.md +6 -0
  65. package/corpus/templates/clips/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  66. package/corpus/templates/clips/server/db/schema.ts +2 -0
  67. package/corpus/templates/clips/server/lib/post-finalize-dispatch.ts +2 -1
  68. package/corpus/templates/clips/server/plugins/auth.ts +1 -1
  69. package/corpus/templates/clips/server/plugins/db.ts +8 -0
  70. package/corpus/templates/clips/server/routes/api/_agent-native-background/post-finalize-worker.post.ts +56 -3
  71. package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +1 -39
  72. package/corpus/templates/content/app/routes/_app._index.tsx +1 -2
  73. package/corpus/templates/content/changelog/2026-07-25-app-branding-now-uses-the-product-name-without-the-agent-nat.md +6 -0
  74. package/corpus/templates/content/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  75. package/corpus/templates/content/package.json +1 -1
  76. package/corpus/templates/content/public/manifest.json +1 -1
  77. package/corpus/templates/content/server/plugins/auth.ts +1 -1
  78. package/corpus/templates/design/actions/edit-design.ts +66 -27
  79. package/corpus/templates/design/app/components/layout/Sidebar.tsx +0 -2
  80. package/corpus/templates/design/app/routes/_index.tsx +1 -1
  81. package/corpus/templates/design/changelog/2026-07-25-app-branding-now-uses-the-product-name-without-the-agent-nat.md +6 -0
  82. package/corpus/templates/design/changelog/2026-07-25-design-edits-retry-concurrent-changes.md +6 -0
  83. package/corpus/templates/design/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  84. package/corpus/templates/design/server/plugins/auth.ts +1 -1
  85. package/corpus/templates/design/server/source-workspace.ts +5 -1
  86. package/corpus/templates/dispatch/app/dispatch-extensions.tsx +1 -10
  87. package/corpus/templates/dispatch/app/routes/overview.tsx +1 -1
  88. package/corpus/templates/dispatch/changelog/2026-07-25-app-branding-now-uses-the-product-name-without-the-agent-nat.md +6 -0
  89. package/corpus/templates/dispatch/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  90. package/corpus/templates/dispatch/package.json +1 -1
  91. package/corpus/templates/dispatch/public/manifest.json +1 -1
  92. package/corpus/templates/forms/.agents/skills/form-responses/SKILL.md +6 -4
  93. package/corpus/templates/forms/actions/create-form.ts +5 -1
  94. package/corpus/templates/forms/actions/export-responses.ts +22 -11
  95. package/corpus/templates/forms/actions/update-form.ts +5 -1
  96. package/corpus/templates/forms/app/components/layout/Sidebar.tsx +0 -35
  97. package/corpus/templates/forms/changelog/2026-07-25-app-branding-now-uses-the-product-name-without-the-agent-nat.md +6 -0
  98. package/corpus/templates/forms/changelog/2026-07-25-fields-can-be-created-without-ids.md +6 -0
  99. package/corpus/templates/forms/changelog/2026-07-25-response-exports-use-file-storage.md +6 -0
  100. package/corpus/templates/forms/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  101. package/corpus/templates/forms/package.json +1 -1
  102. package/corpus/templates/forms/public/manifest.json +1 -1
  103. package/corpus/templates/forms/server/lib/validate-fields.ts +43 -0
  104. package/corpus/templates/forms/server/plugins/auth.ts +1 -1
  105. package/corpus/templates/macros/app/components/layout/AppLayout.tsx +0 -2
  106. package/corpus/templates/macros/changelog/2026-07-25-app-branding-now-uses-the-product-name-without-the-agent-nat.md +6 -0
  107. package/corpus/templates/macros/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  108. package/corpus/templates/macros/package.json +1 -1
  109. package/corpus/templates/macros/server/plugins/auth.ts +2 -2
  110. package/corpus/templates/mail/app/components/layout/AppLayout.tsx +0 -39
  111. package/corpus/templates/mail/app/routes/$view.$threadId.tsx +1 -1
  112. package/corpus/templates/mail/app/routes/$view.tsx +1 -1
  113. package/corpus/templates/mail/app/routes/_index.tsx +1 -1
  114. package/corpus/templates/mail/changelog/2026-07-25-app-branding-now-uses-the-product-name-without-the-agent-nat.md +6 -0
  115. package/corpus/templates/mail/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  116. package/corpus/templates/mail/package.json +1 -1
  117. package/corpus/templates/mail/public/manifest.json +1 -1
  118. package/corpus/templates/mail/server/plugins/auth.ts +1 -1
  119. package/corpus/templates/plan/agent-native.app-skill.json +1 -1
  120. package/corpus/templates/plan/app/components/layout/Sidebar.tsx +4 -9
  121. package/corpus/templates/plan/app/lib/app-config.ts +1 -1
  122. package/corpus/templates/plan/changelog/2026-07-25-app-branding-now-uses-the-product-name-without-the-agent-nat.md +6 -0
  123. package/corpus/templates/plan/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  124. package/corpus/templates/plan/package.json +1 -1
  125. package/corpus/templates/plan/public/manifest.json +1 -1
  126. package/corpus/templates/plan/server/plugins/auth.ts +1 -1
  127. package/corpus/templates/slides/actions/extract-pdf.ts +4 -4
  128. package/corpus/templates/slides/actions/import-file.ts +3 -4
  129. package/corpus/templates/slides/app/components/layout/Sidebar.tsx +0 -2
  130. package/corpus/templates/slides/app/routes/_index.tsx +1 -1
  131. package/corpus/templates/slides/changelog/2026-07-25-app-branding-now-uses-the-product-name-without-the-agent-nat.md +6 -0
  132. package/corpus/templates/slides/changelog/2026-07-25-gemini-image-models-updated.md +6 -0
  133. package/corpus/templates/slides/changelog/2026-07-25-pdf-imports-tolerate-missing-canvas.md +6 -0
  134. package/corpus/templates/slides/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  135. package/corpus/templates/slides/package.json +1 -1
  136. package/corpus/templates/slides/public/manifest.json +1 -1
  137. package/corpus/templates/slides/server/handlers/image-providers/gemini.ts +5 -2
  138. package/corpus/templates/slides/server/lib/pdf-parse-setup.ts +150 -0
  139. package/corpus/templates/slides/server/plugins/auth.ts +1 -1
  140. package/dist/a2a/client.d.ts.map +1 -1
  141. package/dist/a2a/client.js +58 -4
  142. package/dist/a2a/client.js.map +1 -1
  143. package/dist/agent/production-agent.d.ts.map +1 -1
  144. package/dist/agent/production-agent.js +63 -1
  145. package/dist/agent/production-agent.js.map +1 -1
  146. package/dist/agent/run-store.d.ts.map +1 -1
  147. package/dist/agent/run-store.js +49 -0
  148. package/dist/agent/run-store.js.map +1 -1
  149. package/dist/client/settings/SettingsPanel.js +9 -9
  150. package/dist/client/settings/SettingsPanel.js.map +1 -1
  151. package/dist/client/settings/SettingsTabsPage.d.ts.map +1 -1
  152. package/dist/client/settings/SettingsTabsPage.js +7 -4
  153. package/dist/client/settings/SettingsTabsPage.js.map +1 -1
  154. package/dist/collab/awareness.d.ts +2 -2
  155. package/dist/collab/awareness.d.ts.map +1 -1
  156. package/dist/collab/routes.d.ts +1 -1
  157. package/dist/extensions/url-safety.d.ts +9 -16
  158. package/dist/extensions/url-safety.d.ts.map +1 -1
  159. package/dist/extensions/url-safety.js +48 -4
  160. package/dist/extensions/url-safety.js.map +1 -1
  161. package/dist/file-upload/actions/upload-image.d.ts +1 -1
  162. package/dist/notifications/routes.d.ts +3 -3
  163. package/dist/observability/routes.d.ts +3 -3
  164. package/dist/secrets/routes.d.ts +9 -9
  165. package/dist/server/builder-design-systems.js +1 -1
  166. package/dist/server/builder-design-systems.js.map +1 -1
  167. package/dist/server/transcribe-voice.d.ts +1 -1
  168. package/dist/templates/chat/app/components/layout/Sidebar.tsx +0 -7
  169. package/dist/templates/chat/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  170. package/dist/templates/default/app/root.tsx +1 -1
  171. package/dist/templates/default/public/manifest.json +2 -2
  172. package/dist/vite/client.d.ts.map +1 -1
  173. package/dist/vite/client.js +64 -1
  174. package/dist/vite/client.js.map +1 -1
  175. package/package.json +3 -3
  176. package/src/a2a/client.ts +57 -4
  177. package/src/agent/production-agent.ts +65 -1
  178. package/src/agent/run-store.ts +61 -1
  179. package/src/client/settings/SettingsPanel.tsx +9 -9
  180. package/src/client/settings/SettingsTabsPage.tsx +12 -2
  181. package/src/extensions/url-safety.ts +67 -4
  182. package/src/server/builder-design-systems.ts +1 -1
  183. package/src/templates/chat/app/components/layout/Sidebar.tsx +0 -7
  184. package/src/templates/chat/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  185. package/src/templates/default/app/root.tsx +1 -1
  186. package/src/templates/default/public/manifest.json +2 -2
  187. package/src/vite/client.ts +64 -3
@@ -0,0 +1,169 @@
1
+ import type { Dialect } from "@agent-native/core/db";
2
+
3
+ import type { DashboardPanelLike } from "./dashboard-time-scope.js";
4
+
5
+ const POSTGRES_DATE_BOUND =
6
+ "to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD')";
7
+ const SQLITE_DATE_BOUND = "date('now', '-365 days')";
8
+
9
+ /**
10
+ * Fixes for first-party dashboard panels found, via a full-org audit
11
+ * (2026-07-25), reading `analytics_events` with no date bound at all in some
12
+ * or all of their scan units — a full 6.7M-row table scan on every render.
13
+ * Unlike the id-keyed replacements in first-party-metric-catalog.ts (which
14
+ * repair one specific dashboard's known panel ids), these are matched purely
15
+ * by exact SQL text so the same fix applies wherever the identical broken
16
+ * query was cloned into a different dashboard under a different panel id.
17
+ * Each entry only changes the added bound (`AND event_date >= ...365 days`,
18
+ * or the exact same bound already live on the repaired canonical dashboard
19
+ * for the retention-cohort case) — never the query's selected columns,
20
+ * grouping, or business logic.
21
+ */
22
+ export type UnboundedFirstPartyPanelFix = {
23
+ legacySql: string;
24
+ sql: string;
25
+ };
26
+
27
+ function dialectBoundedSql(sql: string, dialect: Dialect): string {
28
+ return dialect === "postgres"
29
+ ? sql
30
+ : sql.split(POSTGRES_DATE_BOUND).join(SQLITE_DATE_BOUND);
31
+ }
32
+
33
+ export const UNBOUNDED_FIRST_PARTY_PANEL_FIXES: readonly UnboundedFirstPartyPanelFix[] =
34
+ [
35
+ {
36
+ legacySql:
37
+ "SELECT event_date AS date, COUNT(*) AS count FROM analytics_events WHERE event_name = 'session status' GROUP BY event_date ORDER BY date",
38
+ sql: "SELECT event_date AS date, COUNT(*) AS count FROM analytics_events WHERE event_name = 'session status' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') GROUP BY event_date ORDER BY date",
39
+ },
40
+ {
41
+ legacySql:
42
+ "SELECT COALESCE(NULLIF(signed_in, ''), 'unknown') AS signed_in, COUNT(*) AS count FROM analytics_events WHERE event_name = 'session status' GROUP BY COALESCE(NULLIF(signed_in, ''), 'unknown') ORDER BY signed_in",
43
+ sql: "SELECT COALESCE(NULLIF(signed_in, ''), 'unknown') AS signed_in, COUNT(*) AS count FROM analytics_events WHERE event_name = 'session status' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') GROUP BY COALESCE(NULLIF(signed_in, ''), 'unknown') ORDER BY signed_in",
44
+ },
45
+ {
46
+ legacySql:
47
+ "SELECT COALESCE(NULLIF(app, ''), 'unknown') AS app, COUNT(*) AS count FROM analytics_events WHERE event_name = 'session status' GROUP BY COALESCE(NULLIF(app, ''), 'unknown') ORDER BY count DESC LIMIT 20",
48
+ sql: "SELECT COALESCE(NULLIF(app, ''), 'unknown') AS app, COUNT(*) AS count FROM analytics_events WHERE event_name = 'session status' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') GROUP BY COALESCE(NULLIF(app, ''), 'unknown') ORDER BY count DESC LIMIT 20",
49
+ },
50
+ {
51
+ legacySql:
52
+ "SELECT COUNT(*) AS count FROM analytics_events WHERE event_name = 'skills_cli started'",
53
+ sql: "SELECT COUNT(*) AS count FROM analytics_events WHERE event_name = 'skills_cli started' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD')",
54
+ },
55
+ {
56
+ legacySql:
57
+ "SELECT COUNT(DISTINCT anonymous_id) AS count FROM analytics_events WHERE event_name LIKE 'skills_cli %'",
58
+ sql: "SELECT COUNT(DISTINCT anonymous_id) AS count FROM analytics_events WHERE event_name LIKE 'skills_cli %' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD')",
59
+ },
60
+ {
61
+ legacySql:
62
+ "SELECT COUNT(DISTINCT session_id) AS count FROM analytics_events WHERE event_name = 'skills_cli install completed'",
63
+ sql: "SELECT COUNT(DISTINCT session_id) AS count FROM analytics_events WHERE event_name = 'skills_cli install completed' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD')",
64
+ },
65
+ {
66
+ legacySql:
67
+ "WITH started AS (SELECT COUNT(DISTINCT session_id) AS n FROM analytics_events WHERE event_name = 'skills_cli started'), completed AS (SELECT COUNT(DISTINCT session_id) AS n FROM analytics_events WHERE event_name = 'skills_cli install completed') SELECT CASE WHEN started.n = 0 THEN 0 ELSE ROUND(completed.n * 100.0 / started.n) END AS rate FROM started, completed",
68
+ sql: "WITH started AS (SELECT COUNT(DISTINCT session_id) AS n FROM analytics_events WHERE event_name = 'skills_cli started' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD')), completed AS (SELECT COUNT(DISTINCT session_id) AS n FROM analytics_events WHERE event_name = 'skills_cli install completed' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD')) SELECT CASE WHEN started.n = 0 THEN 0 ELSE ROUND(completed.n * 100.0 / started.n) END AS rate FROM started, completed",
69
+ },
70
+ {
71
+ legacySql:
72
+ "WITH steps AS (SELECT 1 AS step_order, 'Started' AS step, COUNT(DISTINCT session_id) AS count FROM analytics_events WHERE event_name = 'skills_cli started' UNION ALL SELECT 2, 'Skills prompted', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli skills prompted' UNION ALL SELECT 3, 'Skills selected', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli skills selected' UNION ALL SELECT 4, 'Clients selected', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli clients selected' UNION ALL SELECT 5, 'Scope selected', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli scope selected' UNION ALL SELECT 6, 'Install completed', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli install completed' UNION ALL SELECT 7, 'Completed', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli completed') SELECT step, count FROM steps ORDER BY step_order",
73
+ sql: "WITH steps AS (SELECT 1 AS step_order, 'Started' AS step, COUNT(DISTINCT session_id) AS count FROM analytics_events WHERE event_name = 'skills_cli started' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') UNION ALL SELECT 2, 'Skills prompted', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli skills prompted' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') UNION ALL SELECT 3, 'Skills selected', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli skills selected' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') UNION ALL SELECT 4, 'Clients selected', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli clients selected' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') UNION ALL SELECT 5, 'Scope selected', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli scope selected' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') UNION ALL SELECT 6, 'Install completed', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli install completed' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') UNION ALL SELECT 7, 'Completed', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli completed' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD')) SELECT step, count FROM steps ORDER BY step_order",
74
+ },
75
+ {
76
+ legacySql:
77
+ "SELECT trim(s) AS skill, COUNT(*) AS count FROM analytics_events, LATERAL unnest(string_to_array(properties::jsonb ->> 'selected', ',')) AS s WHERE event_name = 'skills_cli skills selected' AND (properties::jsonb ->> 'selected') <> '' GROUP BY trim(s) ORDER BY count DESC LIMIT 30",
78
+ sql: "SELECT trim(s) AS skill, COUNT(*) AS count FROM analytics_events, LATERAL unnest(string_to_array(properties::jsonb ->> 'selected', ',')) AS s WHERE event_name = 'skills_cli skills selected' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') AND (properties::jsonb ->> 'selected') <> '' GROUP BY trim(s) ORDER BY count DESC LIMIT 30",
79
+ },
80
+ {
81
+ legacySql:
82
+ "SELECT substr(timestamp, 1, 10) AS date, COUNT(*) AS count FROM analytics_events WHERE event_name = 'skills_cli started' GROUP BY substr(timestamp, 1, 10) ORDER BY date",
83
+ sql: "SELECT substr(timestamp, 1, 10) AS date, COUNT(*) AS count FROM analytics_events WHERE event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') AND event_name = 'skills_cli started' GROUP BY substr(timestamp, 1, 10) ORDER BY date",
84
+ },
85
+ {
86
+ legacySql:
87
+ "SELECT COALESCE(NULLIF(properties::jsonb ->> 'cli', ''), 'unknown') AS cli, COUNT(*) AS count FROM analytics_events WHERE event_name = 'skills_cli started' GROUP BY COALESCE(NULLIF(properties::jsonb ->> 'cli', ''), 'unknown') ORDER BY count DESC",
88
+ sql: "SELECT COALESCE(NULLIF(properties::jsonb ->> 'cli', ''), 'unknown') AS cli, COUNT(*) AS count FROM analytics_events WHERE event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') AND event_name = 'skills_cli started' GROUP BY COALESCE(NULLIF(properties::jsonb ->> 'cli', ''), 'unknown') ORDER BY count DESC",
89
+ },
90
+ {
91
+ legacySql:
92
+ "SELECT COALESCE(NULLIF(properties::jsonb ->> 'platform', ''), 'unknown') AS platform, COUNT(*) AS count FROM analytics_events WHERE event_name = 'skills_cli started' GROUP BY COALESCE(NULLIF(properties::jsonb ->> 'platform', ''), 'unknown') ORDER BY count DESC",
93
+ sql: "SELECT COALESCE(NULLIF(properties::jsonb ->> 'platform', ''), 'unknown') AS platform, COUNT(*) AS count FROM analytics_events WHERE event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') AND event_name = 'skills_cli started' GROUP BY COALESCE(NULLIF(properties::jsonb ->> 'platform', ''), 'unknown') ORDER BY count DESC",
94
+ },
95
+ {
96
+ legacySql:
97
+ "SELECT COALESCE(NULLIF(properties::jsonb ->> 'scope', ''), 'unknown') AS scope, COUNT(*) AS count FROM analytics_events WHERE event_name = 'skills_cli scope selected' GROUP BY COALESCE(NULLIF(properties::jsonb ->> 'scope', ''), 'unknown') ORDER BY count DESC",
98
+ sql: "SELECT COALESCE(NULLIF(properties::jsonb ->> 'scope', ''), 'unknown') AS scope, COUNT(*) AS count FROM analytics_events WHERE event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') AND event_name = 'skills_cli scope selected' GROUP BY COALESCE(NULLIF(properties::jsonb ->> 'scope', ''), 'unknown') ORDER BY count DESC",
99
+ },
100
+ {
101
+ legacySql:
102
+ "SELECT trim(c) AS client, COUNT(*) AS count FROM analytics_events, LATERAL unnest(string_to_array(properties::jsonb ->> 'clients', ',')) AS c WHERE event_name = 'skills_cli clients selected' AND (properties::jsonb ->> 'clients') <> '' GROUP BY trim(c) ORDER BY count DESC LIMIT 30",
103
+ sql: "SELECT trim(c) AS client, COUNT(*) AS count FROM analytics_events, LATERAL unnest(string_to_array(properties::jsonb ->> 'clients', ',')) AS c WHERE event_name = 'skills_cli clients selected' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') AND (properties::jsonb ->> 'clients') <> '' GROUP BY trim(c) ORDER BY count DESC LIMIT 30",
104
+ },
105
+ {
106
+ legacySql:
107
+ "WITH steps AS (SELECT 1 AS step_order, 'Started' AS step, COUNT(DISTINCT session_id) AS reached FROM analytics_events WHERE event_name = 'skills_cli started' UNION ALL SELECT 2, 'Skills prompted', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli skills prompted' UNION ALL SELECT 3, 'Skills selected', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli skills selected' UNION ALL SELECT 4, 'Clients selected', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli clients selected' UNION ALL SELECT 5, 'Scope selected', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli scope selected' UNION ALL SELECT 6, 'Install completed', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli install completed' UNION ALL SELECT 7, 'Completed', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli completed'), start_total AS (SELECT COUNT(DISTINCT session_id) AS n FROM analytics_events WHERE event_name = 'skills_cli started') SELECT steps.step, steps.reached, CASE WHEN start_total.n = 0 THEN 0 ELSE ROUND(steps.reached * 100.0 / start_total.n) END AS pct_of_start FROM steps, start_total ORDER BY steps.step_order",
108
+ sql: "WITH steps AS (SELECT 1 AS step_order, 'Started' AS step, COUNT(DISTINCT session_id) AS reached FROM analytics_events WHERE event_name = 'skills_cli started' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') UNION ALL SELECT 2, 'Skills prompted', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli skills prompted' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') UNION ALL SELECT 3, 'Skills selected', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli skills selected' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') UNION ALL SELECT 4, 'Clients selected', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli clients selected' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') UNION ALL SELECT 5, 'Scope selected', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli scope selected' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') UNION ALL SELECT 6, 'Install completed', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli install completed' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') UNION ALL SELECT 7, 'Completed', COUNT(DISTINCT session_id) FROM analytics_events WHERE event_name = 'skills_cli completed' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD')), start_total AS (SELECT COUNT(DISTINCT session_id) AS n FROM analytics_events WHERE event_name = 'skills_cli started' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD')) SELECT steps.step, steps.reached, CASE WHEN start_total.n = 0 THEN 0 ELSE ROUND(steps.reached * 100.0 / start_total.n) END AS pct_of_start FROM steps, start_total ORDER BY steps.step_order",
109
+ },
110
+ {
111
+ legacySql: "SELECT COUNT(*) AS value FROM analytics_events",
112
+ sql: "SELECT COUNT(*) AS value FROM analytics_events WHERE event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD')",
113
+ },
114
+ {
115
+ legacySql:
116
+ "SELECT COUNT(DISTINCT session_id) AS value FROM analytics_events",
117
+ sql: "SELECT COUNT(DISTINCT session_id) AS value FROM analytics_events WHERE event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD')",
118
+ },
119
+ {
120
+ legacySql:
121
+ "SELECT event_name AS label, COUNT(*) AS value FROM analytics_events GROUP BY event_name ORDER BY value DESC LIMIT 8",
122
+ sql: "SELECT event_name AS label, COUNT(*) AS value FROM analytics_events WHERE event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') GROUP BY event_name ORDER BY value DESC LIMIT 8",
123
+ },
124
+ {
125
+ legacySql:
126
+ "SELECT CASE WHEN signed_in = 'true' THEN 'Signed In' ELSE 'Anonymous' END AS user_type, COUNT(*) AS events FROM analytics_events GROUP BY signed_in",
127
+ sql: "SELECT CASE WHEN signed_in = 'true' THEN 'Signed In' ELSE 'Anonymous' END AS user_type, COUNT(*) AS events FROM analytics_events WHERE event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') GROUP BY signed_in",
128
+ },
129
+ {
130
+ legacySql:
131
+ "SELECT timestamp, event_name, app, signed_in FROM analytics_events ORDER BY timestamp DESC LIMIT 50",
132
+ sql: "SELECT timestamp, event_name, app, signed_in FROM analytics_events WHERE event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD') ORDER BY timestamp DESC LIMIT 50",
133
+ },
134
+ {
135
+ legacySql:
136
+ "WITH base AS (SELECT NULLIF(user_key, '') AS user_key, event_date AS event_date, user_id FROM analytics_events WHERE event_name = 'session status' AND signed_in = 'true' AND NULLIF(user_key, '') IS NOT NULL AND lower(COALESCE(NULLIF(template, ''), NULLIF(properties::jsonb ->> 'templateId', ''), NULLIF(properties::jsonb ->> 'agent_native_template', ''), NULLIF(properties::jsonb ->> 'agentNativeTemplate', ''), NULLIF(app, ''), NULLIF(properties::jsonb ->> 'agent_native_app', ''), NULLIF(properties::jsonb ->> 'agentNativeApp', ''), 'unknown')) <> 'docs' AND ('{{emailFilter}}' IN ('', 'all') OR ('{{emailFilter}}' = 'exclude_builder' AND lower(coalesce(user_id, '')) NOT LIKE '%@builder.io') OR ('{{emailFilter}}' = 'only_builder' AND lower(coalesce(user_id, '')) LIKE '%@builder.io'))), first_seen AS (SELECT user_key, MIN(event_date) AS cohort_date FROM base GROUP BY user_key), anchor_dates AS (SELECT DISTINCT cohort_date AS date FROM first_seen WHERE cohort_date <= to_char(CURRENT_DATE - INTERVAL '14 days', 'YYYY-MM-DD') AND ('{{timeRange}}' IN ('', 'all') OR ('{{timeRange}}' = '7d' AND cohort_date >= to_char(CURRENT_DATE - INTERVAL '7 days', 'YYYY-MM-DD')) OR ('{{timeRange}}' = '30d' AND cohort_date >= to_char(CURRENT_DATE - INTERVAL '30 days', 'YYYY-MM-DD')) OR ('{{timeRange}}' = '90d' AND cohort_date >= to_char(CURRENT_DATE - INTERVAL '90 days', 'YYYY-MM-DD')) OR ('{{timeRange}}' = '180d' AND cohort_date >= to_char(CURRENT_DATE - INTERVAL '180 days', 'YYYY-MM-DD')) OR ('{{timeRange}}' = '365d' AND cohort_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD')))), cohort_windows AS (SELECT a.date, f.user_key, f.cohort_date FROM anchor_dates a JOIN first_seen f ON f.cohort_date >= to_char(a.date::date - INTERVAL '6 days', 'YYYY-MM-DD') AND f.cohort_date <= a.date), cohort_sizes AS (SELECT date, COUNT(DISTINCT user_key) AS users FROM cohort_windows GROUP BY date), periods AS (SELECT '1-7d return' AS period UNION ALL SELECT '7-14d return' AS period), retained AS (SELECT cw.date, '1-7d return' AS period, COUNT(DISTINCT cw.user_key) AS retained FROM cohort_windows cw JOIN base b ON b.user_key = cw.user_key AND b.event_date > cw.cohort_date AND b.event_date <= to_char(cw.cohort_date::date + INTERVAL '7 days', 'YYYY-MM-DD') GROUP BY cw.date UNION ALL SELECT cw.date, '7-14d return' AS period, COUNT(DISTINCT cw.user_key) AS retained FROM cohort_windows cw JOIN base b ON b.user_key = cw.user_key AND b.event_date >= to_char(cw.cohort_date::date + INTERVAL '7 days', 'YYYY-MM-DD') AND b.event_date <= to_char(cw.cohort_date::date + INTERVAL '14 days', 'YYYY-MM-DD') GROUP BY cw.date) SELECT cs.date, p.period, COALESCE(r.retained, 0) AS retained_users, cs.users AS cohort_users, COALESCE(r.retained::float / NULLIF(cs.users, 0), 0) AS rate FROM cohort_sizes cs CROSS JOIN periods p LEFT JOIN retained r ON r.date = cs.date AND r.period = p.period WHERE cs.users >= 5 ORDER BY cs.date, p.period",
137
+ sql: "WITH base AS (SELECT NULLIF(user_key, '') AS user_key, event_date AS event_date, user_id FROM analytics_events WHERE event_name = 'session status' AND signed_in = 'true' AND NULLIF(user_key, '') IS NOT NULL AND lower(COALESCE(NULLIF(template, ''), NULLIF(properties::jsonb ->> 'templateId', ''), NULLIF(properties::jsonb ->> 'agent_native_template', ''), NULLIF(properties::jsonb ->> 'agentNativeTemplate', ''), NULLIF(app, ''), NULLIF(properties::jsonb ->> 'agent_native_app', ''), NULLIF(properties::jsonb ->> 'agentNativeApp', ''), 'unknown')) <> 'docs' AND ('{{emailFilter}}' IN ('', 'all') OR ('{{emailFilter}}' = 'exclude_builder' AND lower(coalesce(user_id, '')) NOT LIKE '%@builder.io') OR ('{{emailFilter}}' = 'only_builder' AND lower(coalesce(user_id, '')) LIKE '%@builder.io')) AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD')), first_seen AS (SELECT user_key, MIN(event_date) AS cohort_date FROM base GROUP BY user_key), anchor_dates AS (SELECT DISTINCT cohort_date AS date FROM first_seen WHERE cohort_date <= to_char(CURRENT_DATE - INTERVAL '14 days', 'YYYY-MM-DD') AND (cohort_date <= to_char(CURRENT_DATE, 'YYYY-MM-DD') AND ('{{timeRange}}' IN ('', 'all') OR ('{{timeRange}}' = '7d' AND cohort_date >= to_char(CURRENT_DATE - INTERVAL '7 days', 'YYYY-MM-DD')) OR ('{{timeRange}}' = '30d' AND cohort_date >= to_char(CURRENT_DATE - INTERVAL '30 days', 'YYYY-MM-DD')) OR ('{{timeRange}}' = '90d' AND cohort_date >= to_char(CURRENT_DATE - INTERVAL '90 days', 'YYYY-MM-DD')) OR ('{{timeRange}}' = '180d' AND cohort_date >= to_char(CURRENT_DATE - INTERVAL '180 days', 'YYYY-MM-DD')) OR ('{{timeRange}}' = '365d' AND cohort_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD'))))), cohort_windows AS (SELECT a.date, f.user_key, f.cohort_date FROM anchor_dates a JOIN first_seen f ON f.cohort_date >= to_char(a.date::date - INTERVAL '6 days', 'YYYY-MM-DD') AND f.cohort_date <= a.date), cohort_sizes AS (SELECT date, COUNT(DISTINCT user_key) AS users FROM cohort_windows GROUP BY date), periods AS (SELECT '1-7d return' AS period UNION ALL SELECT '7-14d return' AS period), retained AS (SELECT cw.date, '1-7d return' AS period, COUNT(DISTINCT cw.user_key) AS retained FROM cohort_windows cw JOIN base b ON b.user_key = cw.user_key AND b.event_date > cw.cohort_date AND b.event_date <= to_char(cw.cohort_date::date + INTERVAL '7 days', 'YYYY-MM-DD') GROUP BY cw.date UNION ALL SELECT cw.date, '7-14d return' AS period, COUNT(DISTINCT cw.user_key) AS retained FROM cohort_windows cw JOIN base b ON b.user_key = cw.user_key AND b.event_date >= to_char(cw.cohort_date::date + INTERVAL '7 days', 'YYYY-MM-DD') AND b.event_date <= to_char(cw.cohort_date::date + INTERVAL '14 days', 'YYYY-MM-DD') GROUP BY cw.date) SELECT cs.date, p.period, COALESCE(r.retained, 0) AS retained_users, cs.users AS cohort_users, COALESCE(r.retained::float / NULLIF(cs.users, 0), 0) AS rate FROM cohort_sizes cs CROSS JOIN periods p LEFT JOIN retained r ON r.date = cs.date AND r.period = p.period WHERE cs.users >= 5 ORDER BY cs.date, p.period",
138
+ },
139
+ {
140
+ legacySql:
141
+ "WITH offsets AS (SELECT (ROW_NUMBER() OVER (ORDER BY event_date) - 1)::int AS n FROM analytics_events LIMIT 800), signup_events AS (SELECT event_date AS date, COALESCE(NULLIF(template, ''), NULLIF(properties::jsonb ->> 'templateId', ''), NULLIF(properties::jsonb ->> 'agent_native_template', ''), NULLIF(properties::jsonb ->> 'agentNativeTemplate', ''), NULLIF(app, ''), NULLIF(properties::jsonb ->> 'agent_native_app', ''), NULLIF(properties::jsonb ->> 'agentNativeApp', ''), 'unknown') AS template FROM analytics_events WHERE event_name = 'signup' AND ('{{timeRange}}' IN ('', 'all') OR ('{{timeRange}}' = '7d' AND event_date >= to_char(CURRENT_DATE - INTERVAL '7 days', 'YYYY-MM-DD')) OR ('{{timeRange}}' = '30d' AND event_date >= to_char(CURRENT_DATE - INTERVAL '30 days', 'YYYY-MM-DD')) OR ('{{timeRange}}' = '90d' AND event_date >= to_char(CURRENT_DATE - INTERVAL '90 days', 'YYYY-MM-DD')) OR ('{{timeRange}}' = '180d' AND event_date >= to_char(CURRENT_DATE - INTERVAL '180 days', 'YYYY-MM-DD')) OR ('{{timeRange}}' = '365d' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD'))) AND ('{{emailFilter}}' IN ('', 'all') OR ('{{emailFilter}}' = 'exclude_builder' AND lower(coalesce(user_id, '')) NOT LIKE '%@builder.io') OR ('{{emailFilter}}' = 'only_builder' AND lower(coalesce(user_id, '')) LIKE '%@builder.io'))), bounds AS (SELECT MIN(date::date) AS start_date, MAX(date::date) AS end_date FROM signup_events), dates AS (SELECT to_char(bounds.start_date + offsets.n, 'YYYY-MM-DD') AS date FROM bounds CROSS JOIN offsets WHERE bounds.start_date IS NOT NULL AND bounds.start_date + offsets.n <= bounds.end_date), templates AS (SELECT DISTINCT template FROM signup_events), daily AS (SELECT date, template, COUNT(*) AS count FROM signup_events GROUP BY date, template) SELECT dates.date, templates.template, COALESCE(daily.count, 0) AS count FROM dates CROSS JOIN templates LEFT JOIN daily ON daily.date = dates.date AND daily.template = templates.template ORDER BY dates.date, templates.template",
142
+ sql: "WITH signup_events AS (SELECT event_date AS date, COALESCE(NULLIF(template, ''), NULLIF(properties::jsonb ->> 'templateId', ''), NULLIF(properties::jsonb ->> 'agent_native_template', ''), NULLIF(properties::jsonb ->> 'agentNativeTemplate', ''), NULLIF(app, ''), NULLIF(properties::jsonb ->> 'agent_native_app', ''), NULLIF(properties::jsonb ->> 'agentNativeApp', ''), 'unknown') AS template FROM analytics_events WHERE event_name = 'signup' AND ('{{timeRange}}' IN ('', 'all') OR ('{{timeRange}}' = '7d' AND event_date >= to_char(CURRENT_DATE - INTERVAL '7 days', 'YYYY-MM-DD')) OR ('{{timeRange}}' = '30d' AND event_date >= to_char(CURRENT_DATE - INTERVAL '30 days', 'YYYY-MM-DD')) OR ('{{timeRange}}' = '90d' AND event_date >= to_char(CURRENT_DATE - INTERVAL '90 days', 'YYYY-MM-DD')) OR ('{{timeRange}}' = '180d' AND event_date >= to_char(CURRENT_DATE - INTERVAL '180 days', 'YYYY-MM-DD')) OR ('{{timeRange}}' = '365d' AND event_date >= to_char(CURRENT_DATE - INTERVAL '365 days', 'YYYY-MM-DD'))) AND ('{{emailFilter}}' IN ('', 'all') OR ('{{emailFilter}}' = 'exclude_builder' AND lower(coalesce(user_id, '')) NOT LIKE '%@builder.io') OR ('{{emailFilter}}' = 'only_builder' AND lower(coalesce(user_id, '')) LIKE '%@builder.io'))), bounds AS (SELECT MIN(date::date) AS start_date, MAX(date::date) AS end_date FROM signup_events), dates AS (SELECT to_char(d, 'YYYY-MM-DD') AS date FROM bounds, generate_series(bounds.start_date, bounds.end_date, INTERVAL '1 day') AS d WHERE bounds.start_date IS NOT NULL), templates AS (SELECT DISTINCT template FROM signup_events), daily AS (SELECT date, template, COUNT(*) AS count FROM signup_events GROUP BY date, template) SELECT dates.date, templates.template, COALESCE(daily.count, 0) AS count FROM dates CROSS JOIN templates LEFT JOIN daily ON daily.date = dates.date AND daily.template = templates.template ORDER BY dates.date, templates.template",
143
+ },
144
+ ];
145
+
146
+ export function repairUnboundedFirstPartyPanels(
147
+ config: Record<string, unknown>,
148
+ dialect: Dialect = "postgres",
149
+ ): { config: Record<string, unknown>; changed: boolean } {
150
+ if (!Array.isArray(config.panels)) return { config, changed: false };
151
+
152
+ const fixBySql = new Map(
153
+ UNBOUNDED_FIRST_PARTY_PANEL_FIXES.map((fix) => [fix.legacySql, fix.sql]),
154
+ );
155
+ let changed = false;
156
+ const panels = config.panels.map((rawPanel) => {
157
+ if (!rawPanel || typeof rawPanel !== "object") return rawPanel;
158
+ const panel = rawPanel as DashboardPanelLike & Record<string, unknown>;
159
+ if (panel.source !== "first-party" || typeof panel.sql !== "string") {
160
+ return rawPanel;
161
+ }
162
+ const fixedSql = fixBySql.get(panel.sql);
163
+ if (fixedSql === undefined) return rawPanel;
164
+ changed = true;
165
+ return { ...panel, sql: dialectBoundedSql(fixedSql, dialect) };
166
+ });
167
+ if (!changed) return { config, changed: false };
168
+ return { config: { ...config, panels }, changed: true };
169
+ }
@@ -13,7 +13,7 @@ export default createAuthPlugin({
13
13
  "/_agent-native/actions/get-public-status-page",
14
14
  ],
15
15
  marketing: {
16
- appName: "Agent-Native Analytics",
16
+ appName: "Analytics",
17
17
  tagline:
18
18
  "Your AI agent queries your data sources, builds dashboards, and answers business questions alongside you.",
19
19
  features: [
@@ -8,7 +8,10 @@ import {
8
8
  // startup so the dashboard / analysis share actions know where to dispatch.
9
9
  import "../db/index.js";
10
10
  import * as schema from "../db/schema.js";
11
- import { repairPersistedFirstPartyDashboardQueries } from "../lib/first-party-dashboard-repair.js";
11
+ import {
12
+ repairPersistedFirstPartyDashboardQueries,
13
+ repairUnboundedFirstPartyPanelsAcrossDashboards,
14
+ } from "../lib/first-party-dashboard-repair.js";
12
15
 
13
16
  /**
14
17
  * Every Drizzle table exported from schema.ts. Filters out type-only and
@@ -1284,6 +1287,29 @@ const runAnalyticsMigrations = runMigrations(
1284
1287
  ALTER TABLE dashboard_report_subscriptions ADD COLUMN IF NOT EXISTS last_capture_error TEXT;
1285
1288
  `,
1286
1289
  },
1290
+ // First-party dashboard panel result cache. Same shape/pattern as
1291
+ // bigquery_cache above, short TTL (set in first-party-analytics-cache.ts)
1292
+ // since this is the app's own live data, not an immutable warehouse
1293
+ // result. See first-party-analytics-cache.ts for why this exists: panel
1294
+ // queries had no cache at all, so every dashboard render and every daily
1295
+ // report screenshot recomputed from scratch and stacked concurrent load
1296
+ // on the same rows, which is what was blowing report/panel timeouts.
1297
+ {
1298
+ version: 124,
1299
+ name: "first-party-analytics-cache-table",
1300
+ sql: `CREATE TABLE IF NOT EXISTS first_party_analytics_cache (
1301
+ key TEXT PRIMARY KEY,
1302
+ sql TEXT NOT NULL,
1303
+ result TEXT NOT NULL,
1304
+ created_at TEXT NOT NULL,
1305
+ expires_at TEXT NOT NULL
1306
+ )`,
1307
+ },
1308
+ {
1309
+ version: 125,
1310
+ name: "first-party-analytics-cache-expires-idx",
1311
+ sql: `CREATE INDEX IF NOT EXISTS first_party_analytics_cache_expires_at_idx ON first_party_analytics_cache (expires_at)`,
1312
+ },
1287
1313
  ],
1288
1314
  { table: "analytics_migrations" },
1289
1315
  );
@@ -1312,6 +1338,20 @@ export default async (nitroApp: any): Promise<void> => {
1312
1338
  err instanceof Error ? err.message : err,
1313
1339
  );
1314
1340
  }
1341
+ try {
1342
+ const repairedCount =
1343
+ await repairUnboundedFirstPartyPanelsAcrossDashboards();
1344
+ if (repairedCount > 0) {
1345
+ console.info(
1346
+ `[db] Repaired ${repairedCount} dashboard(s) with unbounded first-party panel SQL.`,
1347
+ );
1348
+ }
1349
+ } catch (err) {
1350
+ console.warn(
1351
+ "[db] Failed to repair unbounded first-party panels across dashboards (non-fatal):",
1352
+ err instanceof Error ? err.message : err,
1353
+ );
1354
+ }
1315
1355
  try {
1316
1356
  const summary = await ensureAdditiveColumns({
1317
1357
  db: getDbExec(),
@@ -1,3 +1,6 @@
1
- export const FIRST_PARTY_ANALYTICS_QUERY_TIMEOUT_MS = 30_000;
2
- export const DASHBOARD_REPORT_ACTION_TIMEOUT_MS = 38_000;
3
- export const DASHBOARD_REPORT_READY_TIMEOUT_MS = 60_000;
1
+ // These three must stay ordered with headroom (DB timeout < action timeout <
2
+ // page-ready timeout) so the innermost layer's own, more specific error
3
+ // surfaces before an outer layer gives up for an unrelated reason.
4
+ export const FIRST_PARTY_ANALYTICS_QUERY_TIMEOUT_MS = 45_000;
5
+ export const DASHBOARD_REPORT_ACTION_TIMEOUT_MS = 50_000;
6
+ export const DASHBOARD_REPORT_READY_TIMEOUT_MS = 75_000;
@@ -17,7 +17,6 @@ import {
17
17
  type ChatHistoryItem,
18
18
  } from "@agent-native/toolkit/chat-history";
19
19
  import {
20
- IconHierarchy2,
21
20
  IconClipboardList,
22
21
  IconLayoutSidebarLeftCollapse,
23
22
  IconLayoutSidebarLeftExpand,
@@ -45,7 +44,6 @@ const baseNavItems = [
45
44
  ];
46
45
 
47
46
  const bottomNavItems = [
48
- { icon: IconHierarchy2, labelKey: "settings.agentTitle", href: "/agent" },
49
47
  { icon: IconSettings, labelKey: "navigation.settings", href: "/settings" },
50
48
  ];
51
49
 
@@ -35,7 +35,7 @@ const CHAT_STARTERS = [
35
35
  ] as const;
36
36
 
37
37
  const SEO_TITLE =
38
- "Agent-Native Assets - Open Source AI asset library for brand-safe images and video";
38
+ "Assets - Open Source AI asset library for brand-safe images and video";
39
39
  const SEO_DESCRIPTION =
40
40
  "Open Source asset manager for AI teams to organize brand libraries, search creative work, and generate on-brand images and videos.";
41
41
 
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: improved
3
+ date: 2026-07-25
4
+ ---
5
+
6
+ App branding now uses the product name without the Agent-Native prefix.
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: improved
3
+ date: 2026-07-25
4
+ ---
5
+
6
+ Settings navigation now keeps Manage agent as a dedicated linked destination at the bottom.
@@ -2,7 +2,7 @@ import { createAuthPlugin } from "@agent-native/core/server";
2
2
 
3
3
  export default createAuthPlugin({
4
4
  marketing: {
5
- appName: "Agent-Native Assets",
5
+ appName: "Assets",
6
6
  tagline:
7
7
  "Your AI agent creates, refines, and organizes on-brand assets alongside you.",
8
8
  features: [
@@ -1,6 +1,5 @@
1
1
  import type { Icon } from "@tabler/icons-react";
2
2
  import {
3
- IconHierarchy2,
4
3
  IconBook2,
5
4
  IconChecks,
6
5
  IconDatabase,
@@ -1007,12 +1006,6 @@ export const navItems: Array<{
1007
1006
  href: "/settings",
1008
1007
  icon: IconSettings,
1009
1008
  },
1010
- {
1011
- view: "agent",
1012
- label: "Manage agent",
1013
- href: "/agent",
1014
- icon: IconHierarchy2,
1015
- },
1016
1009
  ];
1017
1010
 
1018
1011
  export const defaultSettings: BrainSettings = {
@@ -9,8 +9,7 @@ import { useEffect } from "react";
9
9
  import { shouldEnableBrainProviderStatusChecks } from "@/lib/brain-chat-readiness";
10
10
  import { TAB_ID } from "@/lib/tab-id";
11
11
 
12
- const SEO_TITLE =
13
- "Agent-Native Brain - Open Source company knowledge base for AI agents";
12
+ const SEO_TITLE = "Brain - Open Source company knowledge base for AI agents";
14
13
  const SEO_DESCRIPTION =
15
14
  "Open Source company knowledge base that turns Slack, meetings, transcripts, docs, and decisions into cited answers for AI agents.";
16
15
 
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: improved
3
+ date: 2026-07-25
4
+ ---
5
+
6
+ App branding now uses the product name without the Agent-Native prefix.
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: improved
3
+ date: 2026-07-25
4
+ ---
5
+
6
+ Settings navigation now keeps Manage agent as a dedicated linked destination at the bottom.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brain",
3
- "displayName": "Agent-Native Brain",
3
+ "displayName": "Brain",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "Agent-Native Brain",
2
+ "name": "Brain",
3
3
  "short_name": "Brain",
4
4
  "start_url": "/",
5
5
  "display": "standalone",
@@ -2,7 +2,7 @@ import { createAuthPlugin } from "@agent-native/core/server";
2
2
 
3
3
  export default createAuthPlugin({
4
4
  marketing: {
5
- appName: "Agent-Native Brain",
5
+ appName: "Brain",
6
6
  tagline:
7
7
  "A company knowledge layer where raw conversations become reviewed, searchable institutional knowledge.",
8
8
  features: [
@@ -6,7 +6,6 @@ import { OrgSwitcher } from "@agent-native/core/client/org";
6
6
  import { FeedbackButton } from "@agent-native/core/client/ui";
7
7
  import { SidebarFooterActions } from "@agent-native/toolkit/app-shell";
8
8
  import {
9
- IconHierarchy2,
10
9
  IconCalendar,
11
10
  IconSettings,
12
11
  IconLink,
@@ -101,11 +100,6 @@ const navItems = [
101
100
  ];
102
101
 
103
102
  const bottomNavItems = [
104
- {
105
- path: "/agent",
106
- labelKey: "settings.agentTitle",
107
- icon: IconHierarchy2,
108
- },
109
103
  { path: "/settings", labelKey: "navigation.settings", icon: IconSettings },
110
104
  ];
111
105
 
@@ -1,7 +1,7 @@
1
1
  import CalendarView from "@/pages/CalendarView";
2
2
 
3
3
  const SEO_TITLE =
4
- "Agent-Native Calendar - Open Source AI scheduling and Google Calendar automation";
4
+ "Calendar - Open Source AI scheduling and Google Calendar automation";
5
5
  const SEO_DESCRIPTION =
6
6
  "Open Source AI calendar app for Google Calendar scheduling, booking links, meeting coordination, and agent-managed event updates.";
7
7
 
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: improved
3
+ date: 2026-07-25
4
+ ---
5
+
6
+ App branding now uses the product name without the Agent-Native prefix.
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: improved
3
+ date: 2026-07-25
4
+ ---
5
+
6
+ Settings navigation now keeps Manage agent as a dedicated linked destination at the bottom.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "calendar",
3
- "displayName": "Agent-Native Calendar",
3
+ "displayName": "Calendar",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "Agent Native Calendar",
2
+ "name": "Calendar",
3
3
  "short_name": "Calendar",
4
4
  "description": "Google Calendar integration",
5
5
  "start_url": ".",
@@ -8,7 +8,7 @@ export default createAuthPlugin({
8
8
  googleOnly: true,
9
9
  mountGoogleOAuthRoutes: false,
10
10
  marketing: {
11
- appName: "Agent-Native Calendar",
11
+ appName: "Calendar",
12
12
  tagline:
13
13
  "Your AI agent schedules, reschedules, and manages your calendar so you never have to.",
14
14
  features: [
@@ -14,7 +14,6 @@ import {
14
14
  type ChatHistoryItem,
15
15
  } from "@agent-native/toolkit/chat-history";
16
16
  import {
17
- IconHierarchy2,
18
17
  IconLayoutSidebarLeftCollapse,
19
18
  IconLayoutSidebarLeftExpand,
20
19
  IconMessageCircle,
@@ -43,12 +42,6 @@ const navItems = [
43
42
  ];
44
43
 
45
44
  const bottomNavItems = [
46
- {
47
- icon: IconHierarchy2,
48
- labelKey: "settings.agentTitle",
49
- href: "/agent",
50
- view: "agent",
51
- },
52
45
  {
53
46
  icon: IconSettings,
54
47
  labelKey: "navigation.settings",
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: improved
3
+ date: 2026-07-25
4
+ ---
5
+
6
+ Settings navigation now keeps Manage agent as a dedicated linked destination at the bottom.