@kody-ade/kody-engine 0.1.5 → 0.1.6

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/dist/bin/cli.mjs CHANGED
@@ -8193,7 +8193,12 @@ async function executeSingleStep(ctx, pipeline, state, stageName) {
8193
8193
  }
8194
8194
  }
8195
8195
  const errorMessage = `${stageName} ${result.outcome === "timed_out" ? "timed out" : "failed"}: ${result.reason || "unknown"}`;
8196
- throw new Error(errorMessage);
8196
+ throw new StageError(
8197
+ errorMessage,
8198
+ stageName,
8199
+ void 0,
8200
+ result.sessionId
8201
+ );
8197
8202
  }
8198
8203
  return await handleStageResult(
8199
8204
  ctx,
@@ -8212,14 +8217,16 @@ async function executeSingleStep(ctx, pipeline, state, stageName) {
8212
8217
  const errorMessage = error instanceof Error ? error.message : String(error);
8213
8218
  logger.error({ err: error }, ` \u274C ${stageName} failed:`);
8214
8219
  logStageFail(stageName, ctx.taskId, errorMessage);
8215
- const canObserve = ctx.serverUrl && ctx.lastSessionId && !ctx.input.dryRun;
8220
+ const stageSessionId = error instanceof StageError ? error.sessionId : void 0;
8221
+ const effectiveSessionId = stageSessionId || ctx.lastSessionId;
8222
+ const canObserve = ctx.serverUrl && effectiveSessionId && !ctx.input.dryRun;
8216
8223
  if (canObserve && !def.advisory) {
8217
8224
  try {
8218
8225
  const observer = new PipelineObserver(
8219
8226
  ctx.taskId,
8220
8227
  ctx.taskDir,
8221
8228
  ctx.serverUrl,
8222
- ctx.lastSessionId,
8229
+ effectiveSessionId,
8223
8230
  ctx.taskDir
8224
8231
  // dataDir is taskDir/opencode-data derived in Observer
8225
8232
  );
@@ -8597,11 +8604,13 @@ var init_state_machine = __esm({
8597
8604
  StageError = class extends Error {
8598
8605
  stageName;
8599
8606
  cause;
8600
- constructor(message, stageName, cause) {
8607
+ sessionId;
8608
+ constructor(message, stageName, cause, sessionId) {
8601
8609
  super(message);
8602
8610
  this.name = "StageError";
8603
8611
  this.stageName = stageName;
8604
8612
  this.cause = cause;
8613
+ this.sessionId = sessionId;
8605
8614
  }
8606
8615
  };
8607
8616
  }