@fatagnus/convex-feedback 0.2.4 → 0.2.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fatagnus/convex-feedback",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Bug reports and feedback collection component for Convex applications with AI analysis and email notifications",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -120,11 +120,30 @@ const generateBugReport = createTool({
120
120
  featureArea: z.string().optional().describe("Which feature area is affected"),
121
121
  }),
122
122
  handler: async (ctx, args): Promise<string> => {
123
- const sessionId = (ctx as any).sessionId as string | undefined;
124
-
125
- if (sessionId) {
123
+ // Get the session by threadId (threadId is available in tool context)
124
+ if (!ctx.threadId) {
125
+ console.warn("generateBugReport: No threadId in context, session not updated");
126
+ return JSON.stringify({
127
+ status: "REPORT_GENERATED",
128
+ report: {
129
+ title: args.title,
130
+ description: args.description,
131
+ severity: args.severity,
132
+ reproductionSteps: args.reproductionSteps,
133
+ featureArea: args.featureArea,
134
+ },
135
+ message: "Bug report has been generated. The interview is complete.",
136
+ });
137
+ }
138
+
139
+ // Query the session by threadId and update it
140
+ const session = await ctx.runQuery(api.agents.feedbackInterviewAgent.getSessionByThread, {
141
+ threadId: ctx.threadId,
142
+ });
143
+
144
+ if (session) {
126
145
  await ctx.runMutation(internal.agents.feedbackInterviewAgent.updateSession, {
127
- sessionId: sessionId as any,
146
+ sessionId: session._id,
128
147
  generatedTitle: args.title,
129
148
  generatedDescription: args.description,
130
149
  generatedSeverity: args.severity,
@@ -132,6 +151,8 @@ const generateBugReport = createTool({
132
151
  generatedReproSteps: args.reproductionSteps,
133
152
  isComplete: true,
134
153
  });
154
+ } else {
155
+ console.warn("generateBugReport: No session found for threadId", ctx.threadId);
135
156
  }
136
157
 
137
158
  return JSON.stringify({
@@ -161,11 +182,30 @@ const generateFeedback = createTool({
161
182
  featureArea: z.string().optional().describe("Which feature area this relates to"),
162
183
  }),
163
184
  handler: async (ctx, args): Promise<string> => {
164
- const sessionId = (ctx as any).sessionId as string | undefined;
165
-
166
- if (sessionId) {
185
+ // Get the session by threadId (threadId is available in tool context)
186
+ if (!ctx.threadId) {
187
+ console.warn("generateFeedback: No threadId in context, session not updated");
188
+ return JSON.stringify({
189
+ status: "FEEDBACK_GENERATED",
190
+ report: {
191
+ title: args.title,
192
+ description: args.description,
193
+ type: args.type,
194
+ priority: args.priority,
195
+ featureArea: args.featureArea,
196
+ },
197
+ message: "Feedback has been generated. The interview is complete.",
198
+ });
199
+ }
200
+
201
+ // Query the session by threadId and update it
202
+ const session = await ctx.runQuery(api.agents.feedbackInterviewAgent.getSessionByThread, {
203
+ threadId: ctx.threadId,
204
+ });
205
+
206
+ if (session) {
167
207
  await ctx.runMutation(internal.agents.feedbackInterviewAgent.updateSession, {
168
- sessionId: sessionId as any,
208
+ sessionId: session._id,
169
209
  generatedTitle: args.title,
170
210
  generatedDescription: args.description,
171
211
  generatedFeedbackType: args.type,
@@ -173,6 +213,8 @@ const generateFeedback = createTool({
173
213
  generatedFeatureArea: args.featureArea,
174
214
  isComplete: true,
175
215
  });
216
+ } else {
217
+ console.warn("generateFeedback: No session found for threadId", ctx.threadId);
176
218
  }
177
219
 
178
220
  return JSON.stringify({