@suss/extractor 0.37.1 → 0.38.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.
package/dist/index.cjs CHANGED
@@ -3600,12 +3600,22 @@ function unreadSentences(raw) {
3600
3600
  ...handedOver.map(unreadReasonOf).filter((reason) => reason !== null)
3601
3601
  ];
3602
3602
  }
3603
- function effectsOfBranch(branch) {
3603
+ function effectsOfBranch(branch, keysBySource) {
3604
+ const sources = [...branch.effects, ...branch.extraEffects ?? []];
3604
3605
  const effects = [
3605
3606
  ...branch.effects.map(effectToIR),
3606
3607
  ...branch.extraEffects ?? []
3607
- ];
3608
- return (0, import_behavioral_ir10.foldRepeatedEffects)(effects.map(withNormalizedCallee));
3608
+ ].map(withNormalizedCallee);
3609
+ return (0, import_behavioral_ir10.foldRepeatedEffects)(effects, (effect, at) => {
3610
+ const source = sources[at];
3611
+ const known = keysBySource.get(source);
3612
+ if (known !== void 0) {
3613
+ return known;
3614
+ }
3615
+ const key = (0, import_behavioral_ir10.effectKey)(effect);
3616
+ keysBySource.set(source, key);
3617
+ return key;
3618
+ });
3609
3619
  }
3610
3620
  function provenanceOf(raw, effects) {
3611
3621
  if (raw.length === 0) {
@@ -3650,12 +3660,13 @@ function withNormalizedCallee(effect) {
3650
3660
  return { ...effect, callee: (0, import_behavioral_ir10.normalizeCalleeText)(effect.callee) };
3651
3661
  }
3652
3662
  function assembleSummary(raw, options = DEFAULT_OPTIONS) {
3663
+ const keysBySource = /* @__PURE__ */ new Map();
3653
3664
  const transitions = raw.branches.map((rawBranch) => {
3654
3665
  const branch = branchWithCollapsedReadings(rawBranch);
3655
3666
  const conditions = branch.conditions.map(
3656
3667
  rawConditionToPredicate
3657
3668
  );
3658
- const effects = effectsOfBranch(branch);
3669
+ const effects = effectsOfBranch(branch, keysBySource);
3659
3670
  const transition = {
3660
3671
  id: makeTransitionId(raw.identity.name, branch),
3661
3672
  conditions,
package/dist/index.js CHANGED
@@ -3499,12 +3499,22 @@ function unreadSentences(raw) {
3499
3499
  ...handedOver.map(unreadReasonOf).filter((reason) => reason !== null)
3500
3500
  ];
3501
3501
  }
3502
- function effectsOfBranch(branch) {
3502
+ function effectsOfBranch(branch, keysBySource) {
3503
+ const sources = [...branch.effects, ...branch.extraEffects ?? []];
3503
3504
  const effects = [
3504
3505
  ...branch.effects.map(effectToIR),
3505
3506
  ...branch.extraEffects ?? []
3506
- ];
3507
- return foldRepeatedEffects(effects.map(withNormalizedCallee));
3507
+ ].map(withNormalizedCallee);
3508
+ return foldRepeatedEffects(effects, (effect, at) => {
3509
+ const source = sources[at];
3510
+ const known = keysBySource.get(source);
3511
+ if (known !== void 0) {
3512
+ return known;
3513
+ }
3514
+ const key = effectKey2(effect);
3515
+ keysBySource.set(source, key);
3516
+ return key;
3517
+ });
3508
3518
  }
3509
3519
  function provenanceOf(raw, effects) {
3510
3520
  if (raw.length === 0) {
@@ -3549,12 +3559,13 @@ function withNormalizedCallee(effect) {
3549
3559
  return { ...effect, callee: normalizeCalleeText2(effect.callee) };
3550
3560
  }
3551
3561
  function assembleSummary(raw, options = DEFAULT_OPTIONS) {
3562
+ const keysBySource = /* @__PURE__ */ new Map();
3552
3563
  const transitions = raw.branches.map((rawBranch) => {
3553
3564
  const branch = branchWithCollapsedReadings(rawBranch);
3554
3565
  const conditions = branch.conditions.map(
3555
3566
  rawConditionToPredicate
3556
3567
  );
3557
- const effects = effectsOfBranch(branch);
3568
+ const effects = effectsOfBranch(branch, keysBySource);
3558
3569
  const transition = {
3559
3570
  id: makeTransitionId(raw.identity.name, branch),
3560
3571
  conditions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/extractor",
3
- "version": "0.37.1",
3
+ "version": "0.38.1",
4
4
  "type": "module",
5
5
  "description": "The suss extraction pipeline, which turns what a language adapter read into the summaries the checker pairs across a boundary.",
6
6
  "keywords": [
@@ -46,7 +46,7 @@
46
46
  "typecheck": "tsc --noEmit"
47
47
  },
48
48
  "dependencies": {
49
- "@suss/behavioral-ir": "0.37.1",
49
+ "@suss/behavioral-ir": "0.38.1",
50
50
  "zod": "^4.0.0"
51
51
  },
52
52
  "devDependencies": {