e2e-agent-runner 1.5.5 → 1.5.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/api.mjs CHANGED
@@ -37,7 +37,9 @@ export class ApiError extends Error {
37
37
  }
38
38
  }
39
39
 
40
- /** POST 래퍼 — 네트워크 오류·5xx 만 2회 재시도(4xx 는 즉시 throw). 재시도 전 백오프. */
40
+ /** POST 래퍼 — 네트워크 오류·5xx 만 2회 재시도(4xx 는 즉시 throw). 재시도 전 백오프.
41
+ * 30s 타임아웃 — 응답이 느리게 흐르는 서버 장애에서 폴 1회(재시도 포함)가 수 분씩
42
+ * 묶이며 heartbeat·이벤트 flush까지 함께 멈추지 않게 한다. */
41
43
  export async function api(path, body = {}, { retries = 2 } = {}) {
42
44
  let lastErr;
43
45
  for (let attempt = 0; attempt <= retries; attempt++) {
@@ -47,6 +49,7 @@ export async function api(path, body = {}, { retries = 2 } = {}) {
47
49
  method: 'POST',
48
50
  headers: headers(),
49
51
  body: JSON.stringify(body),
52
+ signal: AbortSignal.timeout(30_000),
50
53
  });
51
54
  const text = await res.text();
52
55
  const data = text ? JSON.parse(text) : {};
package/discover.mjs CHANGED
@@ -155,6 +155,9 @@ function fallbackFromText(text) {
155
155
  || v.items.some((x) => x && typeof x === 'object' && (x.stage != null || x.acceptance != null));
156
156
  return isProposal ? { proposal: v } : { plan: v };
157
157
  }
158
+ // map.json — 서비스 요약(service_name)·커버리지 필드로 식별(routes 배열을 함께 품은
159
+ // 경우 위 routes 분기가 먼저 잡으므로 여기는 요약만 있는 형태다).
160
+ if (v && typeof v === 'object' && (v.service_name != null || v.coverage != null)) return { map: v };
158
161
  } catch {
159
162
  /* 다음 블록 */
160
163
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "e2e-agent-runner",
3
- "version": "1.5.5",
3
+ "version": "1.5.6",
4
4
  "description": "suseona e2e 작업 에이전트 로컬 러너 — 내 컴퓨터의 Claude Code 로 구현→테스트→리뷰→배포와 웹사이트 기능 지도 추출·QA·개선 사이클을 자동 수행",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
package/runner.mjs CHANGED
@@ -223,7 +223,9 @@ async function handleStep({ step, task, project }) {
223
223
  await api('/ai/e2e/agent/runner/step_result', {
224
224
  step_id: step.id, status: 'fail', error: String(e.message).slice(0, 500),
225
225
  cancelled: cancelled(),
226
- }).catch(() => {});
226
+ }).catch((err) => {
227
+ if (authDead(err)) warnAuthDead();
228
+ });
227
229
  } finally {
228
230
  await buf.stop();
229
231
  state.currentTaskId = null;
@@ -543,10 +545,23 @@ async function heartbeat() {
543
545
  });
544
546
  mergeCancels(res);
545
547
  } catch (e) {
546
- log(`heartbeat 실패: ${e.message}`);
548
+ if (authDead(e)) warnAuthDead();
549
+ else log(`heartbeat 실패: ${e.message}`);
547
550
  }
548
551
  }
549
552
 
553
+ /** 토큰 폐기(401) 안내 — 1회만. idle 폴의 401 → exit(1)이 실제 종료를 담당하고,
554
+ * 단계 실행 중에는 진행 중 작업을 지키기 위해 종료를 미룬다(종결 후 다음 폴에서 즉시 exit). */
555
+ function authDead(e) {
556
+ return Boolean(e && e.status === 401);
557
+ }
558
+ let authDeadLogged = false;
559
+ function warnAuthDead() {
560
+ if (authDeadLogged) return;
561
+ authDeadLogged = true;
562
+ console.error('머신 토큰이 거부되었습니다(폐기) — 웹에서 머신을 재등록하고 E2E_RUNNER_TOKEN 을 갱신하세요. 진행 중 단계 마치면 러너를 종료합니다.');
563
+ }
564
+
550
565
  async function main() {
551
566
  const token = (process.env.E2E_RUNNER_TOKEN || '').trim();
552
567
  if (!token) {
@@ -595,8 +610,9 @@ async function main() {
595
610
  const res = await api('/ai/e2e/agent/runner/poll', { probe_only: true });
596
611
  mergeCancels(res);
597
612
  handleProbe(res);
598
- } catch {
599
- /* probe 폴링 실패는 무시 — 다음 주기 재시도 */
613
+ } catch (e) {
614
+ if (authDead(e)) warnAuthDead(); // 폐기 토큰 — 무음으로 삼키지 않는다(종료는 idle 폴 401 담당)
615
+ /* 그 외 probe 폴링 실패는 무시 — 다음 주기 재시도 */
600
616
  }
601
617
  }
602
618
  await sleep(POLL_S * 1000);