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.
@@ -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
- Object.defineProperty(startupError, "workerHandle", { value: handle, enumerable: false });
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
- await this.stop(handle, "initial worker input failed");
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
  }