@voidwire/llm-summarize 3.5.0 → 3.7.0
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/index.ts +53 -51
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -36,7 +36,6 @@ export interface SessionInsights {
|
|
|
36
36
|
patterns_used?: string[];
|
|
37
37
|
preferences_expressed?: string[];
|
|
38
38
|
problems_solved?: string[];
|
|
39
|
-
tools_heavy?: string[];
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
export interface SummarizeResult {
|
|
@@ -146,55 +145,57 @@ Output valid JSON only. No markdown, no explanation.`;
|
|
|
146
145
|
* Note: userName param kept for API compatibility but not used in insights mode
|
|
147
146
|
*/
|
|
148
147
|
function buildInsightsPrompt(_userName?: string): string {
|
|
149
|
-
return `You are a
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
<
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
- "
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
148
|
+
return `You are a session state extractor. Given a development conversation, produce a JSON snapshot of the session's current state.
|
|
149
|
+
|
|
150
|
+
<instructions>
|
|
151
|
+
1. Read the conversation in the <transcript> section
|
|
152
|
+
2. Ignore the <previous_state> section — it is background context only, not part of this session
|
|
153
|
+
3. Extract ONLY what happened in the transcript
|
|
154
|
+
4. Produce a JSON object with the fields described below
|
|
155
|
+
</instructions>
|
|
156
|
+
|
|
157
|
+
<fields>
|
|
158
|
+
- summary: One sentence describing what was accomplished this session
|
|
159
|
+
- current_focus: The specific task or feature being worked on (omit if exploratory)
|
|
160
|
+
- next_steps: Array of concrete next actions. Name the specific task.
|
|
161
|
+
- decisions: Array of decisions made this session, each with rationale
|
|
162
|
+
- patterns_used: Array of techniques or approaches applied, each with context
|
|
163
|
+
- preferences_expressed: Array of user preferences revealed through direction or correction
|
|
164
|
+
- problems_solved: Array of problems encountered with root cause and fix
|
|
165
|
+
</fields>
|
|
166
|
+
|
|
167
|
+
Include a field only when the transcript contains clear evidence. Omit empty arrays. Every value must be a complete sentence.
|
|
168
|
+
|
|
169
|
+
<example>
|
|
170
|
+
<input>
|
|
171
|
+
<previous_state>Focus: Building authentication system</previous_state>
|
|
172
|
+
<transcript>
|
|
173
|
+
User Asked: Let's use JWT instead of sessions for auth
|
|
174
|
+
Assistant Response: Switched from express-session to jsonwebtoken. JWTs are stateless so we don't need Redis for session storage anymore. Updated the middleware to verify tokens on each request.
|
|
175
|
+
User Asked: Make sure the tokens expire after 24 hours
|
|
176
|
+
Assistant Response: Set expiresIn to 24h in the sign options. Also added a refresh token flow so users don't get logged out mid-work.
|
|
177
|
+
</transcript>
|
|
178
|
+
</input>
|
|
179
|
+
<output>
|
|
180
|
+
{"summary":"Implemented JWT-based authentication replacing session-based auth, with 24-hour token expiry and refresh token flow","current_focus":"Authentication system implementation","next_steps":["Test the refresh token flow with expired tokens","Add token revocation for logout"],"decisions":["Chose JWT over sessions — eliminates Redis dependency since tokens are stateless","Set 24-hour token expiry with refresh flow — balances security with user convenience"],"preferences_expressed":["User directed specific token expiry of 24 hours"]}
|
|
181
|
+
</output>
|
|
182
|
+
</example>
|
|
183
|
+
|
|
184
|
+
<example>
|
|
185
|
+
<input>
|
|
186
|
+
<previous_state>Focus: Investigating test failures</previous_state>
|
|
187
|
+
<transcript>
|
|
188
|
+
User Asked: The CI is failing on the webhook tests
|
|
189
|
+
Assistant Response: Found the issue — the test was using a hardcoded timestamp that expired. Changed it to use a relative timestamp. Also found that the webhook handler had a race condition where two events could arrive simultaneously and both pass the idempotency check. Added a mutex lock.
|
|
190
|
+
User Asked: Good catch on the race condition
|
|
191
|
+
</transcript>
|
|
192
|
+
</input>
|
|
193
|
+
<output>
|
|
194
|
+
{"summary":"Fixed CI test failure caused by hardcoded timestamp and discovered a race condition in the webhook handler","current_focus":"Webhook test failures and handler reliability","problems_solved":["Fixed expired hardcoded timestamp in webhook tests — replaced with relative timestamp calculation","Fixed race condition in webhook handler where simultaneous events bypassed idempotency check — added mutex lock"],"next_steps":["Verify CI passes with the timestamp and mutex fixes"]}
|
|
195
|
+
</output>
|
|
196
|
+
</example>
|
|
197
|
+
|
|
198
|
+
Output valid JSON only.`;
|
|
198
199
|
}
|
|
199
200
|
|
|
200
201
|
/**
|
|
@@ -610,7 +611,8 @@ export async function summarize(
|
|
|
610
611
|
const apiKey = config.apiKey;
|
|
611
612
|
const mode: SummarizeMode = options?.mode || "insights";
|
|
612
613
|
const userName = options?.userName;
|
|
613
|
-
const systemPrompt =
|
|
614
|
+
const systemPrompt =
|
|
615
|
+
options?.systemPrompt || getPromptForMode(mode, userName);
|
|
614
616
|
|
|
615
617
|
// Validate config
|
|
616
618
|
if (!provider) {
|