@resolveio/server-lib 22.3.208 → 22.3.210

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.208",
3
+ "version": "22.3.210",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "package": "./build_package.sh",
@@ -104,10 +104,73 @@ function isoNow(value) {
104
104
  }
105
105
  function cleanText(value, max) {
106
106
  if (max === void 0) { max = 2000; }
107
+ if (value === undefined || value === null) {
108
+ return '';
109
+ }
110
+ if (Array.isArray(value)) {
111
+ return value
112
+ .map(function (entry) { return cleanListEntryText(entry, max); })
113
+ .filter(Boolean)
114
+ .join(' ')
115
+ .replace(/\s+/g, ' ')
116
+ .trim()
117
+ .slice(0, max);
118
+ }
119
+ if (typeof value === 'object') {
120
+ if (value instanceof Date) {
121
+ return value.toISOString().slice(0, max);
122
+ }
123
+ return '';
124
+ }
107
125
  return String(value || '').replace(/\s+/g, ' ').trim().slice(0, max);
108
126
  }
109
- function cleanList(values, limit, max) {
127
+ function cleanListEntryText(value, max) {
110
128
  var e_1, _a;
129
+ if (max === void 0) { max = 500; }
130
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
131
+ var source = value;
132
+ try {
133
+ for (var _b = __values([
134
+ 'path',
135
+ 'file',
136
+ 'filePath',
137
+ 'file_path',
138
+ 'ownerFile',
139
+ 'owner_file',
140
+ 'targetFile',
141
+ 'target_file',
142
+ 'sourceFile',
143
+ 'source_file',
144
+ 'artifactPath',
145
+ 'artifact_path',
146
+ 'summary',
147
+ 'message',
148
+ 'description',
149
+ 'reason',
150
+ 'value',
151
+ 'label',
152
+ 'id'
153
+ ]), _c = _b.next(); !_c.done; _c = _b.next()) {
154
+ var field = _c.value;
155
+ var candidate = cleanListEntryText(source[field], max);
156
+ if (candidate) {
157
+ return candidate;
158
+ }
159
+ }
160
+ }
161
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
162
+ finally {
163
+ try {
164
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
165
+ }
166
+ finally { if (e_1) throw e_1.error; }
167
+ }
168
+ return '';
169
+ }
170
+ return cleanText(value, max);
171
+ }
172
+ function cleanList(values, limit, max) {
173
+ var e_2, _a;
111
174
  if (limit === void 0) { limit = 20; }
112
175
  if (max === void 0) { max = 500; }
113
176
  if (!Array.isArray(values)) {
@@ -117,7 +180,7 @@ function cleanList(values, limit, max) {
117
180
  try {
118
181
  for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
119
182
  var value = values_1_1.value;
120
- var normalized = cleanText(value, max);
183
+ var normalized = cleanListEntryText(value, max);
121
184
  if (normalized && !result.includes(normalized)) {
122
185
  result.push(normalized);
123
186
  }
@@ -126,12 +189,12 @@ function cleanList(values, limit, max) {
126
189
  }
127
190
  }
128
191
  }
129
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
192
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
130
193
  finally {
131
194
  try {
132
195
  if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
133
196
  }
134
- finally { if (e_1) throw e_1.error; }
197
+ finally { if (e_2) throw e_2.error; }
135
198
  }
136
199
  return result;
137
200
  }
@@ -816,7 +879,7 @@ function evaluateResolveIOSupportPreflightGate(input, nowValue) {
816
879
  };
817
880
  }
818
881
  function pickText(source, fields, max) {
819
- var e_2, _a;
882
+ var e_3, _a;
820
883
  if (max === void 0) { max = 1000; }
821
884
  try {
822
885
  for (var fields_1 = __values(fields), fields_1_1 = fields_1.next(); !fields_1_1.done; fields_1_1 = fields_1.next()) {
@@ -827,12 +890,12 @@ function pickText(source, fields, max) {
827
890
  }
828
891
  }
829
892
  }
830
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
893
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
831
894
  finally {
832
895
  try {
833
896
  if (fields_1_1 && !fields_1_1.done && (_a = fields_1.return)) _a.call(fields_1);
834
897
  }
835
- finally { if (e_2) throw e_2.error; }
898
+ finally { if (e_3) throw e_3.error; }
836
899
  }
837
900
  return '';
838
901
  }
@@ -1045,7 +1108,7 @@ function normalizeResolveIOSupportSimilarCaseCandidate(value) {
1045
1108
  return candidate;
1046
1109
  }
1047
1110
  function selectResolveIOSupportSimilarCaseHints(input) {
1048
- var e_3, _a;
1111
+ var e_4, _a;
1049
1112
  if (input === void 0) { input = {}; }
1050
1113
  var issueClass = normalizeIssueClass(input.issueClass);
1051
1114
  var ownerFiles = cleanList(input.ownerFiles, 12, 300).map(normalizeOwnerFilePath).filter(Boolean);
@@ -1117,12 +1180,12 @@ function selectResolveIOSupportSimilarCaseHints(input) {
1117
1180
  });
1118
1181
  }
1119
1182
  }
1120
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
1183
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
1121
1184
  finally {
1122
1185
  try {
1123
1186
  if (normalized_1_1 && !normalized_1_1.done && (_a = normalized_1.return)) _a.call(normalized_1);
1124
1187
  }
1125
- finally { if (e_3) throw e_3.error; }
1188
+ finally { if (e_4) throw e_4.error; }
1126
1189
  }
1127
1190
  var sorted = ranked
1128
1191
  .sort(function (a, b) { return b.score - a.score || String(b.ticketNumber || b.commitSha || '').localeCompare(String(a.ticketNumber || a.commitSha || '')); })
@@ -1376,7 +1439,7 @@ function normalizeSupportDiagnosisBusinessProofContract(value, issueClassHint) {
1376
1439
  };
1377
1440
  }
1378
1441
  function normalizeOwnerFilePath(value) {
1379
- return cleanText(value, 500)
1442
+ return cleanListEntryText(value, 500)
1380
1443
  .replace(/\\/g, '/')
1381
1444
  .replace(/^\.\/+/, '')
1382
1445
  .replace(/^\/+/, '')
@@ -1387,7 +1450,7 @@ function isResolveIOSupportGeneratedAngularWrapperPath(value) {
1387
1450
  return /(?:^|\/)angular\/app\/(?:methods|publications)\.ts$/i.test(normalized);
1388
1451
  }
1389
1452
  function ownerFileComparablePathKeys(value) {
1390
- var e_4, _a;
1453
+ var e_5, _a;
1391
1454
  var normalized = normalizeOwnerFilePath(value);
1392
1455
  if (!normalized) {
1393
1456
  return [];
@@ -1409,12 +1472,12 @@ function ownerFileComparablePathKeys(value) {
1409
1472
  }
1410
1473
  }
1411
1474
  }
1412
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
1475
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
1413
1476
  finally {
1414
1477
  try {
1415
1478
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1416
1479
  }
1417
- finally { if (e_4) throw e_4.error; }
1480
+ finally { if (e_5) throw e_5.error; }
1418
1481
  }
1419
1482
  return Array.from(keys);
1420
1483
  }
@@ -1814,7 +1877,7 @@ function normalizeResolveIOSupportDiagnosisGate(value, now) {
1814
1877
  return gate;
1815
1878
  }
1816
1879
  function extractResolveIOSupportDiagnosisGateFromText(value, now) {
1817
- var e_5, _a;
1880
+ var e_6, _a;
1818
1881
  var text = String(value || '').trim();
1819
1882
  if (!text) {
1820
1883
  return undefined;
@@ -1842,12 +1905,12 @@ function extractResolveIOSupportDiagnosisGateFromText(value, now) {
1842
1905
  }
1843
1906
  }
1844
1907
  }
1845
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
1908
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
1846
1909
  finally {
1847
1910
  try {
1848
1911
  if (candidates_1_1 && !candidates_1_1.done && (_a = candidates_1.return)) _a.call(candidates_1);
1849
1912
  }
1850
- finally { if (e_5) throw e_5.error; }
1913
+ finally { if (e_6) throw e_6.error; }
1851
1914
  }
1852
1915
  return undefined;
1853
1916
  }
@@ -2010,7 +2073,7 @@ function supportStatusLooksPassed(value) {
2010
2073
  return /\b(pass|passed|success|succeeded|complete|completed|ready|not_required|not required)\b/i.test(cleanText(value, 200));
2011
2074
  }
2012
2075
  function nestedObject(source) {
2013
- var e_6, _a;
2076
+ var e_7, _a;
2014
2077
  var keys = [];
2015
2078
  for (var _i = 1; _i < arguments.length; _i++) {
2016
2079
  keys[_i - 1] = arguments[_i];
@@ -2024,17 +2087,17 @@ function nestedObject(source) {
2024
2087
  }
2025
2088
  }
2026
2089
  }
2027
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
2090
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
2028
2091
  finally {
2029
2092
  try {
2030
2093
  if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
2031
2094
  }
2032
- finally { if (e_6) throw e_6.error; }
2095
+ finally { if (e_7) throw e_7.error; }
2033
2096
  }
2034
2097
  return {};
2035
2098
  }
2036
2099
  function resolveSupportReplyReleaseGate(input) {
2037
- var e_7, _a;
2100
+ var e_8, _a;
2038
2101
  var _b;
2039
2102
  var releaseEvidence = cleanObject(input.releaseEvidence);
2040
2103
  var releaseStatus = cleanText(input.releaseStatus
@@ -2105,12 +2168,12 @@ function resolveSupportReplyReleaseGate(input) {
2105
2168
  blockers.push("missing_".concat(field));
2106
2169
  }
2107
2170
  }
2108
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
2171
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
2109
2172
  finally {
2110
2173
  try {
2111
2174
  if (missingCommitProofFields_1_1 && !missingCommitProofFields_1_1.done && (_a = missingCommitProofFields_1.return)) _a.call(missingCommitProofFields_1);
2112
2175
  }
2113
- finally { if (e_7) throw e_7.error; }
2176
+ finally { if (e_8) throw e_8.error; }
2114
2177
  }
2115
2178
  var shouldEvaluateHotfix = statusBlocked || commitProofRequired || Object.keys(hotfixEvidence).length > 0;
2116
2179
  var hotfixContinuation = shouldEvaluateHotfix
@@ -2156,7 +2219,7 @@ function supportBusinessAssertionRouteOnly(value) {
2156
2219
  return /^(route_probe_pass|route_only_pass|route_pass|route_probe|route_loaded)$/i.test(cleanText(value, 80));
2157
2220
  }
2158
2221
  function normalizeSupportBusinessProofAssertions(input) {
2159
- var e_8, _a;
2222
+ var e_9, _a;
2160
2223
  var gate = normalizeResolveIOSupportDiagnosisGate(input.diagnosisGate);
2161
2224
  var proofPlan = gate === null || gate === void 0 ? void 0 : gate.proof_plan;
2162
2225
  var proofContract = proofPlan === null || proofPlan === void 0 ? void 0 : proofPlan.business_proof_contract;
@@ -2190,12 +2253,12 @@ function normalizeSupportBusinessProofAssertions(input) {
2190
2253
  });
2191
2254
  }
2192
2255
  }
2193
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
2256
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
2194
2257
  finally {
2195
2258
  try {
2196
2259
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2197
2260
  }
2198
- finally { if (e_8) throw e_8.error; }
2261
+ finally { if (e_9) throw e_9.error; }
2199
2262
  }
2200
2263
  var status = cleanText(input.businessAssertionStatus || input.outcomeLabel, 80);
2201
2264
  if (!assertions.length && (supportBusinessAssertionPassed(status) || supportBusinessAssertionRouteOnly(status) || supportBusinessAssertionFailed(status))) {
@@ -2285,7 +2348,7 @@ function supportBusinessProofAssertionHasStructuredContractMapping(assertion, ga
2285
2348
  return routeMatches && actionMatches && expectedStateMatches && hasBusinessDataProof;
2286
2349
  }
2287
2350
  function supportBusinessProofAssertionMatchesContract(assertion, gate) {
2288
- var e_9, _a;
2351
+ var e_10, _a;
2289
2352
  if (!gate) {
2290
2353
  return false;
2291
2354
  }
@@ -2325,12 +2388,12 @@ function supportBusinessProofAssertionMatchesContract(assertion, gate) {
2325
2388
  }
2326
2389
  }
2327
2390
  }
2328
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
2391
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
2329
2392
  finally {
2330
2393
  try {
2331
2394
  if (proofWords_1_1 && !proofWords_1_1.done && (_a = proofWords_1.return)) _a.call(proofWords_1);
2332
2395
  }
2333
- finally { if (e_9) throw e_9.error; }
2396
+ finally { if (e_10) throw e_10.error; }
2334
2397
  }
2335
2398
  return overlap >= Math.min(5, Math.max(3, Math.ceil(proofWords.size * 0.45)));
2336
2399
  }
@@ -3855,7 +3918,7 @@ function supportManagerRequiredResetEvidenceForContract(contract) {
3855
3918
  ], false))).slice(0, 16);
3856
3919
  }
3857
3920
  function validateResolveIOSupportNextActionContract(value) {
3858
- var e_10, _a;
3921
+ var e_11, _a;
3859
3922
  var _b, _c, _d, _e, _f;
3860
3923
  var contract = cleanObject(value);
3861
3924
  var blockers = [];
@@ -3877,12 +3940,12 @@ function validateResolveIOSupportNextActionContract(value) {
3877
3940
  }
3878
3941
  }
3879
3942
  }
3880
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
3943
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
3881
3944
  finally {
3882
3945
  try {
3883
3946
  if (requiredStringFields_1_1 && !requiredStringFields_1_1.done && (_a = requiredStringFields_1.return)) _a.call(requiredStringFields_1);
3884
3947
  }
3885
- finally { if (e_10) throw e_10.error; }
3948
+ finally { if (e_11) throw e_11.error; }
3886
3949
  }
3887
3950
  if (!Array.isArray(contract.nextCommands) || !contract.nextCommands.length) {
3888
3951
  blockers.push('NextActionContract.nextCommands must include at least the primary command.');
@@ -4901,7 +4964,7 @@ function buildResolveIOSupportV5ScopeDigest(input) {
4901
4964
  return raw.slice(0, maxChars);
4902
4965
  }
4903
4966
  function buildResolveIOSupportV5MicrotaskLedger(input) {
4904
- var e_11, _a;
4967
+ var e_12, _a;
4905
4968
  var existing = Array.isArray(input.existing) ? input.existing : [];
4906
4969
  var completedByObjective = new Map();
4907
4970
  try {
@@ -4912,12 +4975,12 @@ function buildResolveIOSupportV5MicrotaskLedger(input) {
4912
4975
  }
4913
4976
  }
4914
4977
  }
4915
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
4978
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
4916
4979
  finally {
4917
4980
  try {
4918
4981
  if (existing_1_1 && !existing_1_1.done && (_a = existing_1.return)) _a.call(existing_1);
4919
4982
  }
4920
- finally { if (e_11) throw e_11.error; }
4983
+ finally { if (e_12) throw e_12.error; }
4921
4984
  }
4922
4985
  var now = isoNow(input.now);
4923
4986
  var requirements = cleanList(input.requirements, 30, 240);
@@ -6708,7 +6771,7 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
6708
6771
  };
6709
6772
  }
6710
6773
  function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
6711
- var e_12, _a, e_13, _b;
6774
+ var e_13, _a, e_14, _b;
6712
6775
  var byMicrotask = new Map();
6713
6776
  var bySection = new Map();
6714
6777
  var totalPromptTokenEstimate = 0;
@@ -6723,17 +6786,17 @@ function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
6723
6786
  existing.calls += 1;
6724
6787
  byMicrotask.set(usage.microtaskId, existing);
6725
6788
  try {
6726
- for (var _e = (e_13 = void 0, __values(usage.promptSections || [])), _f = _e.next(); !_f.done; _f = _e.next()) {
6789
+ for (var _e = (e_14 = void 0, __values(usage.promptSections || [])), _f = _e.next(); !_f.done; _f = _e.next()) {
6727
6790
  var section = _f.value;
6728
6791
  bySection.set(section.name, (bySection.get(section.name) || 0) + section.tokenEstimate);
6729
6792
  }
6730
6793
  }
6731
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
6794
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
6732
6795
  finally {
6733
6796
  try {
6734
6797
  if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
6735
6798
  }
6736
- finally { if (e_13) throw e_13.error; }
6799
+ finally { if (e_14) throw e_14.error; }
6737
6800
  }
6738
6801
  var hardCap = usage.lane === 'qa' ? promptBudget.qaMicrotaskHardCap : promptBudget.buildMicrotaskHardCap;
6739
6802
  if ((usage.promptTokenEstimate || 0) > hardCap) {
@@ -6741,12 +6804,12 @@ function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
6741
6804
  }
6742
6805
  }
6743
6806
  }
6744
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
6807
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
6745
6808
  finally {
6746
6809
  try {
6747
6810
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
6748
6811
  }
6749
- finally { if (e_12) throw e_12.error; }
6812
+ finally { if (e_13) throw e_13.error; }
6750
6813
  }
6751
6814
  return {
6752
6815
  totalPromptTokenEstimate: totalPromptTokenEstimate,