@dssp/supervision 1.0.23 → 1.0.25

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.
@@ -1,4 +1,4 @@
1
- import { __decorate, __metadata } from "tslib";
1
+ import { __decorate, __metadata, __rest } from "tslib";
2
2
  /**
3
3
  * 검측 관리 상세 - AI 자동 검측 (동영상 세트 + 측정 모델 2종)
4
4
  *
@@ -843,10 +843,25 @@ let BuildingInspectionAiMeasurement = class BuildingInspectionAiMeasurement exte
843
843
  headers: { Authorization: ENGINE_AUTH },
844
844
  body: form
845
845
  });
846
- const raw = await response.json();
846
+ // 러너/프록시가 에러를 낼 때는 JSON 이 아닐 수 있다(502 HTML 등) — 본문을 그대로 보여준다
847
+ const text = await response.text();
848
+ let raw;
849
+ try {
850
+ raw = JSON.parse(text);
851
+ }
852
+ catch (_a) {
853
+ throw new Error(`AI 엔진 응답 오류 (HTTP ${response.status}) ${text.slice(0, 200)}`);
854
+ }
847
855
  const data = (raw === null || raw === void 0 ? void 0 : raw.result) || {};
848
856
  if ((data === null || data === void 0 ? void 0 : data.status) !== 'success') {
849
- throw new Error((data === null || data === void 0 ? void 0 : data.error) || (raw === null || raw === void 0 ? void 0 : raw.error) || 'AI 엔진 호출에 실패했습니다.');
857
+ // raw.detail: 러너가 요청을 거부한 사유(예: 파일/필드 크기 초과)
858
+ // raw.stderr: 모듈이 죽은 경우의 파이썬 트레이스백 — 원인이 여기 있다
859
+ const stderr = ((raw === null || raw === void 0 ? void 0 : raw.stderr) || '').trim().split('\n').slice(-3).join(' ');
860
+ throw new Error((data === null || data === void 0 ? void 0 : data.error) ||
861
+ (raw === null || raw === void 0 ? void 0 : raw.error) ||
862
+ (raw === null || raw === void 0 ? void 0 : raw.detail) ||
863
+ stderr ||
864
+ `AI 엔진 호출에 실패했습니다. (HTTP ${response.status})`);
850
865
  }
851
866
  return data.result;
852
867
  }
@@ -1464,14 +1479,26 @@ let BuildingInspectionAiMeasurement = class BuildingInspectionAiMeasurement exte
1464
1479
  try {
1465
1480
  this.loading = true;
1466
1481
  this.loadingText = '판정 확정 중...';
1467
- // 측정 서버 응답을 가공 없이 그대로 전달 — 품질 게이트/hold 승격은 엔진이 처리한다
1482
+ // 측정값·판정 근거는 그대로 전달한다 — 품질 게이트/hold 승격은 엔진이 처리한다.
1483
+ // 다만 근거 이미지(base64)는 빼고 보낸다: 엔진은 이 값을 판정에 쓰지 않고 그대로
1484
+ // 되돌려줄 뿐인데(engine.apply_measurement), 러너의 multipart 단일 필드 한도가
1485
+ // 1MB 라서 실어 보내면 400 "Part exceeded maximum size of 1024KB" 가 난다.
1486
+ // 화면 표시·첨부에 쓰는 값이므로 판정 결과에 다시 붙여 준다.
1487
+ const _b = this.measureResult, { image_data, image, map_png, overlay_b64, result_image } = _b, slimResult = __rest(_b, ["image_data", "image", "map_png", "overlay_b64", "result_image"]);
1468
1488
  const result = await this._callEngine({
1469
1489
  action: 'apply-measurement',
1470
1490
  item: { item_id: item.item_id, text: item.text, category: item.category },
1471
1491
  model_id: ((_a = item.measure) === null || _a === void 0 ? void 0 : _a.model_id) || this.measureResult.model_id,
1472
- result: this.measureResult
1492
+ result: slimResult
1473
1493
  });
1474
- const judged = Object.assign(Object.assign({}, item), result.item);
1494
+ const judged = Object.assign(Object.assign(Object.assign({}, item), result.item), (image_data ? { image_data } : {}));
1495
+ // 측정 서버가 retake 를 내면 재촬영이다 — 측정 길이가 부재 치수보다 길게 나온 경우로,
1496
+ // 시공 불량이 아니라 측정 오류다. 검측 엔진은 이 값을 모르고 '부적합'으로 판정하므로
1497
+ // (engine.py 는 없어진 unreliable 을 본다) 여기서 되돌린다. 서버 판정을 그대로 쓰는 것.
1498
+ if (this.measureResult.retake) {
1499
+ judged.verdict = 'hold';
1500
+ judged.reason = this.measureResult.summary || '측정 길이가 부재 치수보다 길게 나왔습니다. 다시 촬영해 주세요.';
1501
+ }
1475
1502
  this._mergeItems([judged]);
1476
1503
  // 확정 즉시 체크리스트에 기록한다. 「검사 등록」까지 미루면 그 사이에 화면을 벗어나거나
1477
1504
  // 재판정이 일어났을 때 측정 판정만 유실된다 (VLM 항목은 inspect 결과에 남아 있어 티가 안 남).
@@ -1480,7 +1507,9 @@ let BuildingInspectionAiMeasurement = class BuildingInspectionAiMeasurement exte
1480
1507
  this.panel = 'none';
1481
1508
  this.selectedItem = null;
1482
1509
  if (judged.verdict === 'hold') {
1483
- notify({ message: '측정 품질이 기준에 못 미쳐 보류되었습니다. 재촬영을 권장합니다.', level: 'warn' });
1510
+ // 재촬영 사유는 측정 서버가 낸 문장을 그대로 쓴다 — 플랫폼이 촬영 품질을 근거로
1511
+ // 재촬영을 권하지 않는다(2026-09-12-2 전달본 정책).
1512
+ notify({ message: judged.reason || '재촬영이 필요합니다.', level: 'warn' });
1484
1513
  }
1485
1514
  else {
1486
1515
  notify({ message: `판정이 확정되었습니다: ${this._verdictLabel(judged)}` });