@resolveio/server-lib 22.3.190 → 22.3.191

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "22.3.190",
3
+ "version": "22.3.191",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "package": "./build_package.sh",
@@ -1637,6 +1637,8 @@ function supportCustomerReplyPolicyGate(policy, now) {
1637
1637
  var canSend = policy.canSendCustomerReply === true || policy.can_send_customer_reply === true;
1638
1638
  var reviewPacket = plainObject(policy.humanReviewPacket || policy.human_review_packet);
1639
1639
  var draftBasis = plainObject(policy.draftBasis || policy.draft_basis);
1640
+ var clarificationValidation = (0, support_runner_v5_1.validateResolveIOSupportClarificationContract)(policy.clarificationContract || policy.clarification_contract || {});
1641
+ var clarificationContract = clarificationValidation.normalized;
1640
1642
  var reviewType = cleanText(reviewPacket.reviewType || reviewPacket.review_type, 160);
1641
1643
  var evidenceRefs = cleanStringList(reviewPacket.evidenceRefs || reviewPacket.evidence_refs, 40, 500);
1642
1644
  var blockers = cleanStringList(policy.blockers || reviewPacket.blockers, 20, 500);
@@ -1645,13 +1647,14 @@ function supportCustomerReplyPolicyGate(policy, now) {
1645
1647
  : action === 'draft_resolution_reply' && canDraft
1646
1648
  ? 'warn'
1647
1649
  : action === 'ask_clarification' && canDraft
1648
- ? 'warn'
1650
+ ? (clarificationValidation.valid ? 'warn' : 'blocked')
1649
1651
  : 'blocked';
1652
+ var mergedBlockers = Array.from(new Set(__spreadArray(__spreadArray([], __read(blockers), false), __read((action === 'ask_clarification' ? clarificationValidation.blockers : [])), false)));
1650
1653
  return {
1651
1654
  key: 'support_customer_reply_policy',
1652
1655
  label: 'Support customer reply policy',
1653
1656
  status: gateStatus,
1654
- reason: reason || action || 'Support customer reply policy recorded.',
1657
+ reason: reason || mergedBlockers.join('; ') || action || 'Support customer reply policy recorded.',
1655
1658
  evidenceRefs: evidenceRefs,
1656
1659
  recordedAt: isoNow(now || policy.recordedAt || policy.recorded_at || reviewPacket.createdAt || reviewPacket.created_at),
1657
1660
  metadata: {
@@ -1667,7 +1670,11 @@ function supportCustomerReplyPolicyGate(policy, now) {
1667
1670
  primaryAction: cleanText(reviewPacket.primaryAction || reviewPacket.primary_action, 160),
1668
1671
  requiresHumanApproval: reviewPacket.requiresHumanApproval !== false && reviewPacket.requires_human_approval !== false,
1669
1672
  questionPresent: !!cleanText(policy.clarificationQuestion || policy.clarification_question || reviewPacket.question, 1000),
1670
- blockers: blockers
1673
+ clarificationContractStatus: cleanText(clarificationContract.status, 120),
1674
+ clarificationMissingField: cleanText(clarificationContract.missingField, 120),
1675
+ clarificationOneQuestionOnly: clarificationContract.oneQuestionOnly === true,
1676
+ clarificationParksTicket: clarificationContract.parksTicketUntilCustomerReply === true,
1677
+ blockers: mergedBlockers
1671
1678
  }
1672
1679
  };
1673
1680
  }
@@ -2918,7 +2925,7 @@ function applyAssistantAnswerQualityGate(qa, decision, now) {
2918
2925
  }
2919
2926
  function buildSupportAIRunFromEvidence(input) {
2920
2927
  var e_28, _a, e_29, _b;
2921
- var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36;
2928
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44;
2922
2929
  var ticket = input.ticket || {};
2923
2930
  var job = input.job || {};
2924
2931
  var evidence = buildSupportQaEvidence(input);
@@ -2930,8 +2937,8 @@ function buildSupportAIRunFromEvidence(input) {
2930
2937
  addSourceId(sourceIds, 'jobId', job._id || job.id || job.jobId);
2931
2938
  addSourceId(sourceIds, 'buildPlanId', job.buildPlanId || ticket.buildPlanId);
2932
2939
  try {
2933
- for (var _37 = __values(asArray(input.taskEvents)), _38 = _37.next(); !_38.done; _38 = _37.next()) {
2934
- var event_1 = _38.value;
2940
+ for (var _45 = __values(asArray(input.taskEvents)), _46 = _45.next(); !_46.done; _46 = _45.next()) {
2941
+ var event_1 = _46.value;
2935
2942
  pushEvent(events, {
2936
2943
  type: event_1.type === 'human_intervention' ? 'human_intervention' : 'log',
2937
2944
  category: cleanText(event_1.category || event_1.phase || event_1.type, 160),
@@ -2948,13 +2955,13 @@ function buildSupportAIRunFromEvidence(input) {
2948
2955
  catch (e_28_1) { e_28 = { error: e_28_1 }; }
2949
2956
  finally {
2950
2957
  try {
2951
- if (_38 && !_38.done && (_a = _37.return)) _a.call(_37);
2958
+ if (_46 && !_46.done && (_a = _45.return)) _a.call(_45);
2952
2959
  }
2953
2960
  finally { if (e_28) throw e_28.error; }
2954
2961
  }
2955
2962
  try {
2956
- for (var _39 = __values(asArray(input.aiJobs)), _40 = _39.next(); !_40.done; _40 = _39.next()) {
2957
- var aiJob = _40.value;
2963
+ for (var _47 = __values(asArray(input.aiJobs)), _48 = _47.next(); !_48.done; _48 = _47.next()) {
2964
+ var aiJob = _48.value;
2958
2965
  pushEvent(events, {
2959
2966
  type: aiJob.model ? 'model_call' : 'log',
2960
2967
  category: cleanText(aiJob.category || aiJob.phase || aiJob.runner, 160),
@@ -2972,7 +2979,7 @@ function buildSupportAIRunFromEvidence(input) {
2972
2979
  catch (e_29_1) { e_29 = { error: e_29_1 }; }
2973
2980
  finally {
2974
2981
  try {
2975
- if (_40 && !_40.done && (_b = _39.return)) _b.call(_39);
2982
+ if (_48 && !_48.done && (_b = _47.return)) _b.call(_47);
2976
2983
  }
2977
2984
  finally { if (e_29) throw e_29.error; }
2978
2985
  }
@@ -3255,7 +3262,13 @@ function buildSupportAIRunFromEvidence(input) {
3255
3262
  || ((_33 = customerReplyPolicy.human_review_packet) === null || _33 === void 0 ? void 0 : _33.reviewType), 160),
3256
3263
  primaryAction: cleanText(((_34 = customerReplyPolicy.humanReviewPacket) === null || _34 === void 0 ? void 0 : _34.primaryAction)
3257
3264
  || ((_35 = customerReplyPolicy.human_review_packet) === null || _35 === void 0 ? void 0 : _35.primary_action)
3258
- || ((_36 = customerReplyPolicy.human_review_packet) === null || _36 === void 0 ? void 0 : _36.primaryAction), 160)
3265
+ || ((_36 = customerReplyPolicy.human_review_packet) === null || _36 === void 0 ? void 0 : _36.primaryAction), 160),
3266
+ clarificationContract: customerReplyPolicy.clarificationContract || customerReplyPolicy.clarification_contract ? {
3267
+ status: cleanText(((_37 = customerReplyPolicy.clarificationContract) === null || _37 === void 0 ? void 0 : _37.status) || ((_38 = customerReplyPolicy.clarification_contract) === null || _38 === void 0 ? void 0 : _38.status), 120),
3268
+ missingField: cleanText(((_39 = customerReplyPolicy.clarificationContract) === null || _39 === void 0 ? void 0 : _39.missingField) || ((_40 = customerReplyPolicy.clarification_contract) === null || _40 === void 0 ? void 0 : _40.missing_field), 120),
3269
+ oneQuestionOnly: ((_41 = customerReplyPolicy.clarificationContract) === null || _41 === void 0 ? void 0 : _41.oneQuestionOnly) === true || ((_42 = customerReplyPolicy.clarification_contract) === null || _42 === void 0 ? void 0 : _42.one_question_only) === true,
3270
+ parksTicketUntilCustomerReply: ((_43 = customerReplyPolicy.clarificationContract) === null || _43 === void 0 ? void 0 : _43.parksTicketUntilCustomerReply) === true || ((_44 = customerReplyPolicy.clarification_contract) === null || _44 === void 0 ? void 0 : _44.parks_ticket_until_customer_reply) === true
3271
+ } : undefined
3259
3272
  } : undefined
3260
3273
  }
3261
3274
  });