@mergesignal/shared 0.11.0 → 0.12.1

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.
Files changed (55) hide show
  1. package/dist/assessmentProjection.d.ts.map +1 -1
  2. package/dist/assessmentProjection.js +11 -4
  3. package/dist/deriveScanNarrative.d.ts.map +1 -1
  4. package/dist/deriveScanNarrative.js +4 -0
  5. package/dist/fixtures/assessmentScopeFixtures.d.ts +5 -2
  6. package/dist/fixtures/assessmentScopeFixtures.d.ts.map +1 -1
  7. package/dist/fixtures/assessmentScopeFixtures.js +3 -1
  8. package/dist/formatInsight.d.ts +3 -3
  9. package/dist/formatInsight.d.ts.map +1 -1
  10. package/dist/formatInsight.js +0 -9
  11. package/dist/index.d.ts +0 -3
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +0 -3
  14. package/dist/prRiskBand.d.ts +7 -0
  15. package/dist/prRiskBand.d.ts.map +1 -1
  16. package/dist/prRiskBand.js +12 -0
  17. package/dist/prRiskBand.test.js +12 -1
  18. package/dist/presentation/abi3Expression.test.d.ts +13 -0
  19. package/dist/presentation/abi3Expression.test.d.ts.map +1 -0
  20. package/dist/presentation/abi3Expression.test.js +392 -0
  21. package/dist/presentation/cliParity.test.d.ts +2 -0
  22. package/dist/presentation/cliParity.test.d.ts.map +1 -0
  23. package/dist/presentation/cliParity.test.js +49 -0
  24. package/dist/presentation/compose/narrativeCompose.d.ts +0 -4
  25. package/dist/presentation/compose/narrativeCompose.d.ts.map +1 -1
  26. package/dist/presentation/compose/narrativeCompose.js +0 -20
  27. package/dist/presentation/dto/assessmentPresentationFields.d.ts +4 -0
  28. package/dist/presentation/dto/assessmentPresentationFields.d.ts.map +1 -1
  29. package/dist/presentation/index.d.ts +1 -1
  30. package/dist/presentation/index.d.ts.map +1 -1
  31. package/dist/presentation/index.js +1 -1
  32. package/dist/presentation/orchestration/buildScanPresentationBundle.d.ts +1 -0
  33. package/dist/presentation/orchestration/buildScanPresentationBundle.d.ts.map +1 -1
  34. package/dist/presentation/orchestration/buildScanPresentationBundle.js +1 -0
  35. package/dist/presentation/presenters/presentCliScanSummary.d.ts.map +1 -1
  36. package/dist/presentation/presenters/presentCliScanSummary.js +9 -7
  37. package/dist/presentation/presenters/presentGitHubCheckRun.d.ts.map +1 -1
  38. package/dist/presentation/presenters/presentGitHubCheckRun.js +20 -15
  39. package/dist/presentation/presenters/presentGitHubPrComment.d.ts.map +1 -1
  40. package/dist/presentation/presenters/presentGitHubPrComment.js +11 -7
  41. package/dist/presentation/presenters/presentScanDetails.d.ts.map +1 -1
  42. package/dist/presentation/presenters/presentScanDetails.js +8 -11
  43. package/dist/presentation/projectAssessmentFields.d.ts.map +1 -1
  44. package/dist/presentation/projectAssessmentFields.js +6 -0
  45. package/dist/presentation/surfaceParity.test.js +8 -0
  46. package/dist/scanResultSchema.d.ts +7 -0
  47. package/dist/scanResultSchema.d.ts.map +1 -1
  48. package/dist/scanResultSchema.test.js +2 -0
  49. package/package.json +1 -1
  50. package/dist/scanDetailViewModelTypes.d.ts +0 -159
  51. package/dist/scanDetailViewModelTypes.d.ts.map +0 -1
  52. package/dist/scanDetailViewModelTypes.js +0 -4
  53. package/dist/truncateCardSummary.d.ts +0 -5
  54. package/dist/truncateCardSummary.d.ts.map +0 -1
  55. package/dist/truncateCardSummary.js +0 -23
@@ -1,11 +1,11 @@
1
- import { scoreToBandLabel } from "../../prRiskBand.js";
2
- import { buildNarrativeChannels, composeHeadline, composeSubheadline, composeVerificationActions, evidenceContextFromProfile, projectCompactKeyPoints, } from "../compose/narrativeCompose.js";
1
+ import { formatPrRiskSummary } from "../../prRiskBand.js";
2
+ import { buildNarrativeChannels, composeSubheadline, evidenceContextFromProfile, projectCompactKeyPoints, } from "../compose/narrativeCompose.js";
3
3
  import { projectAssessmentFields } from "../projectAssessmentFields.js";
4
4
  export function presentGitHubCheckRun(bundle, ctx) {
5
- const { profile } = bundle;
6
- const headline = composeHeadline(bundle);
7
- const keyPoints = projectCompactKeyPoints(buildNarrativeChannels(bundle), 3);
8
- const actions = composeVerificationActions(bundle, 3);
5
+ const { facts, profile } = bundle;
6
+ const channels = buildNarrativeChannels(bundle);
7
+ const assessmentFields = projectAssessmentFields(bundle);
8
+ const actions = channels.verification.slice(0, 3);
9
9
  const detailsUrl = `${ctx.webAppOrigin.replace(/\/$/, "")}/scan/${ctx.scanId}`;
10
10
  const conclusion = profile.status === "safe"
11
11
  ? "success"
@@ -13,31 +13,36 @@ export function presentGitHubCheckRun(bundle, ctx) {
13
13
  ? "failure"
14
14
  : "neutral";
15
15
  const sections = [];
16
- const prRiskScore = bundle.facts.riskSignals?.riskIndex;
17
- const prRiskBandLabelText = scoreToBandLabel(prRiskScore);
18
- if (prRiskScore != null && prRiskBandLabelText) {
16
+ const prRisk = formatPrRiskSummary(facts);
17
+ if (prRisk) {
19
18
  sections.push({
20
19
  id: "why",
21
20
  title: "PR Risk",
22
- bullets: [`${prRiskScore} (${prRiskBandLabelText})`],
21
+ bullets: [`${prRisk.prRiskScore} (${prRisk.prRiskBandLabel})`],
23
22
  });
24
23
  }
25
- if (keyPoints.length > 0) {
26
- sections.push({ id: "why", title: "Why", bullets: keyPoints });
24
+ // Use assessment.reasoning directly for the Why section (ABI 3).
25
+ // Fall back to compact key points for pre-ABI-3 scan results.
26
+ const reasoningLines = assessmentFields.reasoning.slice(0, 3);
27
+ const whyBullets = reasoningLines.length > 0
28
+ ? reasoningLines
29
+ : projectCompactKeyPoints(channels, 3);
30
+ if (whyBullets.length > 0) {
31
+ sections.push({ id: "why", title: "Why", bullets: whyBullets });
27
32
  }
28
33
  if (actions.length > 0) {
29
34
  sections.push({ id: "actions", title: "What to verify", bullets: actions });
30
35
  }
31
36
  sections.push({ id: "footer", bullets: [`Full scan: ${detailsUrl}`] });
32
37
  return {
33
- ...projectAssessmentFields(bundle),
38
+ ...assessmentFields,
34
39
  status: profile.status,
35
40
  density: profile.density,
36
41
  confidence: profile.confidence,
37
42
  evidenceContext: evidenceContextFromProfile(bundle),
38
- title: headline,
43
+ title: channels.headline,
39
44
  conclusion,
40
- summaryLead: composeSubheadline(bundle) ?? headline,
45
+ summaryLead: composeSubheadline(bundle) ?? channels.headline,
41
46
  sections,
42
47
  detailsUrl,
43
48
  };
@@ -1 +1 @@
1
- {"version":3,"file":"presentGitHubPrComment.d.ts","sourceRoot":"","sources":["../../../src/presentation/presenters/presentGitHubPrComment.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAGzF,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,sBAAsB,GAC7B,2BAA2B,CAmC7B"}
1
+ {"version":3,"file":"presentGitHubPrComment.d.ts","sourceRoot":"","sources":["../../../src/presentation/presenters/presentGitHubPrComment.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAGzF,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,sBAAsB,GAC7B,2BAA2B,CAyC7B"}
@@ -1,5 +1,5 @@
1
1
  import { MERGE_POSTURE_LABEL } from "../../riskVocabulary.js";
2
- import { scoreToBandLabel } from "../../prRiskBand.js";
2
+ import { formatPrRiskSummary } from "../../prRiskBand.js";
3
3
  import { buildNarrativeChannels, evidenceContextFromProfile, } from "../compose/narrativeCompose.js";
4
4
  import { formatChangedPackagesShort } from "../../narrativePresentation.js";
5
5
  import { projectAssessmentFields } from "../projectAssessmentFields.js";
@@ -11,10 +11,12 @@ export function presentGitHubPrComment(bundle) {
11
11
  const changed = formatChangedPackagesShort(facts, 3);
12
12
  if (changed)
13
13
  introLines.push(`Changed: ${changed}`);
14
- const prRiskScore = bundle.facts.riskSignals?.riskIndex;
15
- const prRiskBandLabelText = scoreToBandLabel(prRiskScore);
16
- if (prRiskScore != null && prRiskBandLabelText) {
17
- introLines.push(`PR Risk: ${prRiskScore} (${prRiskBandLabelText})`);
14
+ const prRisk = formatPrRiskSummary(facts);
15
+ if (prRisk) {
16
+ introLines.push(`PR Risk: ${prRisk.prRiskScore} (${prRisk.prRiskBandLabel})`);
17
+ }
18
+ if (assessmentFields.electionSummary) {
19
+ introLines.push(assessmentFields.electionSummary);
18
20
  }
19
21
  for (const line of assessmentFields.reasoning.slice(0, 2)) {
20
22
  introLines.push(line);
@@ -22,8 +24,10 @@ export function presentGitHubPrComment(bundle) {
22
24
  const verify = channels.verification[0];
23
25
  if (verify)
24
26
  introLines.push(`Verify: ${verify}`);
25
- const guidanceBlocks = channels.verification.slice(0, 3).map((action) => ({
26
- message: assessmentFields.reasoning[0] ?? action,
27
+ const guidanceBlocks = channels.verification
28
+ .slice(0, 3)
29
+ .map((action, index) => ({
30
+ message: assessmentFields.reasoning[index] ?? action,
27
31
  where: changed ?? "See scan detail for affected paths.",
28
32
  action,
29
33
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"presentScanDetails.d.ts","sourceRoot":"","sources":["../../../src/presentation/presenters/presentScanDetails.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAGzF,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AA6FF,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,sBAAsB,EAC9B,GAAG,EAAE,yBAAyB,GAC7B,uBAAuB,CAiFzB"}
1
+ {"version":3,"file":"presentScanDetails.d.ts","sourceRoot":"","sources":["../../../src/presentation/presenters/presentScanDetails.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAGzF,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AA6FF,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,sBAAsB,EAC9B,GAAG,EAAE,yBAAyB,GAC7B,uBAAuB,CA6EzB"}
@@ -1,6 +1,6 @@
1
1
  import { MERGE_CONCERN_LABELS } from "../../assessmentLabels.js";
2
2
  import { normalizedPackageUsagePaths } from "../../narrativePresentation.js";
3
- import { prRiskBandLabel, prRiskBandToGaugeBand, scoreToBandLabel, } from "../../prRiskBand.js";
3
+ import { formatPrRiskSummary, prRiskBandToGaugeBand, } from "../../prRiskBand.js";
4
4
  import { MERGE_POSTURE_LABEL } from "../../riskVocabulary.js";
5
5
  import { buildNarrativeChannels, composeSubheadline, composeSupportingContext, evidenceContextFromProfile, projectCompactKeyPoints, } from "../compose/narrativeCompose.js";
6
6
  import { normalizeGeneratedText, normalizeGeneratedTextNullable, } from "../../normalizeGeneratedText.js";
@@ -79,7 +79,7 @@ function mapEvidence(bundle) {
79
79
  };
80
80
  }
81
81
  export function presentScanDetails(bundle, ctx) {
82
- const { assessment, facts, profile } = bundle;
82
+ const { facts, profile } = bundle;
83
83
  const assessmentFields = projectAssessmentFields(bundle);
84
84
  const channels = buildNarrativeChannels(bundle);
85
85
  const keyPoints = projectCompactKeyPoints(channels, 6);
@@ -93,8 +93,8 @@ export function presentScanDetails(bundle, ctx) {
93
93
  : undefined;
94
94
  const postureLabel = MERGE_POSTURE_LABEL[profile.status];
95
95
  const verdictLine = assessmentFields.reasoning[0] ??
96
- (assessment.primaryConcern
97
- ? MERGE_CONCERN_LABELS[assessment.primaryConcern]
96
+ (assessmentFields.primaryConcern
97
+ ? MERGE_CONCERN_LABELS[assessmentFields.primaryConcern]
98
98
  : postureLabel);
99
99
  const verificationActions = channels.verification.map((title, index) => ({
100
100
  title: normalizeGeneratedText(title),
@@ -110,10 +110,7 @@ export function presentScanDetails(bundle, ctx) {
110
110
  : "low",
111
111
  rationale: action.detail,
112
112
  }));
113
- const prRiskScore = facts.riskSignals?.riskIndex ?? null;
114
- const prRiskBandLabelText = facts.riskSignals?.band != null
115
- ? prRiskBandLabel(facts.riskSignals.band)
116
- : scoreToBandLabel(prRiskScore);
113
+ const prRisk = formatPrRiskSummary(facts);
117
114
  return {
118
115
  ...assessmentFields,
119
116
  evidenceContext: evidenceContextFromProfile(bundle),
@@ -127,9 +124,9 @@ export function presentScanDetails(bundle, ctx) {
127
124
  verdictLine: normalizeGeneratedText(verdictLine),
128
125
  scopeChip: channels.reachLabel,
129
126
  postureLabel,
130
- prRiskScore,
131
- prRiskBandLabel: prRiskBandLabelText ?? undefined,
132
- riskIndex: prRiskScore,
127
+ prRiskScore: prRisk?.prRiskScore ?? null,
128
+ prRiskBandLabel: prRisk?.prRiskBandLabel,
129
+ riskIndex: prRisk?.prRiskScore ?? null,
133
130
  },
134
131
  signalSummary: mapSignalSummary(bundle),
135
132
  narrative: {
@@ -1 +1 @@
1
- {"version":3,"file":"projectAssessmentFields.d.ts","sourceRoot":"","sources":["../../src/presentation/projectAssessmentFields.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAC1F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAExF,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,sBAAsB,GAC7B,4BAA4B,CAgB9B"}
1
+ {"version":3,"file":"projectAssessmentFields.d.ts","sourceRoot":"","sources":["../../src/presentation/projectAssessmentFields.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAC1F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAOxF,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,sBAAsB,GAC7B,4BAA4B,CAoB9B"}
@@ -1,4 +1,8 @@
1
1
  import { collectVerificationFocusForPresentation, projectReasoningLines, } from "../assessmentProjection.js";
2
+ function trimOptionalExpression(value) {
3
+ const trimmed = value?.trim();
4
+ return trimmed ? trimmed : undefined;
5
+ }
2
6
  export function projectAssessmentFields(bundle) {
3
7
  const { assessment, presentation, result } = bundle;
4
8
  const { channel, focus } = collectVerificationFocusForPresentation(presentation, result);
@@ -11,5 +15,7 @@ export function projectAssessmentFields(bundle) {
11
15
  verificationChannel: channel,
12
16
  reachVisibility: presentation.reachVisibility,
13
17
  narrativeIntensity: presentation.narrativeIntensity,
18
+ confidenceRationale: trimOptionalExpression(assessment.confidenceRationale),
19
+ electionSummary: trimOptionalExpression(assessment.reviewFocalPoint.electionSummary),
14
20
  };
15
21
  }
@@ -89,6 +89,14 @@ describe("surfaceParity guardrail", () => {
89
89
  expect(s.details.verificationChannel).toBe(s.fields.verificationChannel);
90
90
  expect(s.check.verificationChannel).toBe(s.fields.verificationChannel);
91
91
  expect(s.comment.verificationChannel).toBe(s.fields.verificationChannel);
92
+ expect(s.card.confidenceRationale).toBe(s.fields.confidenceRationale);
93
+ expect(s.details.confidenceRationale).toBe(s.fields.confidenceRationale);
94
+ expect(s.check.confidenceRationale).toBe(s.fields.confidenceRationale);
95
+ expect(s.comment.confidenceRationale).toBe(s.fields.confidenceRationale);
96
+ expect(s.card.electionSummary).toBe(s.fields.electionSummary);
97
+ expect(s.details.electionSummary).toBe(s.fields.electionSummary);
98
+ expect(s.check.electionSummary).toBe(s.fields.electionSummary);
99
+ expect(s.comment.electionSummary).toBe(s.fields.electionSummary);
92
100
  });
93
101
  it(`${persona.name}: headline matches across card and details`, () => {
94
102
  const s = surfacesFor(persona.result);
@@ -131,6 +131,7 @@ export declare const engineOutputScanResultSchema: z.ZodObject<{
131
131
  concern: "concern";
132
132
  reach: "reach";
133
133
  changeSeverity: "changeSeverity";
134
+ repository_importance: "repository_importance";
134
135
  role_salience_tiebreak: "role_salience_tiebreak";
135
136
  }>;
136
137
  evidenceRefs: z.ZodArray<z.ZodString>;
@@ -142,11 +143,13 @@ export declare const engineOutputScanResultSchema: z.ZodObject<{
142
143
  concern: "concern";
143
144
  reach: "reach";
144
145
  changeSeverity: "changeSeverity";
146
+ repository_importance: "repository_importance";
145
147
  role_salience_tiebreak: "role_salience_tiebreak";
146
148
  }>;
147
149
  evidenceRefs: z.ZodArray<z.ZodString>;
148
150
  }, z.core.$strip>>;
149
151
  }, z.core.$strip>;
152
+ electionSummary: z.ZodOptional<z.ZodString>;
150
153
  }, z.core.$strip>;
151
154
  reachScope: z.ZodObject<{
152
155
  packages: z.ZodArray<z.ZodString>;
@@ -161,6 +164,7 @@ export declare const engineOutputScanResultSchema: z.ZodObject<{
161
164
  verificationScope: z.ZodObject<{
162
165
  packages: z.ZodArray<z.ZodString>;
163
166
  focus: z.ZodArray<z.ZodString>;
167
+ guidance: z.ZodOptional<z.ZodArray<z.ZodString>>;
164
168
  artifactGrounded: z.ZodOptional<z.ZodObject<{
165
169
  packages: z.ZodArray<z.ZodString>;
166
170
  focus: z.ZodArray<z.ZodString>;
@@ -199,6 +203,7 @@ export declare const engineOutputScanResultSchema: z.ZodObject<{
199
203
  rank: z.ZodNumber;
200
204
  packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
201
205
  evidenceRefs: z.ZodArray<z.ZodString>;
206
+ context: z.ZodOptional<z.ZodString>;
202
207
  }, z.core.$strip>>;
203
208
  factors: z.ZodArray<z.ZodString>;
204
209
  changeClasses: z.ZodArray<z.ZodEnum<{
@@ -238,6 +243,8 @@ export declare const engineOutputScanResultSchema: z.ZodObject<{
238
243
  high_signal_pr: "high_signal_pr";
239
244
  }>;
240
245
  }, z.core.$strip>;
246
+ reasoning: z.ZodArray<z.ZodString>;
247
+ confidenceRationale: z.ZodString;
241
248
  }, z.core.$strip>;
242
249
  prRisk: z.ZodObject<{
243
250
  score: z.ZodNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"scanResultSchema.d.ts","sourceRoot":"","sources":["../src/scanResultSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEtE,wGAAwG;AACxG,eAAO,MAAM,eAAe,EAAG,GAAY,CAAC;AAE5C,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,EAAG,GAAY,CAAC;AAmBnD;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAc/D;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8Bb,CAAC;AAUjB;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMvC,CAAC;AAEH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,EAAE,EAAE,KAAK,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,EAAE,EAAE,IAAI,CAAC;IACT,MAAM,EAAE,uBAAuB,CAAC;CACjC,CAAC;AAEF,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,OAAO,GACZ,kCAAkC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMvC,CAAC;AAEH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,EAAE,EAAE,KAAK,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,EAAE,EAAE,IAAI,CAAC;IACT,MAAM,EAAE,uBAAuB,CAAC;CACjC,CAAC;AAEF,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,OAAO,GACZ,kCAAkC,GAAG,kCAAkC,CAezE;AAED,uFAAuF;AACvF,wBAAgB,kCAAkC,CAChD,IAAI,EAAE,OAAO,GACZ,uBAAuB,CAMzB;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,KAAK,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,IAAI,CAAC;IACT,MAAM,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,OAAO,GACZ,sBAAsB,GAAG,sBAAsB,CAajD;AAED,yEAAyE;AACzE,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAMhE"}
@@ -89,6 +89,8 @@ const minimalAssessment = {
89
89
  concerns: [],
90
90
  factors: ["tooling_maintenance"],
91
91
  changeClasses: ["tooling_maintenance"],
92
+ reasoning: [],
93
+ confidenceRationale: "",
92
94
  presentation: {
93
95
  narrativeIntensity: "minimal",
94
96
  reachVisibility: "hidden",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mergesignal/shared",
3
- "version": "0.11.0",
3
+ "version": "0.12.1",
4
4
  "description": "MergeSignal shared scan contract, presentation policy, and trusted validation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,159 +0,0 @@
1
- import type { ObservationSignalFamily } from "./cardObservationCatalog.js";
2
- import type { NarrativeAvailabilityMode } from "./scanNarrativeFacts.js";
3
- import type { MergePosture } from "./riskVocabulary.js";
4
- import type { FindingSeverity, ScoreLayer } from "./types.js";
5
- /** Max operational-impact rows before collapse on scan detail. */
6
- export declare const TIER1_MAX_VISIBLE_IMPACTS = 3;
7
- /** Findings list collapse threshold on scan detail evidence panel. */
8
- export declare const ACT3_EVIDENCE_COLLAPSE_THRESHOLD = 10;
9
- export type ScanDetailOverallRiskBand = "low" | "moderate" | "high";
10
- export type ScanDetailLayerConcernLevel = "low" | "medium" | "high";
11
- export type ScanDetailSignalLayer = {
12
- layer: ScoreLayer;
13
- label: string;
14
- score: number;
15
- concernLevel: ScanDetailLayerConcernLevel;
16
- concernLabel: string;
17
- };
18
- export type RiskScoreGaugeModel = {
19
- fillPercent: number;
20
- band: ScanDetailOverallRiskBand;
21
- ariaLabel: string;
22
- };
23
- export type ScanDetailSignalSummary = {
24
- score: number;
25
- overallBand: ScanDetailOverallRiskBand;
26
- overallLabel: string;
27
- gauge: RiskScoreGaugeModel;
28
- layers: ScanDetailSignalLayer[];
29
- };
30
- export type RecommendationPriority = "high" | "medium" | "low";
31
- export type GuidanceSource = "insight" | "recommendation" | "verification";
32
- export type ScanDetailRecommendationDetail = {
33
- why: string;
34
- whyNow: string;
35
- signals: string[];
36
- affectedPackages?: {
37
- names: string[];
38
- overflowCount: number;
39
- };
40
- expectedBenefit: string;
41
- };
42
- export type ScanDetailRecommendation = {
43
- id: string;
44
- rank: number;
45
- title: string;
46
- priority: RecommendationPriority;
47
- source: GuidanceSource;
48
- signalFamily?: ObservationSignalFamily | null;
49
- detail: ScanDetailRecommendationDetail;
50
- proofRefs?: {
51
- findingIds?: string[];
52
- };
53
- };
54
- export type ScanDetailRecommendationCenter = {
55
- heading: string;
56
- defaultSelectedId: string;
57
- items: ScanDetailRecommendation[];
58
- posture: MergePosture | null;
59
- scanContext?: string;
60
- };
61
- export type ScanDetailOperationalImpactItem = {
62
- message: string;
63
- where?: string;
64
- verify?: string;
65
- affectedFiles?: string[];
66
- };
67
- export type ScanDetailOperationalImpact = {
68
- status: "rich" | "fallback" | "hidden";
69
- items: ScanDetailOperationalImpactItem[];
70
- fallbackMessage?: string;
71
- };
72
- export type ScanDetailVerdict = {
73
- posture: MergePosture | null;
74
- scopeChip: string | null;
75
- verdictLine: string;
76
- prLabel?: string;
77
- statusLabel?: string;
78
- };
79
- export type ScanDetailAttentionPackage = {
80
- name: string;
81
- version?: string;
82
- direct: boolean;
83
- severity?: FindingSeverity;
84
- evidence?: string;
85
- };
86
- export type ScanDetailAttentionArea = {
87
- problemLabel: string;
88
- problemDescription: string;
89
- packages: ScanDetailAttentionPackage[];
90
- overflowCount: number;
91
- };
92
- export type ScanDetailFindingRow = {
93
- id: string;
94
- severity: FindingSeverity;
95
- title: string;
96
- description: string;
97
- packageName: string;
98
- recommendation?: string;
99
- source: "dependency" | "code";
100
- coveredByRecommendationRank?: number;
101
- };
102
- export type ScanDetailTopology = {
103
- summaryLine: string;
104
- deepest: Array<{
105
- packageName: string;
106
- depth: number;
107
- direct: boolean;
108
- via: string[];
109
- }>;
110
- };
111
- export type ScanDetailNarrativeContext = {
112
- mode: NarrativeAvailabilityMode;
113
- codeIntelligenceAvailable: boolean;
114
- changedPackagesDisplay: string | null;
115
- runtimeSurfaceLabel: string | null;
116
- reachabilityLabel: string | null;
117
- blastRadiusLabel: string | null;
118
- affectedAreas: string[];
119
- structuralOnlyDisclaimer: string | null;
120
- usageHighlights: string[];
121
- frameworks: string[];
122
- blastRadiusFactors: string[];
123
- hotspotNames: string[];
124
- usageContextLine: string | null;
125
- upgradeContextLine: string | null;
126
- };
127
- export type ScanDetailViewModel = {
128
- verdict: ScanDetailVerdict;
129
- signalSummary: ScanDetailSignalSummary | null;
130
- followUpBridgeNote: string | null;
131
- recommendedActions: ScanDetailRecommendationCenter;
132
- operationalImpact: ScanDetailOperationalImpact;
133
- because: {
134
- themes: string[];
135
- confidenceCaveat?: string;
136
- } | null;
137
- evidence: {
138
- attentionAreas: ScanDetailAttentionArea[];
139
- findings: ScanDetailFindingRow[];
140
- findingsOverflowCount: number;
141
- topology: ScanDetailTopology | null;
142
- } | null;
143
- repoContext: {
144
- status: "hidden";
145
- } | {
146
- status: "loaded";
147
- comparisonLine: string;
148
- };
149
- narrativeContext: ScanDetailNarrativeContext;
150
- metadata: {
151
- scanId: string;
152
- generatedAt?: string;
153
- methodologyVersion?: string | null;
154
- changedPackagesSummary?: string;
155
- codeAnalysisTimedOut?: boolean;
156
- codeIntelligenceAvailable?: boolean;
157
- };
158
- };
159
- //# sourceMappingURL=scanDetailViewModelTypes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scanDetailViewModelTypes.d.ts","sourceRoot":"","sources":["../src/scanDetailViewModelTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE9D,kEAAkE;AAClE,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,sEAAsE;AACtE,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD,MAAM,MAAM,yBAAyB,GAAG,KAAK,GAAG,UAAU,GAAG,MAAM,CAAC;AACpE,MAAM,MAAM,2BAA2B,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEpE,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,2BAA2B,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,IAAI,CAAC;IAClC,kBAAkB,EAAE,8BAA8B,CAAC;IACnD,iBAAiB,EAAE,2BAA2B,CAAC;IAC/C,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAChE,QAAQ,EAAE;QACR,cAAc,EAAE,uBAAuB,EAAE,CAAC;QAC1C,QAAQ,EAAE,oBAAoB,EAAE,CAAC;QACjC,qBAAqB,EAAE,MAAM,CAAC;QAC9B,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAC;KACrC,GAAG,IAAI,CAAC;IACT,WAAW,EACP;QAAE,MAAM,EAAE,QAAQ,CAAA;KAAE,GACpB;QAAE,MAAM,EAAE,QAAQ,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,gBAAgB,EAAE,0BAA0B,CAAC;IAC7C,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACnC,sBAAsB,CAAC,EAAE,MAAM,CAAC;QAChC,oBAAoB,CAAC,EAAE,OAAO,CAAC;QAC/B,yBAAyB,CAAC,EAAE,OAAO,CAAC;KACrC,CAAC;CACH,CAAC"}
@@ -1,4 +0,0 @@
1
- /** Max operational-impact rows before collapse on scan detail. */
2
- export const TIER1_MAX_VISIBLE_IMPACTS = 3;
3
- /** Findings list collapse threshold on scan detail evidence panel. */
4
- export const ACT3_EVIDENCE_COLLAPSE_THRESHOLD = 10;
@@ -1,5 +0,0 @@
1
- /**
2
- * Semantic truncation for dashboard card summaries (~90 chars default).
3
- */
4
- export declare function truncateCardSummary(text: string, maxLen?: number): string;
5
- //# sourceMappingURL=truncateCardSummary.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"truncateCardSummary.d.ts","sourceRoot":"","sources":["../src/truncateCardSummary.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,MAAoB,GAC3B,MAAM,CA+BR"}
@@ -1,23 +0,0 @@
1
- /**
2
- * Semantic truncation for dashboard card summaries (~90 chars default).
3
- */
4
- const DEFAULT_MAX = 90;
5
- export function truncateCardSummary(text, maxLen = DEFAULT_MAX) {
6
- const trimmed = text.trim();
7
- if (trimmed.length <= maxLen)
8
- return trimmed;
9
- const slice = trimmed.slice(0, maxLen + 1);
10
- const sentenceEnd = Math.max(slice.lastIndexOf(". "), slice.lastIndexOf("! "), slice.lastIndexOf("? "));
11
- if (sentenceEnd >= Math.floor(maxLen * 0.45)) {
12
- return trimmed.slice(0, sentenceEnd + 1).trim();
13
- }
14
- const clauseEnd = Math.max(slice.lastIndexOf(", "), slice.lastIndexOf("; "), slice.lastIndexOf(" — "), slice.lastIndexOf(" - "));
15
- if (clauseEnd >= Math.floor(maxLen * 0.45)) {
16
- return `${trimmed.slice(0, clauseEnd).trim()}…`;
17
- }
18
- const lastSpace = slice.lastIndexOf(" ");
19
- if (lastSpace >= Math.floor(maxLen * 0.6)) {
20
- return `${trimmed.slice(0, lastSpace).trim()}…`;
21
- }
22
- return `${trimmed.slice(0, maxLen).trim()}…`;
23
- }