@code-insights/cli 3.3.0 → 3.3.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 (58) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +11 -7
  3. package/dashboard-dist/assets/{index-cAfuFBOl.js → index-BRUFVAPq.js} +148 -138
  4. package/dashboard-dist/assets/index-CYJdtaMC.css +1 -0
  5. package/dashboard-dist/favicon.svg +17 -3
  6. package/dashboard-dist/index.html +2 -2
  7. package/dist/commands/dashboard.d.ts.map +1 -1
  8. package/dist/commands/dashboard.js +9 -1
  9. package/dist/commands/dashboard.js.map +1 -1
  10. package/dist/commands/init.d.ts.map +1 -1
  11. package/dist/commands/init.js +4 -1
  12. package/dist/commands/init.js.map +1 -1
  13. package/dist/commands/install-hook.d.ts.map +1 -1
  14. package/dist/commands/install-hook.js +48 -40
  15. package/dist/commands/install-hook.js.map +1 -1
  16. package/dist/commands/reset.d.ts.map +1 -1
  17. package/dist/commands/reset.js +4 -1
  18. package/dist/commands/reset.js.map +1 -1
  19. package/dist/commands/status.d.ts.map +1 -1
  20. package/dist/commands/status.js +66 -58
  21. package/dist/commands/status.js.map +1 -1
  22. package/dist/commands/sync.d.ts.map +1 -1
  23. package/dist/commands/sync.js +5 -1
  24. package/dist/commands/sync.js.map +1 -1
  25. package/dist/types.d.ts +27 -3
  26. package/dist/types.d.ts.map +1 -1
  27. package/dist/utils/banner.d.ts +6 -0
  28. package/dist/utils/banner.d.ts.map +1 -0
  29. package/dist/utils/banner.js +30 -0
  30. package/dist/utils/banner.js.map +1 -0
  31. package/dist/utils/telemetry.d.ts +16 -0
  32. package/dist/utils/telemetry.d.ts.map +1 -1
  33. package/dist/utils/telemetry.js +76 -0
  34. package/dist/utils/telemetry.js.map +1 -1
  35. package/dist/utils/welcome.d.ts.map +1 -1
  36. package/dist/utils/welcome.js +2 -3
  37. package/dist/utils/welcome.js.map +1 -1
  38. package/package.json +1 -1
  39. package/server-dist/llm/analysis.d.ts +5 -1
  40. package/server-dist/llm/analysis.d.ts.map +1 -1
  41. package/server-dist/llm/analysis.js +58 -17
  42. package/server-dist/llm/analysis.js.map +1 -1
  43. package/server-dist/llm/prompts.d.ts +45 -9
  44. package/server-dist/llm/prompts.d.ts.map +1 -1
  45. package/server-dist/llm/prompts.js +199 -60
  46. package/server-dist/llm/prompts.js.map +1 -1
  47. package/server-dist/llm/providers/anthropic.js +1 -1
  48. package/server-dist/llm/providers/gemini.js +1 -1
  49. package/server-dist/llm/providers/openai.d.ts.map +1 -1
  50. package/server-dist/llm/providers/openai.js +1 -0
  51. package/server-dist/llm/providers/openai.js.map +1 -1
  52. package/server-dist/routes/analysis.d.ts.map +1 -1
  53. package/server-dist/routes/analysis.js +80 -28
  54. package/server-dist/routes/analysis.js.map +1 -1
  55. package/server-dist/routes/analytics.d.ts.map +1 -1
  56. package/server-dist/routes/analytics.js +10 -0
  57. package/server-dist/routes/analytics.js.map +1 -1
  58. package/dashboard-dist/assets/index-BMhL7wL8.css +0 -1
@@ -1,5 +1,6 @@
1
1
  // Analysis prompts and response parsers for LLM session analysis.
2
2
  // Ported from web repo (src/lib/llm/prompts.ts) with SQLite-aware message formatting.
3
+ import { jsonrepair } from 'jsonrepair';
3
4
  /**
4
5
  * Format SQLite message rows for LLM consumption.
5
6
  * Handles snake_case fields and JSON-encoded tool_calls/tool_results.
@@ -38,9 +39,9 @@ export function formatMessagesForAnalysis(messages) {
38
39
  const thinkingInfo = m.thinking
39
40
  ? `\n[Thinking: ${m.thinking.slice(0, 1000)}]`
40
41
  : '';
41
- // Include tool results for context — 200 chars per result
42
+ // Include tool results for context — 500 chars per result (error messages need ~300-400 chars)
42
43
  const resultInfo = toolResults.length > 0
43
- ? `\n[Tool results: ${toolResults.map(r => (r.output || '').slice(0, 200)).join(' | ')}]`
44
+ ? `\n[Tool results: ${toolResults.map(r => (r.output || '').slice(0, 500)).join(' | ')}]`
44
45
  : '';
45
46
  return `### ${roleLabel}:\n${m.content}${thinkingInfo}${toolInfo}${resultInfo}`;
46
47
  })
@@ -49,12 +50,22 @@ export function formatMessagesForAnalysis(messages) {
49
50
  /**
50
51
  * System prompt for session analysis.
51
52
  */
52
- export const SESSION_ANALYSIS_SYSTEM_PROMPT = `You are an expert at analyzing software development conversations and extracting valuable insights. Your task is to analyze an AI coding session (a conversation between a user and an AI coding assistant) and extract structured insights.
53
+ export const SESSION_ANALYSIS_SYSTEM_PROMPT = `You are a senior staff engineer writing entries for a team's engineering knowledge base. You've just observed an AI-assisted coding session and your job is to extract the insights that would save another engineer time if they encountered a similar situation 6 months from now.
53
54
 
54
- You will identify:
55
- 1. **Summary**: A high-level narrative of what was accomplished
56
- 2. **Decisions**: Technical choices made, including reasoning and alternatives considered (max 3)
57
- 3. **Learnings**: Technical discoveries, gotchas, problem-solving approaches, debugging strategies, or transferable knowledge (max 5)
55
+ Your audience is a developer who has never seen this session but works on the same codebase. They need enough context to understand WHY a decision was made, WHAT specific gotcha was discovered, and WHEN this knowledge applies.
56
+
57
+ You will extract:
58
+ 1. **Summary**: A narrative of what was accomplished and the outcome
59
+ 2. **Decisions**: Technical choices made — with full situation context, reasoning, rejected alternatives, trade-offs, and conditions for revisiting (max 3)
60
+ 3. **Learnings**: Technical discoveries, gotchas, debugging breakthroughs — with the observable symptom, root cause, and a transferable takeaway (max 5)
61
+ 4. **Session Character**: Classify the session into exactly one of these types based on its overall nature:
62
+ - deep_focus: Long, concentrated work on a specific problem or area (50+ messages, deep into one topic)
63
+ - bug_hunt: Debugging-driven — investigating errors, tracing issues, fixing bugs
64
+ - feature_build: Building new functionality — creating files, adding endpoints, wiring components
65
+ - exploration: Research-oriented — reading code, searching, understanding before acting
66
+ - refactor: Restructuring existing code — renaming, moving, reorganizing without new features
67
+ - learning: Knowledge-seeking — asking questions, understanding concepts, getting explanations
68
+ - quick_task: Short and focused — small fix, config change, or one-off task (<10 messages)
58
69
 
59
70
  Quality Standards:
60
71
  - Only include insights you would write in a team knowledge base for future reference
@@ -63,7 +74,12 @@ Quality Standards:
63
74
  - Rate your confidence in each insight's value (0-100). Only include insights you rate 70+.
64
75
  - It is better to return 0 insights in a category than to include generic or trivial ones
65
76
  - If a session is straightforward with no notable decisions or learnings, say so in the summary and leave other categories empty
66
- - The summary must mention the most important concrete artifact changed (file, endpoint, or test) if any
77
+
78
+ Length Guidance:
79
+ - Fill every field in the schema. An empty "trade_offs" or "revisit_when" is worse than a longer response.
80
+ - Total response: stay under 2000 tokens. If you must cut, drop lower-confidence insights rather than compressing high-confidence ones.
81
+ - Evidence: 1-3 short quotes per insight, referencing turn labels.
82
+ - Prefer precision over brevity — a specific 3-sentence insight beats a vague 1-sentence insight.
67
83
 
68
84
  DO NOT include insights like these (too generic/trivial):
69
85
  - "Used debugging techniques to fix an issue"
@@ -73,6 +89,35 @@ DO NOT include insights like these (too generic/trivial):
73
89
  - "Fixed a bug in the code" (what bug? what was the root cause?)
74
90
  - Anything that restates the task without adding transferable knowledge
75
91
 
92
+ Here are examples of EXCELLENT insights — this is the quality bar:
93
+
94
+ EXCELLENT decision:
95
+ {
96
+ "title": "Use better-sqlite3 instead of sql.js for local database",
97
+ "situation": "Needed a SQLite driver for a Node.js CLI that stores session data locally. Single-user, read-heavy from dashboard, occasional writes during sync.",
98
+ "choice": "better-sqlite3 — synchronous C++ binding with native SQLite access, no async overhead.",
99
+ "reasoning": "CLI runs locally with no concurrent users. Synchronous API eliminates callback complexity. WAL mode provides concurrent read access for the dashboard while CLI writes.",
100
+ "alternatives": [
101
+ {"option": "sql.js (WASM build)", "rejected_because": "3x slower for bulk inserts, entire DB in memory, no WAL support"},
102
+ {"option": "PostgreSQL via Docker", "rejected_because": "Violates local-first constraint — requires running a server process"}
103
+ ],
104
+ "trade_offs": "Requires native compilation (node-gyp) which can fail on some systems. No browser compatibility.",
105
+ "revisit_when": "If multi-device sync is added or users report node-gyp build failures.",
106
+ "confidence": 92,
107
+ "evidence": ["User#3: 'We need something that works without a server'", "Assistant#4: 'better-sqlite3 with WAL mode gives concurrent reads...'"]
108
+ }
109
+
110
+ EXCELLENT learning:
111
+ {
112
+ "title": "Tailwind v4 requires @theme inline{} for CSS variable utilities",
113
+ "symptom": "After Tailwind v3→v4 upgrade, custom utilities like bg-primary stopped working. Classes present in HTML but no styles applied.",
114
+ "root_cause": "Tailwind v4 removed tailwind.config.js theme extension. CSS variables in :root are not automatically available as utilities — must be registered via @theme inline {} in the CSS file.",
115
+ "takeaway": "When migrating Tailwind v3→v4 with shadcn/ui: add @theme inline {} mapping CSS variables, add @custom-variant dark for class-based dark mode, replace tailwindcss-animate with tw-animate-css.",
116
+ "applies_when": "Any Tailwind v3→v4 migration using CSS variables for theming, especially with shadcn/ui.",
117
+ "confidence": 95,
118
+ "evidence": ["User#12: 'The colors are all gone after the upgrade'", "Assistant#13: 'Tailwind v4 requires explicit @theme inline registration...'"]
119
+ }
120
+
76
121
  Respond with valid JSON only, wrapped in <json>...</json> tags. Do not include any other text.`;
77
122
  /**
78
123
  * Generate the user prompt for session analysis.
@@ -88,28 +133,37 @@ ${formattedMessages}
88
133
 
89
134
  Extract insights in this JSON format:
90
135
  {
136
+ "session_character": "deep_focus | bug_hunt | feature_build | exploration | refactor | learning | quick_task",
91
137
  "summary": {
92
- "title": "Brief title describing main accomplishment (max 60 chars)",
93
- "content": "2-3 sentence narrative of what was accomplished",
94
- "bullets": ["Key point 1", "Key point 2", "Key point 3"]
138
+ "title": "Brief title describing main accomplishment (max 80 chars)",
139
+ "content": "2-4 sentence narrative: what was the goal, what was done, what was the outcome. Mention the primary file or component changed.",
140
+ "outcome": "success | partial | abandoned | blocked",
141
+ "bullets": ["Each bullet names a specific artifact (file, function, endpoint) and what changed"]
95
142
  },
96
143
  "decisions": [
97
144
  {
98
- "title": "The specific decision made (max 60 chars)",
99
- "content": "Detailed explanation with concrete details",
100
- "reasoning": "Why this choice was made over alternatives",
101
- "alternatives": ["Alternative 1 considered", "Alternative 2 considered"],
145
+ "title": "The specific technical choice made (max 80 chars)",
146
+ "situation": "What problem or requirement led to this decision point",
147
+ "choice": "What was chosen and how it was implemented",
148
+ "reasoning": "Why this choice was made — the key factors that tipped the decision",
149
+ "alternatives": [
150
+ {"option": "Name of alternative", "rejected_because": "Why it was not chosen"}
151
+ ],
152
+ "trade_offs": "What downsides were accepted, what was given up",
153
+ "revisit_when": "Under what conditions this decision should be reconsidered (or 'N/A' if permanent)",
102
154
  "confidence": 85,
103
- "evidence": ["User#4: ...", "Assistant#5: ..."]
155
+ "evidence": ["User#4: quoted text...", "Assistant#5: quoted text..."]
104
156
  }
105
157
  ],
106
158
  "learnings": [
107
159
  {
108
- "title": "Specific thing learned (max 60 chars)",
109
- "content": "Detailed explanation with concrete details",
110
- "context": "When/where this applies and why it matters",
160
+ "title": "Specific technical discovery or gotcha (max 80 chars)",
161
+ "symptom": "What went wrong or was confusing — the observable behavior that triggered investigation",
162
+ "root_cause": "The underlying technical reason why it happened",
163
+ "takeaway": "The transferable lesson — what to do or avoid in similar situations, useful outside this project",
164
+ "applies_when": "Conditions under which this knowledge is relevant (framework version, configuration, etc.)",
111
165
  "confidence": 80,
112
- "evidence": ["User#7: ...", "Assistant#8: ..."]
166
+ "evidence": ["User#7: quoted text...", "Assistant#8: quoted text..."]
113
167
  }
114
168
  ]
115
169
  }
@@ -119,6 +173,14 @@ Evidence should reference the labeled turns in the conversation (e.g., "User#2",
119
173
 
120
174
  Respond with valid JSON only, wrapped in <json>...</json> tags. Do not include any other text.`;
121
175
  }
176
+ const VALID_SESSION_CHARACTERS = new Set([
177
+ 'deep_focus', 'bug_hunt', 'feature_build', 'exploration', 'refactor', 'learning', 'quick_task',
178
+ ]);
179
+ function buildResponsePreview(text, head = 200, tail = 200) {
180
+ if (text.length <= head + tail + 20)
181
+ return text;
182
+ return `${text.slice(0, head)}\n...[${text.length - head - tail} chars omitted]...\n${text.slice(-tail)}`;
183
+ }
122
184
  function extractJsonPayload(response) {
123
185
  const tagged = response.match(/<json>\s*([\s\S]*?)\s*<\/json>/i);
124
186
  if (tagged?.[1])
@@ -130,45 +192,83 @@ function extractJsonPayload(response) {
130
192
  * Parse the LLM response into structured insights.
131
193
  */
132
194
  export function parseAnalysisResponse(response) {
195
+ const response_length = response.length;
196
+ const preview = buildResponsePreview(response);
197
+ const jsonPayload = extractJsonPayload(response);
198
+ if (!jsonPayload) {
199
+ console.error('No JSON found in analysis response');
200
+ return {
201
+ success: false,
202
+ error: { error_type: 'no_json_found', error_message: 'No JSON found in analysis response', response_length, response_preview: preview },
203
+ };
204
+ }
205
+ let parsed;
133
206
  try {
134
- const jsonPayload = extractJsonPayload(response);
135
- if (!jsonPayload) {
136
- console.error('No JSON found in analysis response');
137
- return null;
207
+ parsed = JSON.parse(jsonPayload);
208
+ }
209
+ catch {
210
+ // Attempt repair — handles trailing commas, unclosed braces, truncated output
211
+ try {
212
+ parsed = JSON.parse(jsonrepair(jsonPayload));
138
213
  }
139
- const parsed = JSON.parse(jsonPayload);
140
- if (!parsed.summary || typeof parsed.summary.title !== 'string') {
141
- console.error('Invalid analysis response structure');
142
- return null;
214
+ catch (err) {
215
+ const msg = err instanceof Error ? err.message : String(err);
216
+ console.error('Failed to parse analysis response (after jsonrepair):', err);
217
+ return {
218
+ success: false,
219
+ error: { error_type: 'json_parse_error', error_message: msg, response_length, response_preview: preview },
220
+ };
143
221
  }
144
- parsed.decisions = parsed.decisions || [];
145
- parsed.learnings = parsed.learnings || [];
146
- return parsed;
147
222
  }
148
- catch (error) {
149
- console.error('Failed to parse analysis response:', error);
150
- return null;
223
+ if (!parsed.summary || typeof parsed.summary.title !== 'string') {
224
+ console.error('Invalid analysis response structure');
225
+ return {
226
+ success: false,
227
+ error: { error_type: 'invalid_structure', error_message: 'Missing or invalid summary field', response_length, response_preview: preview },
228
+ };
229
+ }
230
+ parsed.decisions = parsed.decisions || [];
231
+ parsed.learnings = parsed.learnings || [];
232
+ // Validate session_character — drop if not a recognized value
233
+ if (parsed.session_character && !VALID_SESSION_CHARACTERS.has(parsed.session_character)) {
234
+ parsed.session_character = undefined;
151
235
  }
236
+ return { success: true, data: parsed };
152
237
  }
153
238
  // --- Prompt Quality Analysis ---
154
- export const PROMPT_QUALITY_SYSTEM_PROMPT = `You are an expert at analyzing how effectively humans communicate with AI coding assistants. Your task is to review a conversation between a user and Claude Code, and evaluate the user's prompting efficiency.
239
+ export const PROMPT_QUALITY_SYSTEM_PROMPT = `You are a prompt engineering coach helping developers communicate more effectively with AI coding assistants. You review conversations and identify specific moments where better prompting would have saved time.
155
240
 
156
241
  You will identify:
157
242
  1. **Wasted turns**: User messages that led to clarifications, corrections, or repeated instructions because the original prompt was unclear, missing context, or too vague.
158
- 2. **Anti-patterns**: Recurring bad habits in the user's prompting style.
159
- 3. **Efficiency score**: A 0-100 rating of how optimally the user communicated.
160
- 4. **Actionable tips**: Specific improvements the user can make.
243
+ 2. **Anti-patterns**: Recurring bad habits in the user's prompting style, with specific fixes.
244
+ 3. **Session traits**: Higher-level behavioral patterns about how the session was structured and managed.
245
+ 4. **Efficiency score**: A 0-100 rating of how optimally the user communicated.
246
+ 5. **Actionable tips**: Specific improvements the user can make.
247
+
248
+ Before evaluating, mentally walk through the conversation and identify:
249
+ 1. Each time the assistant asked for clarification that could have been avoided
250
+ 2. Each time the user corrected the assistant's interpretation
251
+ 3. Each time the user repeated an instruction they gave earlier
252
+ 4. Whether the session covers too many unrelated objectives (context drift / session bloat)
253
+ 5. Whether the user provided critical context or requirements late that should have been mentioned upfront
254
+ 6. Whether the user discussed the plan/approach before jumping into implementation, or dove straight into code
255
+ These are your candidate findings. Only include them if they are genuinely actionable.
161
256
 
162
257
  Guidelines:
163
258
  - Focus on USER messages only — don't critique the assistant's responses
164
259
  - A "wasted turn" is when the user had to send a follow-up message to clarify, correct, or repeat something that could have been included in the original prompt
165
260
  - Only mark a wasted turn if the assistant explicitly asked for clarification or corrected a misunderstanding
166
- - Common anti-patterns: vague instructions, missing file paths, not providing error messages, incomplete requirements, repeated instructions, not specifying what "it" refers to
167
261
  - Be constructive, not judgmental — the goal is to help users improve
168
262
  - Consider the context: some clarification exchanges are normal and expected
169
263
  - A score of 100 means every user message was perfectly clear and complete
170
264
  - A score of 50 means about half the messages could have been more efficient
171
265
 
266
+ Length Guidance:
267
+ - Max 5 wasted turns, max 3 anti-patterns, max 3 session traits, max 5 tips
268
+ - suggestedRewrite must be a complete, usable prompt — not vague meta-advice
269
+ - overallAssessment: 2-3 sentences
270
+ - Total response: stay under 2000 tokens
271
+
172
272
  Respond with valid JSON only, wrapped in <json>...</json> tags. Do not include any other text.`;
173
273
  export function generatePromptQualityPrompt(projectName, formattedMessages, messageCount) {
174
274
  return `Analyze the user's prompting efficiency in this AI coding session.
@@ -188,15 +288,28 @@ Evaluate the user's prompting quality and respond with this JSON format:
188
288
  "wastedTurns": [
189
289
  {
190
290
  "messageIndex": 5,
191
- "reason": "Missing context — didn't specify which file to modify",
192
- "suggestedRewrite": "A better version of the user's original message that would have avoided the follow-up"
291
+ "originalMessage": "The user's original message (abbreviated if long)",
292
+ "whatWentWrong": "What information was missing or ambiguous that caused a follow-up",
293
+ "suggestedRewrite": "A concrete rewrite that includes the missing context — must be a complete, usable prompt",
294
+ "turnsWasted": 2
193
295
  }
194
296
  ],
195
297
  "antiPatterns": [
196
298
  {
197
299
  "name": "Vague Instructions",
300
+ "description": "Requests that lack specificity about what file, function, or behavior to change",
198
301
  "count": 3,
199
- "examples": ["fix it", "make it work", "do the thing"]
302
+ "examples": ["User#2: 'fix it'", "User#5: 'make it work'"],
303
+ "fix": "Include the file path, function name, and expected vs actual behavior in the initial request"
304
+ }
305
+ ],
306
+ "sessionTraits": [
307
+ {
308
+ "trait": "context_drift | objective_bloat | late_context | no_planning | good_structure",
309
+ "severity": "high | medium | low",
310
+ "description": "What was observed and why it matters",
311
+ "evidence": "User#3 switched from auth to styling, then back to auth at User#12",
312
+ "suggestion": "Break into separate sessions: one for auth, one for styling"
200
313
  }
201
314
  ],
202
315
  "tips": [
@@ -205,6 +318,13 @@ Evaluate the user's prompting quality and respond with this JSON format:
205
318
  ]
206
319
  }
207
320
 
321
+ Session trait definitions:
322
+ - **context_drift**: Session covers too many unrelated objectives, causing the AI to lose context and produce lower quality output
323
+ - **objective_bloat**: Too many different tasks crammed into one session instead of focused, single-purpose sessions
324
+ - **late_context**: Critical requirements, constraints, or context provided late in the conversation that should have been mentioned upfront — causing rework or wasted turns
325
+ - **no_planning**: User jumped straight into implementation without discussing approach, requirements, or plan — leading to course corrections mid-session
326
+ - **good_structure**: Session was well-structured with clear objectives, upfront context, and logical flow (only include this if truly exemplary)
327
+
208
328
  Rules:
209
329
  - messageIndex refers to the 0-based index of the USER message, as labeled in the conversation (e.g., User#0)
210
330
  - Only include genuinely wasted turns, not normal back-and-forth
@@ -215,28 +335,47 @@ Rules:
215
335
  Respond with valid JSON only, wrapped in <json>...</json> tags. Do not include any other text.`;
216
336
  }
217
337
  export function parsePromptQualityResponse(response) {
338
+ const response_length = response.length;
339
+ const preview = buildResponsePreview(response);
340
+ const jsonPayload = extractJsonPayload(response);
341
+ if (!jsonPayload) {
342
+ console.error('No JSON found in prompt quality response');
343
+ return {
344
+ success: false,
345
+ error: { error_type: 'no_json_found', error_message: 'No JSON found in prompt quality response', response_length, response_preview: preview },
346
+ };
347
+ }
348
+ let parsed;
218
349
  try {
219
- const jsonPayload = extractJsonPayload(response);
220
- if (!jsonPayload) {
221
- console.error('No JSON found in prompt quality response');
222
- return null;
350
+ parsed = JSON.parse(jsonPayload);
351
+ }
352
+ catch {
353
+ try {
354
+ parsed = JSON.parse(jsonrepair(jsonPayload));
223
355
  }
224
- const parsed = JSON.parse(jsonPayload);
225
- if (typeof parsed.efficiencyScore !== 'number') {
226
- console.error('Invalid prompt quality response: missing efficiencyScore');
227
- return null;
356
+ catch (err) {
357
+ const msg = err instanceof Error ? err.message : String(err);
358
+ console.error('Failed to parse prompt quality response (after jsonrepair):', err);
359
+ return {
360
+ success: false,
361
+ error: { error_type: 'json_parse_error', error_message: msg, response_length, response_preview: preview },
362
+ };
228
363
  }
229
- parsed.efficiencyScore = Math.max(0, Math.min(100, Math.round(parsed.efficiencyScore)));
230
- parsed.potentialMessageReduction = parsed.potentialMessageReduction || 0;
231
- parsed.overallAssessment = parsed.overallAssessment || '';
232
- parsed.wastedTurns = parsed.wastedTurns || [];
233
- parsed.antiPatterns = parsed.antiPatterns || [];
234
- parsed.tips = parsed.tips || [];
235
- return parsed;
236
364
  }
237
- catch (error) {
238
- console.error('Failed to parse prompt quality response:', error);
239
- return null;
365
+ if (typeof parsed.efficiencyScore !== 'number') {
366
+ console.error('Invalid prompt quality response: missing efficiencyScore');
367
+ return {
368
+ success: false,
369
+ error: { error_type: 'invalid_structure', error_message: 'Missing or invalid efficiencyScore field', response_length, response_preview: preview },
370
+ };
240
371
  }
372
+ parsed.efficiencyScore = Math.max(0, Math.min(100, Math.round(parsed.efficiencyScore)));
373
+ parsed.potentialMessageReduction = parsed.potentialMessageReduction || 0;
374
+ parsed.overallAssessment = parsed.overallAssessment || '';
375
+ parsed.wastedTurns = parsed.wastedTurns || [];
376
+ parsed.antiPatterns = parsed.antiPatterns || [];
377
+ parsed.sessionTraits = parsed.sessionTraits || [];
378
+ parsed.tips = parsed.tips || [];
379
+ return { success: true, data: parsed };
241
380
  }
242
381
  //# sourceMappingURL=prompts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/llm/prompts.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,sFAAsF;AAyBtF;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,QAA4B;IACpE,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,cAAc,GAAG,CAAC,CAAC;IAEvB,OAAO,QAAQ;SACZ,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,C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AAE,MAAM,EAAE,CAAC;AACzC,CAAC"}
@@ -19,7 +19,7 @@ export function createAnthropicClient(apiKey, model) {
19
19
  signal: options?.signal,
20
20
  body: JSON.stringify({
21
21
  model,
22
- max_tokens: 4096,
22
+ max_tokens: 8192,
23
23
  system: systemMessage?.content,
24
24
  messages: chatMessages.map(m => ({ role: m.role, content: m.content })),
25
25
  }),
@@ -14,7 +14,7 @@ export function createGeminiClient(apiKey, model) {
14
14
  contents,
15
15
  generationConfig: {
16
16
  temperature: 0.7,
17
- maxOutputTokens: 4096,
17
+ maxOutputTokens: 8192,
18
18
  },
19
19
  };
20
20
  if (systemMessage) {
@@ -1 +1 @@
1
- {"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/openai.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAwC,MAAM,aAAa,CAAC;AAEnF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CA4C3E"}
1
+ {"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/openai.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAwC,MAAM,aAAa,CAAC;AAEnF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CA6C3E"}
@@ -15,6 +15,7 @@ export function createOpenAIClient(apiKey, model) {
15
15
  model,
16
16
  messages: messages.map(m => ({ role: m.role, content: m.content })),
17
17
  temperature: 0.7,
18
+ max_tokens: 8192,
18
19
  }),
19
20
  });
20
21
  if (!response.ok) {
@@ -1 +1 @@
1
- {"version":3,"file":"openai.js","sourceRoot":"","sources":["../../../src/llm/providers/openai.ts"],"names":[],"mappings":"AAAA,wEAAwE;AAIxE,MAAM,UAAU,kBAAkB,CAAC,MAAc,EAAE,KAAa;IAC9D,OAAO;QACL,QAAQ,EAAE,QAAQ;QAClB,KAAK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AG/B,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE;gBAChD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;oBAClB,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa;oBACrC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB;iBAC3C,CAAC,CAAC,CAAC,SAAS;aACd,CAAC;QACJ,CAAC;QAED,cAAc,CAAC,IAAY;YACzB,sDAAsD;YACtD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACpC,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"analysis.d.ts","sourceRoot":"","sources":["../../src/routes/analysis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAS5B,QAAA,MAAM,GAAG,4EAAa,CAAC;AAkWvB,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"analysis.d.ts","sourceRoot":"","sources":["../../src/routes/analysis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAS5B,QAAA,MAAM,GAAG,4EAAa,CAAC;AAmZvB,eAAe,GAAG,CAAC"}