@fatagnus/convex-feedback 0.2.6 → 0.2.7

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.
@@ -0,0 +1,60 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated data model types.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+
11
+ import type {
12
+ DataModelFromSchemaDefinition,
13
+ DocumentByName,
14
+ TableNamesInDataModel,
15
+ SystemTableNames,
16
+ } from "convex/server";
17
+ import type { GenericId } from "convex/values";
18
+ import schema from "../schema.js";
19
+
20
+ /**
21
+ * The names of all of your Convex tables.
22
+ */
23
+ export type TableNames = TableNamesInDataModel<DataModel>;
24
+
25
+ /**
26
+ * The type of a document stored in Convex.
27
+ *
28
+ * @typeParam TableName - A string literal type of the table name (like "users").
29
+ */
30
+ export type Doc<TableName extends TableNames> = DocumentByName<
31
+ DataModel,
32
+ TableName
33
+ >;
34
+
35
+ /**
36
+ * An identifier for a document in Convex.
37
+ *
38
+ * Convex documents are uniquely identified by their `Id`, which is accessible
39
+ * on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
40
+ *
41
+ * Documents can be loaded using `db.get(id)` in query and mutation functions.
42
+ *
43
+ * IDs are just strings at runtime, but this type can be used to distinguish them from other
44
+ * strings when type checking.
45
+ *
46
+ * @typeParam TableName - A string literal type of the table name (like "users").
47
+ */
48
+ export type Id<TableName extends TableNames | SystemTableNames> =
49
+ GenericId<TableName>;
50
+
51
+ /**
52
+ * A type describing your Convex data model.
53
+ *
54
+ * This type includes information about what tables you have, the type of
55
+ * documents stored in those tables, and the indexes defined on them.
56
+ *
57
+ * This type is used to parameterize methods like `queryGeneric` and
58
+ * `mutationGeneric` to make them type-safe.
59
+ */
60
+ export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
@@ -0,0 +1,161 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated utilities for implementing server-side Convex query and mutation functions.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+
11
+ import type {
12
+ ActionBuilder,
13
+ HttpActionBuilder,
14
+ MutationBuilder,
15
+ QueryBuilder,
16
+ GenericActionCtx,
17
+ GenericMutationCtx,
18
+ GenericQueryCtx,
19
+ GenericDatabaseReader,
20
+ GenericDatabaseWriter,
21
+ } from "convex/server";
22
+ import {
23
+ actionGeneric,
24
+ httpActionGeneric,
25
+ queryGeneric,
26
+ mutationGeneric,
27
+ internalActionGeneric,
28
+ internalMutationGeneric,
29
+ internalQueryGeneric,
30
+ } from "convex/server";
31
+ import type { DataModel } from "./dataModel.js";
32
+
33
+ /**
34
+ * Define a query in this Convex app's public API.
35
+ *
36
+ * This function will be allowed to read your Convex database and will be accessible from the client.
37
+ *
38
+ * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
39
+ * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
40
+ */
41
+ export const query: QueryBuilder<DataModel, "public"> = queryGeneric;
42
+
43
+ /**
44
+ * Define a query that is only accessible from other Convex functions (but not from the client).
45
+ *
46
+ * This function will be allowed to read from your Convex database. It will not be accessible from the client.
47
+ *
48
+ * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
49
+ * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
50
+ */
51
+ export const internalQuery: QueryBuilder<DataModel, "internal"> =
52
+ internalQueryGeneric;
53
+
54
+ /**
55
+ * Define a mutation in this Convex app's public API.
56
+ *
57
+ * This function will be allowed to modify your Convex database and will be accessible from the client.
58
+ *
59
+ * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
60
+ * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
61
+ */
62
+ export const mutation: MutationBuilder<DataModel, "public"> = mutationGeneric;
63
+
64
+ /**
65
+ * Define a mutation that is only accessible from other Convex functions (but not from the client).
66
+ *
67
+ * This function will be allowed to modify your Convex database. It will not be accessible from the client.
68
+ *
69
+ * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
70
+ * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
71
+ */
72
+ export const internalMutation: MutationBuilder<DataModel, "internal"> =
73
+ internalMutationGeneric;
74
+
75
+ /**
76
+ * Define an action in this Convex app's public API.
77
+ *
78
+ * An action is a function which can execute any JavaScript code, including non-deterministic
79
+ * code and code with side-effects, like calling third-party services.
80
+ * They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
81
+ * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
82
+ *
83
+ * @param func - The action. It receives an {@link ActionCtx} as its first argument.
84
+ * @returns The wrapped action. Include this as an `export` to name it and make it accessible.
85
+ */
86
+ export const action: ActionBuilder<DataModel, "public"> = actionGeneric;
87
+
88
+ /**
89
+ * Define an action that is only accessible from other Convex functions (but not from the client).
90
+ *
91
+ * @param func - The function. It receives an {@link ActionCtx} as its first argument.
92
+ * @returns The wrapped function. Include this as an `export` to name it and make it accessible.
93
+ */
94
+ export const internalAction: ActionBuilder<DataModel, "internal"> =
95
+ internalActionGeneric;
96
+
97
+ /**
98
+ * Define an HTTP action.
99
+ *
100
+ * The wrapped function will be used to respond to HTTP requests received
101
+ * by a Convex deployment if the requests matches the path and method where
102
+ * this action is routed. Be sure to route your httpAction in `convex/http.js`.
103
+ *
104
+ * @param func - The function. It receives an {@link ActionCtx} as its first argument
105
+ * and a Fetch API `Request` object as its second.
106
+ * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
107
+ */
108
+ export const httpAction: HttpActionBuilder = httpActionGeneric;
109
+
110
+ type GenericCtx =
111
+ | GenericActionCtx<DataModel>
112
+ | GenericMutationCtx<DataModel>
113
+ | GenericQueryCtx<DataModel>;
114
+
115
+ /**
116
+ * A set of services for use within Convex query functions.
117
+ *
118
+ * The query context is passed as the first argument to any Convex query
119
+ * function run on the server.
120
+ *
121
+ * If you're using code generation, use the `QueryCtx` type in `convex/_generated/server.d.ts` instead.
122
+ */
123
+ export type QueryCtx = GenericQueryCtx<DataModel>;
124
+
125
+ /**
126
+ * A set of services for use within Convex mutation functions.
127
+ *
128
+ * The mutation context is passed as the first argument to any Convex mutation
129
+ * function run on the server.
130
+ *
131
+ * If you're using code generation, use the `MutationCtx` type in `convex/_generated/server.d.ts` instead.
132
+ */
133
+ export type MutationCtx = GenericMutationCtx<DataModel>;
134
+
135
+ /**
136
+ * A set of services for use within Convex action functions.
137
+ *
138
+ * The action context is passed as the first argument to any Convex action
139
+ * function run on the server.
140
+ */
141
+ export type ActionCtx = GenericActionCtx<DataModel>;
142
+
143
+ /**
144
+ * An interface to read from the database within Convex query functions.
145
+ *
146
+ * The two entry points are {@link DatabaseReader.get}, which fetches a single
147
+ * document by its {@link Id}, or {@link DatabaseReader.query}, which starts
148
+ * building a query.
149
+ */
150
+ export type DatabaseReader = GenericDatabaseReader<DataModel>;
151
+
152
+ /**
153
+ * An interface to read from and write to the database within Convex mutation
154
+ * functions.
155
+ *
156
+ * Convex guarantees that all writes within a single mutation are
157
+ * executed atomically, so you never have to worry about partial writes leaving
158
+ * your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control)
159
+ * for the guarantees Convex provides your functions.
160
+ */
161
+ export type DatabaseWriter = GenericDatabaseWriter<DataModel>;
@@ -16,7 +16,7 @@ import { v } from "convex/values";
16
16
  import { Agent, createThread } from "@convex-dev/agent";
17
17
  import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
18
18
  import { components, internal } from "../_generated/api";
19
- import { internalAction, internalQuery } from "../_generated/server";
19
+ import { action, internalAction, internalQuery } from "../_generated/server";
20
20
  import type { BugSeverity, Effort } from "../schema";
21
21
 
22
22
  // Helper to create OpenRouter provider dynamically
@@ -122,14 +122,18 @@ export const getBugReportForAnalysis = internalQuery({
122
122
  export const processBugReport = internalAction({
123
123
  args: {
124
124
  bugReportId: v.id("bugReports"),
125
+ // Optional API keys - passed from parent app since components don't inherit env vars
126
+ openRouterApiKey: v.optional(v.string()),
127
+ resendApiKey: v.optional(v.string()),
128
+ resendFromEmail: v.optional(v.string()),
125
129
  },
126
130
  returns: v.object({
127
131
  success: v.boolean(),
128
132
  error: v.optional(v.string()),
129
133
  }),
130
134
  handler: async (ctx, args): Promise<{ success: boolean; error?: string }> => {
131
- // Check if OpenRouter API key is configured
132
- const apiKey = process.env.OPENROUTER_API_KEY;
135
+ // Check if OpenRouter API key is configured - prefer args (from parent app), fallback to env
136
+ const apiKey = args.openRouterApiKey || process.env.OPENROUTER_API_KEY;
133
137
  if (!apiKey) {
134
138
  console.log("OPENROUTER_API_KEY not configured, skipping AI analysis");
135
139
  // Still try to send notifications without AI analysis
@@ -137,6 +141,8 @@ export const processBugReport = internalAction({
137
141
  await ctx.runAction(internal.emails.bugReportEmails.sendBugReportNotifications, {
138
142
  reportId: args.bugReportId,
139
143
  analysis: null,
144
+ resendApiKey: args.resendApiKey,
145
+ resendFromEmail: args.resendFromEmail,
140
146
  });
141
147
  } catch {
142
148
  console.log("Email notifications not configured");
@@ -262,6 +268,8 @@ Provide your analysis in the JSON format specified.`;
262
268
  suggestedFix: analysis.suggestedFix,
263
269
  estimatedEffort: analysis.estimatedEffort,
264
270
  },
271
+ resendApiKey: args.resendApiKey,
272
+ resendFromEmail: args.resendFromEmail,
265
273
  });
266
274
 
267
275
  // Mark notifications as sent
@@ -275,3 +283,29 @@ Provide your analysis in the JSON format specified.`;
275
283
  return { success: true };
276
284
  },
277
285
  });
286
+
287
+ /**
288
+ * Public wrapper for processBugReport that can be called from parent app.
289
+ * Accepts optional API keys since Convex components don't inherit parent env vars.
290
+ */
291
+ export const processBugReportPublic = action({
292
+ args: {
293
+ bugReportId: v.id("bugReports"),
294
+ openRouterApiKey: v.optional(v.string()),
295
+ resendApiKey: v.optional(v.string()),
296
+ resendFromEmail: v.optional(v.string()),
297
+ },
298
+ returns: v.object({
299
+ success: v.boolean(),
300
+ error: v.optional(v.string()),
301
+ }),
302
+ handler: async (ctx, args): Promise<{ success: boolean; error?: string }> => {
303
+ // Delegate to the internal action
304
+ return await ctx.runAction(internal.agents.bugReportAgent.processBugReport, {
305
+ bugReportId: args.bugReportId,
306
+ openRouterApiKey: args.openRouterApiKey,
307
+ resendApiKey: args.resendApiKey,
308
+ resendFromEmail: args.resendFromEmail,
309
+ });
310
+ },
311
+ });
@@ -15,7 +15,7 @@ import { v } from "convex/values";
15
15
  import { Agent, createThread } from "@convex-dev/agent";
16
16
  import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
17
17
  import { components, internal } from "../_generated/api";
18
- import { internalAction, internalQuery } from "../_generated/server";
18
+ import { action, internalAction, internalQuery } from "../_generated/server";
19
19
  import type { FeedbackPriority, Effort } from "../schema";
20
20
 
21
21
  // Helper to create OpenRouter provider dynamically
@@ -118,14 +118,18 @@ export const getFeedbackForAnalysis = internalQuery({
118
118
  export const processFeedback = internalAction({
119
119
  args: {
120
120
  feedbackId: v.id("feedback"),
121
+ // Optional API keys - passed from parent app since components don't inherit env vars
122
+ openRouterApiKey: v.optional(v.string()),
123
+ resendApiKey: v.optional(v.string()),
124
+ resendFromEmail: v.optional(v.string()),
121
125
  },
122
126
  returns: v.object({
123
127
  success: v.boolean(),
124
128
  error: v.optional(v.string()),
125
129
  }),
126
130
  handler: async (ctx, args): Promise<{ success: boolean; error?: string }> => {
127
- // Check if OpenRouter API key is configured
128
- const apiKey = process.env.OPENROUTER_API_KEY;
131
+ // Check if OpenRouter API key is configured - prefer args (from parent app), fallback to env
132
+ const apiKey = args.openRouterApiKey || process.env.OPENROUTER_API_KEY;
129
133
  if (!apiKey) {
130
134
  console.log("OPENROUTER_API_KEY not configured, skipping AI analysis");
131
135
  // Still try to send notifications without AI analysis
@@ -133,6 +137,8 @@ export const processFeedback = internalAction({
133
137
  await ctx.runAction(internal.emails.feedbackEmails.sendFeedbackNotifications, {
134
138
  feedbackId: args.feedbackId,
135
139
  analysis: null,
140
+ resendApiKey: args.resendApiKey,
141
+ resendFromEmail: args.resendFromEmail,
136
142
  });
137
143
  } catch {
138
144
  console.log("Email notifications not configured");
@@ -249,6 +255,8 @@ Provide your analysis in the JSON format specified.`;
249
255
  estimatedEffort: analysis.estimatedEffort,
250
256
  suggestedPriority: analysis.suggestedPriority,
251
257
  },
258
+ resendApiKey: args.resendApiKey,
259
+ resendFromEmail: args.resendFromEmail,
252
260
  });
253
261
 
254
262
  // Mark notifications as sent
@@ -262,3 +270,29 @@ Provide your analysis in the JSON format specified.`;
262
270
  return { success: true };
263
271
  },
264
272
  });
273
+
274
+ /**
275
+ * Public wrapper for processFeedback that can be called from parent app.
276
+ * Accepts optional API keys since Convex components don't inherit parent env vars.
277
+ */
278
+ export const processFeedbackPublic = action({
279
+ args: {
280
+ feedbackId: v.id("feedback"),
281
+ openRouterApiKey: v.optional(v.string()),
282
+ resendApiKey: v.optional(v.string()),
283
+ resendFromEmail: v.optional(v.string()),
284
+ },
285
+ returns: v.object({
286
+ success: v.boolean(),
287
+ error: v.optional(v.string()),
288
+ }),
289
+ handler: async (ctx, args): Promise<{ success: boolean; error?: string }> => {
290
+ // Delegate to the internal action
291
+ return await ctx.runAction(internal.agents.feedbackAgent.processFeedback, {
292
+ feedbackId: args.feedbackId,
293
+ openRouterApiKey: args.openRouterApiKey,
294
+ resendApiKey: args.resendApiKey,
295
+ resendFromEmail: args.resendFromEmail,
296
+ });
297
+ },
298
+ });
@@ -1,13 +1,20 @@
1
1
  /**
2
- * Feedback Interview Agent exports
2
+ * Agent exports for the feedback component.
3
+ *
4
+ * This file exports public actions that can be called from the parent app.
3
5
  */
6
+
7
+ // Re-export all interview agent functions (public actions and queries)
4
8
  export {
5
- bugInterviewAgent,
6
- feedbackInterviewAgent,
7
9
  startBugInterview,
8
10
  startFeedbackInterview,
9
11
  continueInterview,
10
12
  getSessionByThread,
11
- createSession,
12
- updateSession,
13
13
  } from "./feedbackInterviewAgent";
14
+
15
+ // Export public processing actions (for parent app to call with API keys)
16
+ export { processBugReportPublic } from "./bugReportAgent";
17
+ export { processFeedbackPublic } from "./feedbackAgent";
18
+
19
+ // Note: createSession and updateSession are internalMutation and cannot be re-exported here.
20
+ // They are accessed via internal.agents.feedbackInterviewAgent.* within the component.
@@ -66,6 +66,13 @@ export const create = mutation({
66
66
  viewportWidth: v.number(),
67
67
  viewportHeight: v.number(),
68
68
  networkState: v.string(),
69
+ // When true, skip auto-scheduling of AI analysis/email notifications
70
+ // Use this when the parent app will handle processing with its own API keys
71
+ skipAutoProcess: v.optional(v.boolean()),
72
+ // Optional API keys - pass from parent app since components don't inherit env vars
73
+ openRouterApiKey: v.optional(v.string()),
74
+ resendApiKey: v.optional(v.string()),
75
+ resendFromEmail: v.optional(v.string()),
69
76
  },
70
77
  returns: v.id("bugReports"),
71
78
  handler: async (ctx, args) => {
@@ -93,14 +100,21 @@ export const create = mutation({
93
100
  });
94
101
 
95
102
  // Schedule AI analysis and email notifications (runs immediately)
96
- // This uses a try-catch to gracefully handle if agents aren't configured
97
- try {
98
- await ctx.scheduler.runAfter(0, internal.agents.bugReportAgent.processBugReport, {
99
- bugReportId: reportId,
100
- });
101
- } catch {
102
- // AI agent not available, continue without analysis
103
- console.log("AI agent not configured, skipping analysis");
103
+ // Skip if parent app will handle processing with its own API keys
104
+ if (!args.skipAutoProcess) {
105
+ // This uses a try-catch to gracefully handle if agents aren't configured
106
+ try {
107
+ await ctx.scheduler.runAfter(0, internal.agents.bugReportAgent.processBugReport, {
108
+ bugReportId: reportId,
109
+ // Forward API keys from parent app (components don't inherit env vars)
110
+ openRouterApiKey: args.openRouterApiKey,
111
+ resendApiKey: args.resendApiKey,
112
+ resendFromEmail: args.resendFromEmail,
113
+ });
114
+ } catch {
115
+ // AI agent not available, continue without analysis
116
+ console.log("AI agent not configured, skipping analysis");
117
+ }
104
118
  }
105
119
 
106
120
  return reportId;
@@ -347,6 +347,9 @@ export const sendBugReportNotifications = internalAction({
347
347
  }),
348
348
  v.null()
349
349
  ),
350
+ // Optional API keys - passed from parent app since components don't inherit env vars
351
+ resendApiKey: v.optional(v.string()),
352
+ resendFromEmail: v.optional(v.string()),
350
353
  },
351
354
  returns: v.object({
352
355
  success: v.boolean(),
@@ -363,8 +366,8 @@ export const sendBugReportNotifications = internalAction({
363
366
  teamEmailsSent: number;
364
367
  error?: string;
365
368
  }> => {
366
- // Check for Resend API key
367
- const resendApiKey = process.env.RESEND_API_KEY;
369
+ // Check for Resend API key - prefer args (from parent app), fallback to env
370
+ const resendApiKey = args.resendApiKey || process.env.RESEND_API_KEY;
368
371
  if (!resendApiKey) {
369
372
  console.warn("RESEND_API_KEY not configured. Skipping email notifications.");
370
373
  return {
@@ -376,7 +379,7 @@ export const sendBugReportNotifications = internalAction({
376
379
  }
377
380
 
378
381
  const resend = new Resend(resendApiKey);
379
- const fromEmail = process.env.RESEND_FROM_EMAIL || "bugs@resend.dev";
382
+ const fromEmail = args.resendFromEmail || process.env.RESEND_FROM_EMAIL || "bugs@resend.dev";
380
383
 
381
384
  // Get bug report data
382
385
  const report = await ctx.runQuery(
@@ -328,6 +328,9 @@ export const sendFeedbackNotifications = internalAction({
328
328
  }),
329
329
  v.null()
330
330
  ),
331
+ // Optional API keys - passed from parent app since components don't inherit env vars
332
+ resendApiKey: v.optional(v.string()),
333
+ resendFromEmail: v.optional(v.string()),
331
334
  },
332
335
  returns: v.object({
333
336
  success: v.boolean(),
@@ -344,8 +347,8 @@ export const sendFeedbackNotifications = internalAction({
344
347
  teamEmailsSent: number;
345
348
  error?: string;
346
349
  }> => {
347
- // Check for Resend API key
348
- const resendApiKey = process.env.RESEND_API_KEY;
350
+ // Check for Resend API key - prefer args (from parent app), fallback to env
351
+ const resendApiKey = args.resendApiKey || process.env.RESEND_API_KEY;
349
352
  if (!resendApiKey) {
350
353
  console.warn("RESEND_API_KEY not configured. Skipping email notifications.");
351
354
  return {
@@ -357,7 +360,7 @@ export const sendFeedbackNotifications = internalAction({
357
360
  }
358
361
 
359
362
  const resend = new Resend(resendApiKey);
360
- const fromEmail = process.env.RESEND_FROM_EMAIL || "feedback@resend.dev";
363
+ const fromEmail = args.resendFromEmail || process.env.RESEND_FROM_EMAIL || "feedback@resend.dev";
361
364
 
362
365
  // Get feedback data
363
366
  const feedback = await ctx.runQuery(internal.emails.feedbackEmails.getFeedbackForEmail, {
@@ -68,6 +68,13 @@ export const create = mutation({
68
68
  viewportWidth: v.number(),
69
69
  viewportHeight: v.number(),
70
70
  networkState: v.string(),
71
+ // When true, skip auto-scheduling of AI analysis/email notifications
72
+ // Use this when the parent app will handle processing with its own API keys
73
+ skipAutoProcess: v.optional(v.boolean()),
74
+ // Optional API keys - pass from parent app since components don't inherit env vars
75
+ openRouterApiKey: v.optional(v.string()),
76
+ resendApiKey: v.optional(v.string()),
77
+ resendFromEmail: v.optional(v.string()),
71
78
  },
72
79
  returns: v.id("feedback"),
73
80
  handler: async (ctx, args) => {
@@ -96,13 +103,20 @@ export const create = mutation({
96
103
  });
97
104
 
98
105
  // Schedule AI analysis and email notifications (runs immediately)
99
- try {
100
- await ctx.scheduler.runAfter(0, internal.agents.feedbackAgent.processFeedback, {
101
- feedbackId,
102
- });
103
- } catch {
104
- // AI agent not available, continue without analysis
105
- console.log("AI agent not configured, skipping analysis");
106
+ // Skip if parent app will handle processing with its own API keys
107
+ if (!args.skipAutoProcess) {
108
+ try {
109
+ await ctx.scheduler.runAfter(0, internal.agents.feedbackAgent.processFeedback, {
110
+ feedbackId,
111
+ // Forward API keys from parent app (components don't inherit env vars)
112
+ openRouterApiKey: args.openRouterApiKey,
113
+ resendApiKey: args.resendApiKey,
114
+ resendFromEmail: args.resendFromEmail,
115
+ });
116
+ } catch {
117
+ // AI agent not available, continue without analysis
118
+ console.log("AI agent not configured, skipping analysis");
119
+ }
106
120
  }
107
121
 
108
122
  return feedbackId;
package/src/index.ts CHANGED
@@ -22,7 +22,23 @@
22
22
  * export default app;
23
23
  * ```
24
24
  *
25
- * 2. Set required environment variables in your Convex dashboard:
25
+ * 2. Pass API keys when creating bug reports/feedback:
26
+ *
27
+ * **Important:** Convex components don't inherit environment variables from the
28
+ * parent app. You must pass the API keys when calling the component's create
29
+ * mutations:
30
+ *
31
+ * ```typescript
32
+ * // In your parent app wrapper function:
33
+ * await ctx.runMutation(components.feedback.bugReports.create, {
34
+ * ...args,
35
+ * openRouterApiKey: process.env.OPENROUTER_API_KEY,
36
+ * resendApiKey: process.env.RESEND_API_KEY,
37
+ * resendFromEmail: process.env.RESEND_FROM_EMAIL,
38
+ * });
39
+ * ```
40
+ *
41
+ * The following environment variables should be set in your Convex dashboard:
26
42
  * - `OPENROUTER_API_KEY` - For AI analysis (optional)
27
43
  * - `RESEND_API_KEY` - For email notifications (optional)
28
44
  * - `RESEND_FROM_EMAIL` - From address for emails (optional)