pi-claude-supervisor 0.2.1 → 0.3.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/CHANGELOG.md +16 -1
- package/README.cn.md +33 -0
- package/README.md +42 -0
- package/docs/architecture.md +38 -0
- package/docs/testing.md +16 -0
- package/package.json +1 -1
- package/src/config.ts +3 -1
- package/src/decision-session-store.ts +38 -8
- package/src/decision-worker.ts +51 -15
- package/src/events.ts +2 -16
- package/src/index.ts +52 -27
- package/src/notifications.ts +15 -16
- package/src/redaction.ts +20 -0
- package/src/supervisor.ts +156 -16
- package/src/types.ts +16 -1
- package/src/worker/process-adapter.ts +15 -2
- package/src/worker/tmux-adapter.ts +1017 -0
|
@@ -192,7 +192,11 @@ export class ProcessWorkerAdapter implements WorkerAdapter {
|
|
|
192
192
|
} catch (error) {
|
|
193
193
|
try { await this.#ensureGroupCleanup(record); } catch (cleanupError) { record.cleanupError = cleanupError instanceof Error ? cleanupError : new Error(String(cleanupError)); }
|
|
194
194
|
const startupError = error instanceof Error ? error : new Error(String(error));
|
|
195
|
-
|
|
195
|
+
if (record.cleanupError) {
|
|
196
|
+
startupError.message = `${startupError.message}; startup cleanup failed: ${record.cleanupError.message}`;
|
|
197
|
+
Object.defineProperty(startupError, "workerHandle", { value: handle, enumerable: false });
|
|
198
|
+
Object.defineProperty(startupError, "workerCleanupRequired", { value: true, enumerable: false });
|
|
199
|
+
}
|
|
196
200
|
throw startupError;
|
|
197
201
|
}
|
|
198
202
|
if (input.task) {
|
|
@@ -200,7 +204,16 @@ export class ProcessWorkerAdapter implements WorkerAdapter {
|
|
|
200
204
|
try {
|
|
201
205
|
await this.#writeInput(record, this.#encodeMessage(input.task));
|
|
202
206
|
} catch (error) {
|
|
203
|
-
|
|
207
|
+
let cleanupError: unknown;
|
|
208
|
+
try { await this.stop(handle, "initial worker input failed"); }
|
|
209
|
+
catch (stopError) { cleanupError = stopError; }
|
|
210
|
+
if (cleanupError) {
|
|
211
|
+
const startupError = error instanceof Error ? error : new Error(String(error));
|
|
212
|
+
startupError.message = `${startupError.message}; startup cleanup failed: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`;
|
|
213
|
+
Object.defineProperty(startupError, "workerHandle", { value: handle, enumerable: false });
|
|
214
|
+
Object.defineProperty(startupError, "workerCleanupRequired", { value: true, enumerable: false });
|
|
215
|
+
throw startupError;
|
|
216
|
+
}
|
|
204
217
|
throw error;
|
|
205
218
|
}
|
|
206
219
|
}
|