@agent-native/core 0.86.0 → 0.86.1

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 (183) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +9 -0
  3. package/corpus/core/package.json +2 -1
  4. package/corpus/core/src/client/AgentPanel.tsx +10 -0
  5. package/corpus/core/src/client/AssistantChat.tsx +91 -27
  6. package/corpus/core/src/client/ErrorBoundary.tsx +67 -12
  7. package/corpus/core/src/client/ErrorReportActions.tsx +69 -0
  8. package/corpus/core/src/client/FeedbackButton.tsx +8 -4
  9. package/corpus/core/src/client/db-admin/DbAdminPage.tsx +41 -13
  10. package/corpus/core/src/client/db-admin/SqlEditor.tsx +10 -3
  11. package/corpus/core/src/client/db-admin/TableEditor.tsx +12 -5
  12. package/corpus/core/src/client/db-admin/useAgentSync.ts +10 -3
  13. package/corpus/core/src/client/db-admin/useDbAdmin.ts +65 -16
  14. package/corpus/core/src/client/error-reporting.ts +100 -0
  15. package/corpus/core/src/client/index.ts +11 -0
  16. package/corpus/core/src/client/org/RequireActiveOrg.tsx +12 -0
  17. package/corpus/core/src/client/visual-style-controls.tsx +615 -2
  18. package/corpus/core/src/db-admin/index.ts +26 -0
  19. package/corpus/core/src/db-admin/operations.ts +87 -49
  20. package/corpus/core/src/localization/default-messages.ts +4 -0
  21. package/corpus/core/src/server/builder-design-systems.ts +328 -9
  22. package/corpus/core/src/server/index.ts +15 -0
  23. package/corpus/core/src/templates/default/app/root.tsx +47 -0
  24. package/corpus/templates/analytics/AGENTS.md +6 -4
  25. package/corpus/templates/analytics/actions/delete-db-admin-connection.ts +19 -0
  26. package/corpus/templates/analytics/actions/list-db-admin-connections.ts +18 -0
  27. package/corpus/templates/analytics/actions/navigate.ts +17 -3
  28. package/corpus/templates/analytics/actions/save-db-admin-connection.ts +33 -0
  29. package/corpus/templates/analytics/actions/view-screen.ts +11 -3
  30. package/corpus/templates/analytics/app/hooks/use-navigation-state.ts +11 -2
  31. package/corpus/templates/analytics/app/i18n/zh-TW.ts +23 -2
  32. package/corpus/templates/analytics/app/i18n-data.ts +230 -20
  33. package/corpus/templates/analytics/app/pages/Agents.tsx +398 -4
  34. package/corpus/templates/analytics/changelog/2026-07-03-connect-other-app-databases-from-analytics.md +6 -0
  35. package/corpus/templates/analytics/server/db/schema.ts +27 -0
  36. package/corpus/templates/analytics/server/lib/db-admin-connections.ts +458 -0
  37. package/corpus/templates/analytics/server/plugins/db.ts +35 -0
  38. package/corpus/templates/analytics/server/routes/[base]/_agent-native/analytics-db-admin/[...path].ts +1 -0
  39. package/corpus/templates/analytics/server/routes/_agent-native/analytics-db-admin/[...path].ts +160 -0
  40. package/corpus/templates/content/app/root.tsx +9 -0
  41. package/corpus/templates/content/changelog/2026-07-03-error-screens-now-include-a-feedback-button-with-debug-info.md +6 -0
  42. package/corpus/templates/design/AGENTS.md +13 -7
  43. package/corpus/templates/design/actions/get-design-system.ts +21 -0
  44. package/corpus/templates/design/actions/index-design-system-with-builder.ts +14 -37
  45. package/corpus/templates/design/app/components/design/code-workbench/CodeWorkbench.tsx +3 -3
  46. package/corpus/templates/design/app/components/design/code-workbench/SideBar.tsx +70 -9
  47. package/corpus/templates/design/app/components/design/code-workbench/editor/EditorTabs.tsx +11 -2
  48. package/corpus/templates/design/app/components/design/code-workbench/editor/MonacoHost.tsx +1 -1
  49. package/corpus/templates/design/app/components/design/code-workbench/editor/StatusBar.tsx +1 -1
  50. package/corpus/templates/design/app/components/design/code-workbench/explorer/ExplorerView.tsx +8 -2
  51. package/corpus/templates/design/app/components/design/code-workbench/explorer/FileTree.tsx +7 -3
  52. package/corpus/templates/design/app/components/design/code-workbench/store.tsx +48 -0
  53. package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +6 -0
  54. package/corpus/templates/design/app/i18n/zh-TW.ts +15 -14
  55. package/corpus/templates/design/app/i18n-data.ts +154 -142
  56. package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +32 -14
  57. package/corpus/templates/design/changelog/2026-07-03-design-system-setup-now-indexes-figma-code-and-design-md-sou.md +6 -0
  58. package/corpus/templates/design/changelog/2026-07-03-the-code-editor-is-easier-to-use-with-top-sidebar-tabs-clear.md +6 -0
  59. package/corpus/templates/design/server/lib/builder-design-system-proxy.ts +16 -106
  60. package/corpus/templates/mail/app/root.tsx +60 -1
  61. package/corpus/templates/mail/changelog/2026-07-03-error-screens-now-include-a-feedback-button-with-debug-info.md +6 -0
  62. package/corpus/templates/plan/app/i18n/ar-SA.ts +3 -0
  63. package/corpus/templates/plan/app/i18n/de-DE.ts +4 -0
  64. package/corpus/templates/plan/app/i18n/en-US.ts +4 -0
  65. package/corpus/templates/plan/app/i18n/es-ES.ts +4 -0
  66. package/corpus/templates/plan/app/i18n/fr-FR.ts +4 -0
  67. package/corpus/templates/plan/app/i18n/hi-IN.ts +3 -0
  68. package/corpus/templates/plan/app/i18n/ja-JP.ts +4 -0
  69. package/corpus/templates/plan/app/i18n/ko-KR.ts +4 -0
  70. package/corpus/templates/plan/app/i18n/pt-BR.ts +4 -0
  71. package/corpus/templates/plan/app/i18n/zh-CN.ts +3 -0
  72. package/corpus/templates/plan/app/i18n/zh-TW.ts +3 -0
  73. package/corpus/templates/plan/app/pages/PlansPage.tsx +74 -3
  74. package/corpus/templates/plan/changelog/2026-07-03-error-screens-now-include-a-feedback-button-with-debug-info.md +6 -0
  75. package/corpus/templates/slides/AGENTS.md +7 -3
  76. package/corpus/templates/slides/actions/get-design-system.ts +21 -0
  77. package/corpus/templates/slides/actions/import-file.ts +15 -7
  78. package/corpus/templates/slides/actions/index-design-system-with-builder.ts +14 -37
  79. package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +32 -8
  80. package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +2 -2
  81. package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +2 -4
  82. package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +163 -154
  83. package/corpus/templates/slides/app/components/editor/SlideStyleInspector.tsx +19 -15
  84. package/corpus/templates/slides/app/components/editor/SpeakerNotesPanel.tsx +56 -6
  85. package/corpus/templates/slides/app/components/layout/Layout.tsx +6 -1
  86. package/corpus/templates/slides/app/i18n/ar-SA.ts +8 -7
  87. package/corpus/templates/slides/app/i18n/de-DE.ts +7 -8
  88. package/corpus/templates/slides/app/i18n/en-US.ts +8 -7
  89. package/corpus/templates/slides/app/i18n/es-ES.ts +7 -8
  90. package/corpus/templates/slides/app/i18n/fr-FR.ts +7 -8
  91. package/corpus/templates/slides/app/i18n/hi-IN.ts +8 -7
  92. package/corpus/templates/slides/app/i18n/ja-JP.ts +7 -8
  93. package/corpus/templates/slides/app/i18n/ko-KR.ts +7 -7
  94. package/corpus/templates/slides/app/i18n/pt-BR.ts +7 -8
  95. package/corpus/templates/slides/app/i18n/zh-CN.ts +8 -7
  96. package/corpus/templates/slides/app/i18n/zh-TW.ts +8 -7
  97. package/corpus/templates/slides/app/lib/canvas-zoom.ts +16 -1
  98. package/corpus/templates/slides/app/pages/DeckEditor.tsx +3 -3
  99. package/corpus/templates/slides/changelog/2026-07-03-design-system-setup-now-indexes-figma-code-and-design-md-sou.md +6 -0
  100. package/corpus/templates/slides/changelog/2026-07-03-slide-editing-now-keeps-thumbnails-speaker-notes-styling-and.md +6 -0
  101. package/corpus/templates/slides/server/lib/builder-design-system-proxy.ts +16 -104
  102. package/dist/client/AgentPanel.d.ts.map +1 -1
  103. package/dist/client/AgentPanel.js +2 -1
  104. package/dist/client/AgentPanel.js.map +1 -1
  105. package/dist/client/AssistantChat.d.ts.map +1 -1
  106. package/dist/client/AssistantChat.js +77 -25
  107. package/dist/client/AssistantChat.js.map +1 -1
  108. package/dist/client/ErrorBoundary.d.ts.map +1 -1
  109. package/dist/client/ErrorBoundary.js +37 -2
  110. package/dist/client/ErrorBoundary.js.map +1 -1
  111. package/dist/client/ErrorReportActions.d.ts +13 -0
  112. package/dist/client/ErrorReportActions.d.ts.map +1 -0
  113. package/dist/client/ErrorReportActions.js +14 -0
  114. package/dist/client/ErrorReportActions.js.map +1 -0
  115. package/dist/client/FeedbackButton.d.ts +3 -1
  116. package/dist/client/FeedbackButton.d.ts.map +1 -1
  117. package/dist/client/FeedbackButton.js +6 -5
  118. package/dist/client/FeedbackButton.js.map +1 -1
  119. package/dist/client/db-admin/DbAdminPage.d.ts +9 -1
  120. package/dist/client/db-admin/DbAdminPage.d.ts.map +1 -1
  121. package/dist/client/db-admin/DbAdminPage.js +17 -13
  122. package/dist/client/db-admin/DbAdminPage.js.map +1 -1
  123. package/dist/client/db-admin/SqlEditor.d.ts +3 -1
  124. package/dist/client/db-admin/SqlEditor.d.ts.map +1 -1
  125. package/dist/client/db-admin/SqlEditor.js +3 -3
  126. package/dist/client/db-admin/SqlEditor.js.map +1 -1
  127. package/dist/client/db-admin/TableEditor.d.ts +3 -1
  128. package/dist/client/db-admin/TableEditor.d.ts.map +1 -1
  129. package/dist/client/db-admin/TableEditor.js +6 -6
  130. package/dist/client/db-admin/TableEditor.js.map +1 -1
  131. package/dist/client/db-admin/useAgentSync.d.ts +3 -2
  132. package/dist/client/db-admin/useAgentSync.d.ts.map +1 -1
  133. package/dist/client/db-admin/useAgentSync.js +8 -4
  134. package/dist/client/db-admin/useAgentSync.js.map +1 -1
  135. package/dist/client/db-admin/useDbAdmin.d.ts +11 -7
  136. package/dist/client/db-admin/useDbAdmin.d.ts.map +1 -1
  137. package/dist/client/db-admin/useDbAdmin.js +45 -20
  138. package/dist/client/db-admin/useDbAdmin.js.map +1 -1
  139. package/dist/client/error-reporting.d.ts +19 -0
  140. package/dist/client/error-reporting.d.ts.map +1 -0
  141. package/dist/client/error-reporting.js +71 -0
  142. package/dist/client/error-reporting.js.map +1 -0
  143. package/dist/client/index.d.ts +3 -1
  144. package/dist/client/index.d.ts.map +1 -1
  145. package/dist/client/index.js +3 -1
  146. package/dist/client/index.js.map +1 -1
  147. package/dist/client/org/RequireActiveOrg.d.ts.map +1 -1
  148. package/dist/client/org/RequireActiveOrg.js +2 -1
  149. package/dist/client/org/RequireActiveOrg.js.map +1 -1
  150. package/dist/client/visual-style-controls.d.ts +11 -0
  151. package/dist/client/visual-style-controls.d.ts.map +1 -1
  152. package/dist/client/visual-style-controls.js +350 -1
  153. package/dist/client/visual-style-controls.js.map +1 -1
  154. package/dist/collab/routes.d.ts +1 -1
  155. package/dist/collab/struct-routes.d.ts +1 -1
  156. package/dist/db-admin/index.d.ts +3 -0
  157. package/dist/db-admin/index.d.ts.map +1 -0
  158. package/dist/db-admin/index.js +2 -0
  159. package/dist/db-admin/index.js.map +1 -0
  160. package/dist/db-admin/operations.d.ts +26 -5
  161. package/dist/db-admin/operations.d.ts.map +1 -1
  162. package/dist/db-admin/operations.js +66 -55
  163. package/dist/db-admin/operations.js.map +1 -1
  164. package/dist/localization/default-messages.d.ts +3 -0
  165. package/dist/localization/default-messages.d.ts.map +1 -1
  166. package/dist/localization/default-messages.js +3 -0
  167. package/dist/localization/default-messages.js.map +1 -1
  168. package/dist/notifications/routes.d.ts +1 -1
  169. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  170. package/dist/resources/handlers.d.ts +1 -1
  171. package/dist/secrets/routes.d.ts +9 -9
  172. package/dist/server/builder-design-systems.d.ts +61 -0
  173. package/dist/server/builder-design-systems.d.ts.map +1 -1
  174. package/dist/server/builder-design-systems.js +219 -14
  175. package/dist/server/builder-design-systems.js.map +1 -1
  176. package/dist/server/index.d.ts +1 -1
  177. package/dist/server/index.d.ts.map +1 -1
  178. package/dist/server/index.js +1 -1
  179. package/dist/server/index.js.map +1 -1
  180. package/dist/server/transcribe-voice.d.ts +1 -1
  181. package/dist/templates/default/app/root.tsx +47 -0
  182. package/package.json +2 -1
  183. package/src/templates/default/app/root.tsx +47 -0
@@ -36,11 +36,17 @@ import { DataGrid, type GridRow, type ActiveCell } from "./DataGrid.js";
36
36
  import { FilterBar } from "./FilterBar.js";
37
37
  import { RowSidePanel, type RowSidePanelMode } from "./RowSidePanel.js";
38
38
  import { loadGridState, saveGridState } from "./storage.js";
39
- import { useTableSchema, useTableRows, mutateTable } from "./useDbAdmin.js";
39
+ import {
40
+ useTableSchema,
41
+ useTableRows,
42
+ mutateTable,
43
+ type DbAdminRequestConfig,
44
+ } from "./useDbAdmin.js";
40
45
 
41
46
  export interface TableEditorProps {
42
47
  table: string;
43
48
  dialect: DbAdminDialect;
49
+ requestConfig?: DbAdminRequestConfig;
44
50
  initialFilters?: DbAdminFilter[];
45
51
  onNavigateToRow: (table: string, filters: DbAdminFilter[]) => void;
46
52
  }
@@ -51,6 +57,7 @@ const PAGE_SIZES = [25, 50, 100, 250, 500];
51
57
  export function TableEditor({
52
58
  table,
53
59
  dialect: _dialect,
60
+ requestConfig,
54
61
  initialFilters,
55
62
  onNavigateToRow,
56
63
  }: TableEditorProps) {
@@ -90,12 +97,12 @@ export function TableEditor({
90
97
  }, [table, columnWidths, sort, filters, pageSize]);
91
98
 
92
99
  // ─── Data ────────────────────────────────────────────────────────────────
93
- const schemaState = useTableSchema(table);
100
+ const schemaState = useTableSchema(table, requestConfig);
94
101
  const rowsReq = useMemo(
95
102
  () => ({ page, pageSize, sort, filters }),
96
103
  [page, pageSize, sort, filters],
97
104
  );
98
- const rowsState = useTableRows(table, rowsReq);
105
+ const rowsState = useTableRows(table, rowsReq, requestConfig);
99
106
 
100
107
  const schema = schemaState.data;
101
108
  const changeset = useChangeset(schema);
@@ -201,9 +208,9 @@ export function TableEditor({
201
208
  if (!mutation.inserts && !mutation.updates && !mutation.deletes) {
202
209
  return null;
203
210
  }
204
- return mutateTable(table, mutation);
211
+ return mutateTable(table, mutation, requestConfig);
205
212
  },
206
- [changeset, originalRows, table],
213
+ [changeset, originalRows, requestConfig, table],
207
214
  );
208
215
 
209
216
  const handlePreview = useCallback(async () => {
@@ -64,6 +64,7 @@ export interface DbAdminNavigationState {
64
64
  export interface UseDbAdminAgentSyncArgs {
65
65
  table: string | null;
66
66
  mode: "table" | "sql";
67
+ enabled?: boolean;
67
68
  }
68
69
 
69
70
  /**
@@ -74,8 +75,10 @@ export interface UseDbAdminAgentSyncArgs {
74
75
  export function useDbAdminAgentSync({
75
76
  table,
76
77
  mode,
78
+ enabled = true,
77
79
  }: UseDbAdminAgentSyncArgs): void {
78
80
  useEffect(() => {
81
+ if (!enabled) return;
79
82
  const state: DbAdminNavigationState = { view: "database", table, mode };
80
83
  fetch(NAVIGATION_PATH, {
81
84
  method: "PUT",
@@ -84,7 +87,7 @@ export function useDbAdminAgentSync({
84
87
  headers: headers({ "Content-Type": "application/json" }),
85
88
  body: JSON.stringify(state),
86
89
  }).catch(() => {});
87
- }, [table, mode]);
90
+ }, [enabled, table, mode]);
88
91
  }
89
92
 
90
93
  interface NavigateCommand {
@@ -97,11 +100,15 @@ interface NavigateCommand {
97
100
  * a database table, invoke `onNavigate(table)` then clear the key so it does
98
101
  * not replay on the next poll.
99
102
  */
100
- export function useNavigateConsumer(onNavigate: (table: string) => void): void {
103
+ export function useNavigateConsumer(
104
+ onNavigate: (table: string) => void,
105
+ enabled = true,
106
+ ): void {
101
107
  const handlerRef = useRef(onNavigate);
102
108
  handlerRef.current = onNavigate;
103
109
 
104
110
  useEffect(() => {
111
+ if (!enabled) return;
105
112
  let active = true;
106
113
  let timer: ReturnType<typeof setTimeout> | undefined;
107
114
 
@@ -143,5 +150,5 @@ export function useNavigateConsumer(onNavigate: (table: string) => void): void {
143
150
  active = false;
144
151
  if (timer) clearTimeout(timer);
145
152
  };
146
- }, []);
153
+ }, [enabled]);
147
154
  }
@@ -34,6 +34,19 @@ import { useChangeVersions } from "../use-change-version.js";
34
34
 
35
35
  export const dbAdminBasePath = agentNativePath("/_agent-native/db-admin");
36
36
 
37
+ export interface DbAdminRequestConfig {
38
+ basePath?: string;
39
+ scopeKey?: string;
40
+ }
41
+
42
+ function requestBasePath(config?: DbAdminRequestConfig): string {
43
+ return (config?.basePath ?? dbAdminBasePath).replace(/\/+$/, "");
44
+ }
45
+
46
+ function requestScopeKey(config?: DbAdminRequestConfig): string {
47
+ return config?.scopeKey ?? requestBasePath(config);
48
+ }
49
+
37
50
  // ─── Tab id (request source) ───────────────────────────────────────────────
38
51
 
39
52
  let cachedTabId: string | null = null;
@@ -104,8 +117,11 @@ async function parseEnvelope<T>(res: Response): Promise<T> {
104
117
  return json;
105
118
  }
106
119
 
107
- export async function dbAdminGet<T>(subpath: string): Promise<T> {
108
- const res = await fetch(`${dbAdminBasePath}${subpath}`, {
120
+ export async function dbAdminGet<T>(
121
+ subpath: string,
122
+ config?: DbAdminRequestConfig,
123
+ ): Promise<T> {
124
+ const res = await fetch(`${requestBasePath(config)}${subpath}`, {
109
125
  method: "GET",
110
126
  credentials: "include",
111
127
  headers: baseHeaders(),
@@ -116,8 +132,9 @@ export async function dbAdminGet<T>(subpath: string): Promise<T> {
116
132
  export async function dbAdminPost<T>(
117
133
  subpath: string,
118
134
  body: unknown,
135
+ config?: DbAdminRequestConfig,
119
136
  ): Promise<T> {
120
- const res = await fetch(`${dbAdminBasePath}${subpath}`, {
137
+ const res = await fetch(`${requestBasePath(config)}${subpath}`, {
121
138
  method: "POST",
122
139
  credentials: "include",
123
140
  headers: baseHeaders({ "Content-Type": "application/json" }),
@@ -159,12 +176,18 @@ interface OverviewResponse {
159
176
  tables: DbAdminTableSummary[];
160
177
  }
161
178
 
162
- export function useOverview(): DbAdminQueryState<DbAdminOverview> {
163
- const version = useChangeVersions(["db-admin", "action"]);
179
+ export function useOverview(
180
+ config?: DbAdminRequestConfig,
181
+ ): DbAdminQueryState<DbAdminOverview> {
182
+ const version = useChangeVersions([
183
+ "db-admin",
184
+ "analytics-db-admin",
185
+ "action",
186
+ ]);
164
187
  const query = useQuery<DbAdminOverview, Error>({
165
- queryKey: ["db-admin", "overview", version],
188
+ queryKey: ["db-admin", requestScopeKey(config), "overview", version],
166
189
  queryFn: async () => {
167
- const res = await dbAdminGet<OverviewResponse>("/overview");
190
+ const res = await dbAdminGet<OverviewResponse>("/overview", config);
168
191
  return { dialect: res.dialect, tables: res.tables };
169
192
  },
170
193
  placeholderData: keepPreviousData,
@@ -182,14 +205,20 @@ interface SchemaResponse {
182
205
 
183
206
  export function useTableSchema(
184
207
  table: string | null,
208
+ config?: DbAdminRequestConfig,
185
209
  ): DbAdminQueryState<DbAdminTableSchema> {
186
- const version = useChangeVersions(["db-admin", "action"]);
210
+ const version = useChangeVersions([
211
+ "db-admin",
212
+ "analytics-db-admin",
213
+ "action",
214
+ ]);
187
215
  const query = useQuery<DbAdminTableSchema, Error>({
188
- queryKey: ["db-admin", "schema", table, version],
216
+ queryKey: ["db-admin", requestScopeKey(config), "schema", table, version],
189
217
  enabled: !!table,
190
218
  queryFn: async () => {
191
219
  const res = await dbAdminGet<SchemaResponse>(
192
220
  `/table/${encodeURIComponent(table!)}/schema`,
221
+ config,
193
222
  );
194
223
  return res.table;
195
224
  },
@@ -204,15 +233,28 @@ export function useTableSchema(
204
233
  export function useTableRows(
205
234
  table: string | null,
206
235
  req: DbAdminRowsRequest,
236
+ config?: DbAdminRequestConfig,
207
237
  ): DbAdminQueryState<DbAdminRowsResult> {
208
- const version = useChangeVersions(["db-admin", "action"]);
238
+ const version = useChangeVersions([
239
+ "db-admin",
240
+ "analytics-db-admin",
241
+ "action",
242
+ ]);
209
243
  const query = useQuery<DbAdminRowsResult, Error>({
210
- queryKey: ["db-admin", "rows", table, req, version],
244
+ queryKey: [
245
+ "db-admin",
246
+ requestScopeKey(config),
247
+ "rows",
248
+ table,
249
+ req,
250
+ version,
251
+ ],
211
252
  enabled: !!table,
212
253
  queryFn: () =>
213
254
  dbAdminPost<DbAdminRowsResult>(
214
255
  `/table/${encodeURIComponent(table!)}/rows`,
215
256
  req,
257
+ config,
216
258
  ),
217
259
  placeholderData: keepPreviousData,
218
260
  staleTime: 2000,
@@ -225,10 +267,12 @@ export function useTableRows(
225
267
  export async function mutateTable(
226
268
  table: string,
227
269
  mutation: DbAdminMutation,
270
+ config?: DbAdminRequestConfig,
228
271
  ): Promise<DbAdminMutationResult> {
229
272
  return dbAdminPost<DbAdminMutationResult>(
230
273
  `/table/${encodeURIComponent(table)}/mutate`,
231
274
  mutation,
275
+ config,
232
276
  );
233
277
  }
234
278
 
@@ -236,10 +280,15 @@ export async function runQuery(
236
280
  sql: string,
237
281
  params?: unknown[],
238
282
  confirmDestructive?: boolean,
283
+ config?: DbAdminRequestConfig,
239
284
  ): Promise<DbAdminQueryResult> {
240
- return dbAdminPost<DbAdminQueryResult>("/query", {
241
- sql,
242
- params,
243
- confirmDestructive,
244
- });
285
+ return dbAdminPost<DbAdminQueryResult>(
286
+ "/query",
287
+ {
288
+ sql,
289
+ params,
290
+ confirmDestructive,
291
+ },
292
+ config,
293
+ );
245
294
  }
@@ -0,0 +1,100 @@
1
+ import {
2
+ getFeedbackClientContext,
3
+ type FeedbackClientContext,
4
+ type FeedbackClientContextOptions,
5
+ } from "./feedback-context.js";
6
+
7
+ const GITHUB_ISSUE_URL = "https://github.com/BuilderIO/agent-native/issues/new";
8
+
9
+ export interface ErrorReportDebugItem {
10
+ label: string;
11
+ value?: unknown;
12
+ }
13
+
14
+ export interface ErrorReportTemplateOptions {
15
+ title?: string | null;
16
+ details?: string | null;
17
+ status?: number | string | null;
18
+ appName?: string | null;
19
+ prompt?: string;
20
+ issueTitle?: string;
21
+ feedbackContext?: FeedbackClientContext;
22
+ contextOptions?: FeedbackClientContextOptions;
23
+ extraDebug?: ErrorReportDebugItem[];
24
+ }
25
+
26
+ function cleanText(value: unknown): string | null {
27
+ if (value === null || value === undefined) return null;
28
+ const text = String(value).trim();
29
+ return text ? text : null;
30
+ }
31
+
32
+ function resolveContext(
33
+ options: ErrorReportTemplateOptions,
34
+ ): FeedbackClientContext {
35
+ return (
36
+ options.feedbackContext ?? getFeedbackClientContext(options.contextOptions)
37
+ );
38
+ }
39
+
40
+ function debugLines(options: ErrorReportTemplateOptions): string[] {
41
+ const context = resolveContext(options);
42
+ const lines: string[] = [];
43
+ const appName = cleanText(options.appName);
44
+ const title = cleanText(options.title);
45
+ const details = cleanText(options.details);
46
+ const status = cleanText(options.status);
47
+
48
+ if (appName) lines.push(`App: ${appName}`);
49
+ if (status) lines.push(`Status: ${status}`);
50
+ if (title) lines.push(`Screen: ${title}`);
51
+ if (details && details !== title) lines.push(`Error: ${details}`);
52
+ if (context.pageUrl) lines.push(`Page: ${context.pageUrl}`);
53
+ if (context.clientSurface) lines.push(`Source: ${context.clientSurface}`);
54
+ if (context.activeRunId) lines.push(`Run: ${context.activeRunId}`);
55
+ if (context.chatSessionIds.length === 1) {
56
+ lines.push(`Chat session: ${context.chatSessionIds[0]}`);
57
+ } else if (context.chatSessionIds.length > 1) {
58
+ lines.push(`Chat sessions: ${context.chatSessionIds.join(", ")}`);
59
+ }
60
+ for (const item of options.extraDebug ?? []) {
61
+ const value = cleanText(item.value);
62
+ if (value) lines.push(`${item.label}: ${value}`);
63
+ }
64
+ return lines;
65
+ }
66
+
67
+ export function buildErrorReportTemplate(
68
+ options: ErrorReportTemplateOptions,
69
+ ): string {
70
+ const lines = debugLines(options);
71
+ return [
72
+ options.prompt ?? "Describe what happened here:",
73
+ "",
74
+ "",
75
+ "---",
76
+ "Debug info:",
77
+ ...(lines.length ? lines : ["No client debug info available."]),
78
+ ].join("\n");
79
+ }
80
+
81
+ export function buildGitHubIssueUrl(
82
+ options: ErrorReportTemplateOptions,
83
+ ): string {
84
+ const title =
85
+ cleanText(options.issueTitle) ??
86
+ [
87
+ cleanText(options.appName) ?? "Agent Native",
88
+ cleanText(options.title) ?? "Error screen",
89
+ ].join(": ");
90
+ const url = new URL(GITHUB_ISSUE_URL);
91
+ url.searchParams.set("title", title.slice(0, 180));
92
+ url.searchParams.set(
93
+ "body",
94
+ buildErrorReportTemplate({
95
+ ...options,
96
+ prompt: options.prompt ?? "Describe your issue here:",
97
+ }),
98
+ );
99
+ return url.toString();
100
+ }
@@ -165,6 +165,7 @@ export {
165
165
  } from "./use-db-sync.js";
166
166
  export {
167
167
  VisualControlRow,
168
+ VisualColorPicker,
168
169
  VisualInspectorPanel,
169
170
  VisualInspectorSection,
170
171
  VisualScrubInput,
@@ -669,6 +670,16 @@ export {
669
670
  type StarfieldBackgroundProps,
670
671
  } from "./StarfieldBackground.js";
671
672
  export { FeedbackButton, type FeedbackButtonProps } from "./FeedbackButton.js";
673
+ export {
674
+ ErrorReportActions,
675
+ type ErrorReportActionsProps,
676
+ } from "./ErrorReportActions.js";
677
+ export {
678
+ buildErrorReportTemplate,
679
+ buildGitHubIssueUrl,
680
+ type ErrorReportDebugItem,
681
+ type ErrorReportTemplateOptions,
682
+ } from "./error-reporting.js";
672
683
  export { getClientSurface, type ClientSurface } from "./client-surface.js";
673
684
  export {
674
685
  DevDatabaseLink,
@@ -7,6 +7,7 @@ import {
7
7
  } from "@tabler/icons-react";
8
8
  import { ReactNode, useState } from "react";
9
9
 
10
+ import { ErrorReportActions } from "../ErrorReportActions.js";
10
11
  import { useT } from "../i18n.js";
11
12
  import {
12
13
  useAcceptInvitation,
@@ -115,6 +116,17 @@ function ErrorPane({
115
116
  >
116
117
  {t("org.tryAgain")}
117
118
  </button>
119
+ <ErrorReportActions
120
+ appName="Organization"
121
+ title={t("org.loadErrorTitle")}
122
+ details={message}
123
+ issueTitle="Organization load error"
124
+ feedbackLabel={t("org.sendFeedback")}
125
+ feedbackPlaceholder={t("org.feedbackPlaceholder")}
126
+ githubLabel={t("org.openGitHubIssue")}
127
+ className="mt-4 justify-start"
128
+ align="start"
129
+ />
118
130
  </div>
119
131
  </div>
120
132
  );