@bacnh85/pi-serena 0.3.2 → 0.4.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/README.md +2 -1
- package/index.ts +0 -12
- package/package.json +1 -1
- package/worker.ts +17 -1
package/README.md
CHANGED
|
@@ -46,7 +46,6 @@ After install or update, restart Pi or run `/reload` in an existing Pi session.
|
|
|
46
46
|
- `serena_replace_content`
|
|
47
47
|
- `serena_restart_language_server`
|
|
48
48
|
- `serena_get_current_config`
|
|
49
|
-
- `serena_check_onboarding_performed`
|
|
50
49
|
- `serena_onboarding`
|
|
51
50
|
- `serena_list_memories`
|
|
52
51
|
- `serena_read_memory`
|
|
@@ -55,6 +54,8 @@ After install or update, restart Pi or run `/reload` in an existing Pi session.
|
|
|
55
54
|
|
|
56
55
|
All tool outputs are truncated to 50KB / 2000 lines to match Pi-friendly output limits. Most tools accept optional `timeout_ms`.
|
|
57
56
|
|
|
57
|
+
When a worker request exceeds the configured timeout, the Python bridge process is automatically killed and a fresh worker is started for the next call. This prevents cascading timeouts from blocking future requests.
|
|
58
|
+
|
|
58
59
|
### Pattern search
|
|
59
60
|
|
|
60
61
|
Use the Pi-facing `pattern` field with `serena_search_for_pattern`:
|
package/index.ts
CHANGED
|
@@ -434,18 +434,6 @@ export default function serenaToolsExtension(pi: ExtensionAPI) {
|
|
|
434
434
|
},
|
|
435
435
|
});
|
|
436
436
|
|
|
437
|
-
pi.registerTool({
|
|
438
|
-
name: "serena_check_onboarding_performed",
|
|
439
|
-
label: "Serena Check Onboarding",
|
|
440
|
-
description: "Check whether Serena onboarding memories exist for this project.",
|
|
441
|
-
promptSnippet: "Check whether project onboarding was already performed",
|
|
442
|
-
promptGuidelines: ["Use serena_check_onboarding_performed before relying on Serena project memories."],
|
|
443
|
-
parameters: emptyToolSchema,
|
|
444
|
-
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
445
|
-
return callSerena(ctx, "check_onboarding_performed", params);
|
|
446
|
-
},
|
|
447
|
-
});
|
|
448
|
-
|
|
449
437
|
pi.registerTool({
|
|
450
438
|
name: "serena_onboarding",
|
|
451
439
|
label: "Serena Onboarding",
|
package/package.json
CHANGED
package/worker.ts
CHANGED
|
@@ -272,7 +272,13 @@ export class SerenaWorkerClient {
|
|
|
272
272
|
return new Promise((resolve, reject) => {
|
|
273
273
|
const timer = setTimeout(() => {
|
|
274
274
|
this.pending.delete(id);
|
|
275
|
-
|
|
275
|
+
// Kill and reset worker so subsequent requests don't pile up.
|
|
276
|
+
// The next request() call triggers ensureStarted() which spawns a fresh worker.
|
|
277
|
+
this.killAndReset();
|
|
278
|
+
reject(new Error(
|
|
279
|
+
`Serena worker request timed out: ${payload.action ?? "unknown"}. ` +
|
|
280
|
+
`Worker has been restarted; retry if needed.`
|
|
281
|
+
));
|
|
276
282
|
}, timeoutMs);
|
|
277
283
|
this.pending.set(id, { resolve, reject, timer });
|
|
278
284
|
this.process!.stdin.write(`${JSON.stringify(request)}\n`);
|
|
@@ -353,6 +359,16 @@ export class SerenaWorkerClient {
|
|
|
353
359
|
}
|
|
354
360
|
}
|
|
355
361
|
|
|
362
|
+
private killAndReset(): void {
|
|
363
|
+
if (this.process) {
|
|
364
|
+
this.process.kill();
|
|
365
|
+
this.process = undefined;
|
|
366
|
+
this.onStatus?.(undefined);
|
|
367
|
+
}
|
|
368
|
+
this.failAll(new Error("Serena worker killed due to timeout, restarted"));
|
|
369
|
+
this.buffer = "";
|
|
370
|
+
}
|
|
371
|
+
|
|
356
372
|
private failAll(error: Error): void {
|
|
357
373
|
for (const [id, pending] of this.pending) {
|
|
358
374
|
clearTimeout(pending.timer);
|