@qianhaoq/dsh-dota2ai 0.2.6 → 0.2.8

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 (3) hide show
  1. package/lib/client.js +71 -8
  2. package/lib/index.js +295 -64
  3. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -25733,9 +25733,6 @@ function deathsToGapClosers(deaths, slotOfHero, spikes, gap = GAP) {
25733
25733
  });
25734
25734
  }
25735
25735
  var HABITS = {
25736
- low_health: { from: "deaths", at: ["deaths_where", "health_below_half_at_window_start"], unsure: "health_at_window_start", label: () => t("deaths that began below half health (12 s before)", "\u6B7B\u524D 12 \u79D2\u5DF2\u4E0D\u5230\u534A\u8840\u7684\u9635\u4EA1", "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0441 \u043C\u0435\u043D\u0435\u0435 \u0447\u0435\u043C \u043F\u043E\u043B\u043E\u0432\u0438\u043D\u043E\u0439 HP (\u0437\u0430 12 \u0441 \u0434\u043E \u0441\u043C\u0435\u0440\u0442\u0438)") },
25737
- // Low health, and outnumbered, outside the game's fights only: for a hero whose job is to be in them, that is where the habit shows.
25738
- low_health_outside_fights: { from: "deaths", at: ["deaths_where", "health_below_half_at_window_start_outside_fights"], unsure: "health_below_half_at_window_start_outside_fights", label: () => t("deaths outside fights that began below half health (12 s before)", "\u56E2\u6218\u4E4B\u5916\u3001\u6B7B\u524D 12 \u79D2\u5DF2\u4E0D\u5230\u534A\u8840\u7684\u9635\u4EA1", "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0432\u043D\u0435 \u0434\u0440\u0430\u043A \u0441 \u043C\u0435\u043D\u0435\u0435 \u0447\u0435\u043C \u043F\u043E\u043B\u043E\u0432\u0438\u043D\u043E\u0439 HP (\u0437\u0430 12 \u0441)") },
25739
25736
  outnumbered_outside_fights: { from: "deaths", at: ["deaths_where", "three_or_more_enemy_heroes_dealing_damage_outside_fights"], unsure: "three_or_more_enemy_heroes_dealing_damage_outside_fights", label: () => t("deaths outside fights to three or more enemy heroes", "\u56E2\u6218\u4E4B\u5916\u88AB\u4E09\u4E2A\u4EE5\u4E0A\u654C\u65B9\u82F1\u96C4\u56F4\u6740\u7684\u9635\u4EA1", "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0432\u043D\u0435 \u0434\u0440\u0430\u043A \u043E\u0442 \u0442\u0440\u0451\u0445 \u0438 \u0431\u043E\u043B\u0435\u0435 \u0432\u0440\u0430\u0433\u043E\u0432") },
25740
25737
  outnumbered: { from: "deaths", at: ["deaths_where", "three_or_more_enemy_heroes_dealing_damage"], unsure: null, label: () => t("deaths to three or more enemy heroes", "\u88AB\u4E09\u4E2A\u4EE5\u4E0A\u654C\u65B9\u82F1\u96C4\u56F4\u6740\u7684\u9635\u4EA1", "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u043E\u0442 \u0442\u0440\u0451\u0445 \u0438 \u0431\u043E\u043B\u0435\u0435 \u0432\u0440\u0430\u0433\u043E\u0432") },
25741
25738
  nothing_pressed: { from: "deaths", at: ["deaths_where", "nothing_cast_and_no_item_used"], unsure: null, label: () => t("deaths with nothing cast or used", "\u4EC0\u4E48\u90FD\u6CA1\u6309\u7684\u9635\u4EA1", "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0431\u0435\u0437 \u0435\u0434\u0438\u043D\u043E\u0439 \u043D\u0430\u0436\u0430\u0442\u043E\u0439 \u0441\u043F\u043E\u0441\u043E\u0431\u043D\u043E\u0441\u0442\u0438 \u0438\u043B\u0438 \u043F\u0440\u0435\u0434\u043C\u0435\u0442\u0430") },
@@ -25746,7 +25743,7 @@ var HABITS = {
25746
25743
  died_holding: { from: "audit", at: ["deaths_with_it_ready_and_not_cast_total"], unsure: null, label: (n) => t(`deaths with ${n.en} ready and not cast`, `${n.zh}\u5C31\u7EEA\u5374\u6CA1\u653E\u7684\u9635\u4EA1`, `\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0441 \u0433\u043E\u0442\u043E\u0432\u044B\u043C, \u043D\u043E \u043D\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u043D\u044B\u043C ${n.en}`) }
25747
25744
  };
25748
25745
  var HABIT_KEYS = Object.keys(HABITS);
25749
- var RETIRED_HABITS = Object.freeze(["alone", "alone_not_traded"]);
25746
+ var RETIRED_HABITS = Object.freeze(["alone", "alone_not_traded", "low_health", "low_health_outside_fights"]);
25750
25747
  var MIN_MINUTES = 10;
25751
25748
  function countIn(h, summary) {
25752
25749
  const v = h.at.length === 2 ? summary?.[h.at[0]]?.[h.at[1]] : summary?.[h.at[0]];
@@ -25761,6 +25758,13 @@ function habitRef(goal, hero) {
25761
25758
  }
25762
25759
  function evaluateHabit(goal, summary, minutes) {
25763
25760
  const out = (result2, evidence, count) => ({ result: result2, evidence, ...Number.isInteger(count) ? { count } : {} });
25761
+ if (goal?.habit === "low_health" || goal?.habit === "low_health_outside_fights") {
25762
+ return out("unknown", t(
25763
+ "This goal is no longer counted: low HP 12 s before death alone does not capture both sides' kill threat. Pick another goal.",
25764
+ "\u8FD9\u4E2A\u76EE\u6807\u5DF2\u4E0D\u518D\u7EDF\u8BA1\uFF1A\u53EA\u770B\u6B7B\u524D 12 \u79D2\u662F\u5426\u4E0D\u5230\u534A\u8840\u65E0\u6CD5\u53CD\u6620\u53CC\u65B9\u771F\u5B9E\u7684\u51FB\u6740\u5A01\u80C1\u3002\u8BF7\u6362\u4E00\u4E2A\u76EE\u6807\u3002",
25765
+ "\u042D\u0442\u0430 \u0446\u0435\u043B\u044C \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044F: \u043D\u0438\u0437\u043A\u043E\u0435 HP \u0437\u0430 12 \u0441 \u0434\u043E \u0441\u043C\u0435\u0440\u0442\u0438 \u0441\u0430\u043C\u043E \u043F\u043E \u0441\u0435\u0431\u0435 \u043D\u0435 \u043E\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0440\u0435\u0430\u043B\u044C\u043D\u0443\u044E \u0443\u0433\u0440\u043E\u0437\u0443 \u0443\u0431\u0438\u0439\u0441\u0442\u0432\u0430 \u043E\u0431\u0435\u0438\u0445 \u0441\u0442\u043E\u0440\u043E\u043D. \u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0440\u0443\u0433\u0443\u044E \u0446\u0435\u043B\u044C."
25766
+ ));
25767
+ }
25764
25768
  if (RETIRED_HABITS.includes(goal?.habit)) return out("unknown", t("This goal is no longer counted: deaths with no ally nearby said little about a decision. Pick another goal.", "\u8FD9\u4E2A\u76EE\u6807\u5DF2\u4E0D\u518D\u7EDF\u8BA1\uFF1A\u8EAB\u8FB9\u6709\u6CA1\u6709\u961F\u53CB\u8BF4\u660E\u4E0D\u4E86\u51B3\u7B56\u5BF9\u9519\u3002\u8BF7\u6362\u4E00\u4E2A\u76EE\u6807\u3002", "\u042D\u0442\u0430 \u0446\u0435\u043B\u044C \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044F: \u043D\u0430\u043B\u0438\u0447\u0438\u0435 \u0441\u043E\u044E\u0437\u043D\u0438\u043A\u043E\u0432 \u0440\u044F\u0434\u043E\u043C \u043C\u0430\u043B\u043E \u0433\u043E\u0432\u043E\u0440\u0438\u0442 \u043E \u0440\u0435\u0448\u0435\u043D\u0438\u0438. \u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0440\u0443\u0433\u0443\u044E \u0446\u0435\u043B\u044C."));
25765
25769
  const h = HABITS[goal?.habit];
25766
25770
  if (!h || !Number.isFinite(goal.max) || h.from === "audit" && !(goal.name?.en && goal.name?.zh)) return out("unknown", t("Unknown goal.", "\u65E0\u6CD5\u8BC6\u522B\u7684\u76EE\u6807\u3002", "\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u0446\u0435\u043B\u044C."));
@@ -27591,6 +27595,14 @@ var T9 = {
27591
27595
  laneVisits: { en: "Came into the lane", zh: "\u522B\u8DEF\u6765\u672C\u8DEF\u4EA4\u624B", ru: "\u041F\u0440\u0438\u0448\u043B\u0438 \u043D\u0430 \u043B\u0438\u043D\u0438\u044E" },
27592
27596
  laneVisitDied: { en: "died", zh: "\u9635\u4EA1", ru: "\u043F\u043E\u0433\u0438\u0431\u043B\u0438" },
27593
27597
  laneRotations: { en: "Left lane before 10:00 (20 s+)", zh: "10 \u5206\u949F\u524D\u79BB\u8DEF\u6E38\u8D70\uFF0820 \u79D2\u4EE5\u4E0A\uFF09", ru: "\u0423\u0445\u043E\u0434\u044B \u0441 \u043B\u0438\u043D\u0438\u0438 \u0434\u043E 10:00 (20 \u0441+)" },
27598
+ laneRoaming: { en: "Roaming before 10:00 (no single lane)", zh: "10 \u5206\u949F\u524D\u6E38\u8D70\uFF08\u65E0\u5355\u4E00\u56FA\u5B9A\u5206\u8DEF\uFF09", ru: "\u0420\u043E\u0443\u043C\u0438\u043D\u0433 \u0434\u043E 10:00 (\u0431\u0435\u0437 \u043E\u0434\u043D\u043E\u0439 \u043B\u0438\u043D\u0438\u0438)" },
27599
+ laneTimeByThird: { en: "Time before 10:00 by lane", zh: "10 \u5206\u949F\u524D\u5404\u8DEF\u505C\u7559\u65F6\u95F4", ru: "\u0412\u0440\u0435\u043C\u044F \u043F\u043E \u043B\u0438\u043D\u0438\u044F\u043C \u0434\u043E 10:00" },
27600
+ laneBase: { en: "base", zh: "\u57FA\u5730", ru: "\u0431\u0430\u0437\u0430" },
27601
+ laneNotKnown: { en: "not known", zh: "\u7F3A\u5931\u91C7\u6837", ru: "\u043D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445" },
27602
+ laneRoamTrips: { en: "Roaming trips before 10:00 (20 s+)", zh: "10 \u5206\u949F\u524D\u5404\u8DEF\u6E38\u8D70\u65F6\u6BB5\uFF0820 \u79D2\u4EE5\u4E0A\uFF09", ru: "\u0412\u044B\u0445\u043E\u0434\u044B \u043D\u0430 \u043B\u0438\u043D\u0438\u0438 \u0434\u043E 10:00 (20 \u0441+)" },
27603
+ laneRoamTraded: { en: "traded damage", zh: "\u4EA4\u624B\u6362\u8840", ru: "\u0440\u0430\u0437\u043C\u0435\u043D \u0443\u0440\u043E\u043D\u043E\u043C" },
27604
+ laneRoamEnemyDied: { en: "enemy died", zh: "\u654C\u65B9\u9635\u4EA1", ru: "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0432\u0440\u0430\u0433\u043E\u0432" },
27605
+ laneRoamAllyDied: { en: "ally died", zh: "\u961F\u53CB\u9635\u4EA1", ru: "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0441\u043E\u044E\u0437\u043D\u0438\u043A\u043E\u0432" },
27594
27606
  lanePartnerDied: { en: "lane partner died", zh: "\u672C\u8DEF\u961F\u53CB\u9635\u4EA1", ru: "\u043F\u0430\u0440\u0442\u043D\u0451\u0440 \u043F\u043E \u043B\u0438\u043D\u0438\u0438 \u043F\u043E\u0433\u0438\u0431" },
27595
27607
  lanePartTime: { en: "Shared the lane part-time", zh: "\u517C\u987E\u672C\u8DEF", ru: "\u0414\u0435\u043B\u0438\u043B\u0438 \u043B\u0438\u043D\u0438\u044E \u0447\u0430\u0441\u0442\u0438\u0447\u043D\u043E" },
27596
27608
  laneRoster: { en: "Read over", zh: "\u7EDF\u8BA1\u8303\u56F4", ru: "\u041F\u043E \u0433\u0435\u0440\u043E\u044F\u043C" },
@@ -27896,11 +27908,9 @@ var TOTALS = {
27896
27908
  damage_share_in_death_windows: { en: "Share of it", zh: "\u5176\u4E2D" },
27897
27909
  attacks: { en: "attacks", zh: "\u666E\u901A\u653B\u51FB" },
27898
27910
  "abilities and items": { en: "abilities and items", zh: "\u6280\u80FD\u548C\u7269\u54C1" },
27899
- health_below_half_at_window_start: { en: "Deaths that began below half health", zh: "\u8D77\u6B65\u4E0D\u5230\u534A\u8840\u7684\u9635\u4EA1" },
27900
27911
  three_or_more_enemy_heroes_dealing_damage: { en: "Deaths to three or more enemy heroes", zh: "\u88AB\u4E09\u4E2A\u4EE5\u4E0A\u654C\u65B9\u82F1\u96C4\u6253\u6B7B" },
27901
27912
  in_a_fight: { en: "Deaths in a fight", zh: "\u56E2\u6218\u4E2D\u7684\u9635\u4EA1" },
27902
27913
  outside_fights: { en: "Deaths outside fights", zh: "\u56E2\u6218\u4E4B\u5916\u7684\u9635\u4EA1" },
27903
- health_below_half_at_window_start_outside_fights: { en: "Outside fights, began below half health", zh: "\u56E2\u6218\u4E4B\u5916\u3001\u8D77\u6B65\u4E0D\u5230\u534A\u8840" },
27904
27914
  three_or_more_enemy_heroes_dealing_damage_outside_fights: { en: "Outside fights, to three or more enemy heroes", zh: "\u56E2\u6218\u4E4B\u5916\u3001\u88AB\u4E09\u4E2A\u4EE5\u4E0A\u654C\u65B9\u82F1\u96C4\u6253\u6B7B" },
27905
27915
  target_spell_immune_and_not_stunned: { en: "Casts on a spell-immune target, no stun", zh: "\u653E\u7ED9\u9B54\u514D\u76EE\u6807\u4E14\u6CA1\u6655\u4F4F" },
27906
27916
  enemy_hero_target_alive_12s_later: { en: "Casts whose target was alive 12 s later", zh: "\u653E\u51FA 12 \u79D2\u540E\u76EE\u6807\u4ECD\u5B58\u6D3B" },
@@ -28557,7 +28567,7 @@ function Record({ data: data2, lang }) {
28557
28567
  " \xB7 ",
28558
28568
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: t2(T9.laneResult[r.lane_result]) })
28559
28569
  ] }) : null
28560
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "ag-rec-note", children: t2(T9.laneNoEconomy) }),
28570
+ ] }) : r.how_the_lane_went?.roaming_before_10_00 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "ag-rec-head", children: t2(T9.laneRoaming) }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "ag-rec-note", children: t2(T9.laneNoEconomy) }),
28561
28571
  r.lane && r.read_from === "replay" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "ag-rec-note", children: t2(T9.laneFromReplay) }),
28562
28572
  r.lane && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "ag-lane-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { className: "ag-lane", children: [
28563
28573
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tr", { children: T9.laneCols[lang].map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { scope: "col", children: c }, c)) }) }),
@@ -28630,6 +28640,58 @@ function Record({ data: data2, lang }) {
28630
28640
  Array.isArray(tr.enemy_deaths_i_damaged) && tr.enemy_deaths_i_damaged.length > 0 ? ` \xB7 ${t2(T9.laneVisitDied)} ${tr.enemy_deaths_i_damaged.map((x) => N(x.hero)).join(", ")}` : "",
28631
28641
  Array.isArray(tr.lane_partner_deaths_while_away) && tr.lane_partner_deaths_while_away.length > 0 ? ` \xB7 ${t2(T9.lanePartnerDied)} ${tr.lane_partner_deaths_while_away.map((x) => N(x.hero)).join(", ")}` : ""
28632
28642
  ] }, i))
28643
+ ] }),
28644
+ w.roaming_before_10_00 && w.my_lane_seconds_by_third && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "ag-rec-line", children: [
28645
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: t2(T9.laneTimeByThird) }),
28646
+ ["top", "mid", "bot"].map((k2) => typeof w.my_lane_seconds_by_third[k2] === "number" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "ag-chip", children: [
28647
+ t2(T9.lane[k2]),
28648
+ " ",
28649
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("em", { children: [
28650
+ w.my_lane_seconds_by_third[k2],
28651
+ t2(T9.sec)
28652
+ ] })
28653
+ ] }, k2)),
28654
+ w.my_lane_seconds_by_third.base > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "ag-chip", children: [
28655
+ t2(T9.laneBase),
28656
+ " ",
28657
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("em", { children: [
28658
+ w.my_lane_seconds_by_third.base,
28659
+ t2(T9.sec)
28660
+ ] })
28661
+ ] }),
28662
+ w.my_lane_seconds_by_third.dead > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "ag-chip", children: [
28663
+ t2(T9.dead),
28664
+ " ",
28665
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("em", { children: [
28666
+ w.my_lane_seconds_by_third.dead,
28667
+ t2(T9.sec)
28668
+ ] })
28669
+ ] }),
28670
+ w.my_lane_seconds_by_third.not_known > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "ag-chip is-warn", children: [
28671
+ t2(T9.laneNotKnown),
28672
+ " ",
28673
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("em", { children: [
28674
+ w.my_lane_seconds_by_third.not_known,
28675
+ t2(T9.sec)
28676
+ ] })
28677
+ ] })
28678
+ ] }),
28679
+ w.roaming_before_10_00 && Array.isArray(w.roaming_trips_before_10_00) && w.roaming_trips_before_10_00.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "ag-rec-line", children: [
28680
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: t2(T9.laneRoamTrips) }),
28681
+ w.roaming_trips_before_10_00.map((tr, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "ag-chip", children: [
28682
+ tr.from,
28683
+ "\u2013",
28684
+ tr.to,
28685
+ " (",
28686
+ tr.duration_s,
28687
+ t2(T9.sec),
28688
+ ") \xB7 ",
28689
+ T9.lane[tr.lane] ? t2(T9.lane[tr.lane]) : tr.lane,
28690
+ tr.traded_damage_with_enemy_hero === true ? ` \xB7 ${t2(T9.laneRoamTraded)}` : "",
28691
+ typeof tr.enemy_deaths_in_lane === "number" && tr.enemy_deaths_in_lane > 0 ? ` \xB7 ${t2(T9.laneRoamEnemyDied)} ${tr.enemy_deaths_in_lane}` : "",
28692
+ typeof tr.ally_deaths_in_lane === "number" && tr.ally_deaths_in_lane > 0 ? ` \xB7 ${t2(T9.laneRoamAllyDied)} ${tr.ally_deaths_in_lane}` : "",
28693
+ typeof tr.my_death === "string" ? ` \xB7 ${t2(T9.fightDied)} ${tr.my_death}` : ""
28694
+ ] }, i))
28633
28695
  ] })
28634
28696
  ] });
28635
28697
  })(),
@@ -29945,6 +30007,7 @@ function Record({ data: data2, lang }) {
29945
30007
  ] });
29946
30008
  }
29947
30009
  if (data2.kind === "skill_build") {
30010
+ const sbName = (ab) => ab.includes("+") ? ab.split("+").map((k2) => N(k2)).join(" / ") : N(ab);
29948
30011
  const distRow = (label, snap) => snap && snap.abilities && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "ag-rec-line", children: [
29949
30012
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
29950
30013
  label,
@@ -29953,7 +30016,7 @@ function Record({ data: data2, lang }) {
29953
30016
  ")"
29954
30017
  ] }),
29955
30018
  Object.entries(snap.abilities).map(([ab, lv]) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "ag-chip", children: [
29956
- N(ab),
30019
+ sbName(ab),
29957
30020
  " ",
29958
30021
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("em", { children: [
29959
30022
  "Lv",
package/lib/index.js CHANGED
@@ -7294,6 +7294,13 @@ function habitGoal(habit, summary, of = null) {
7294
7294
  }
7295
7295
  function evaluateHabit(goal, summary, minutes) {
7296
7296
  const out = (result2, evidence, count) => ({ result: result2, evidence, ...Number.isInteger(count) ? { count } : {} });
7297
+ if (goal?.habit === "low_health" || goal?.habit === "low_health_outside_fights") {
7298
+ return out("unknown", t(
7299
+ "This goal is no longer counted: low HP 12 s before death alone does not capture both sides' kill threat. Pick another goal.",
7300
+ "\u8FD9\u4E2A\u76EE\u6807\u5DF2\u4E0D\u518D\u7EDF\u8BA1\uFF1A\u53EA\u770B\u6B7B\u524D 12 \u79D2\u662F\u5426\u4E0D\u5230\u534A\u8840\u65E0\u6CD5\u53CD\u6620\u53CC\u65B9\u771F\u5B9E\u7684\u51FB\u6740\u5A01\u80C1\u3002\u8BF7\u6362\u4E00\u4E2A\u76EE\u6807\u3002",
7301
+ "\u042D\u0442\u0430 \u0446\u0435\u043B\u044C \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044F: \u043D\u0438\u0437\u043A\u043E\u0435 HP \u0437\u0430 12 \u0441 \u0434\u043E \u0441\u043C\u0435\u0440\u0442\u0438 \u0441\u0430\u043C\u043E \u043F\u043E \u0441\u0435\u0431\u0435 \u043D\u0435 \u043E\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0440\u0435\u0430\u043B\u044C\u043D\u0443\u044E \u0443\u0433\u0440\u043E\u0437\u0443 \u0443\u0431\u0438\u0439\u0441\u0442\u0432\u0430 \u043E\u0431\u0435\u0438\u0445 \u0441\u0442\u043E\u0440\u043E\u043D. \u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0440\u0443\u0433\u0443\u044E \u0446\u0435\u043B\u044C."
7302
+ ));
7303
+ }
7297
7304
  if (RETIRED_HABITS.includes(goal?.habit)) return out("unknown", t("This goal is no longer counted: deaths with no ally nearby said little about a decision. Pick another goal.", "\u8FD9\u4E2A\u76EE\u6807\u5DF2\u4E0D\u518D\u7EDF\u8BA1\uFF1A\u8EAB\u8FB9\u6709\u6CA1\u6709\u961F\u53CB\u8BF4\u660E\u4E0D\u4E86\u51B3\u7B56\u5BF9\u9519\u3002\u8BF7\u6362\u4E00\u4E2A\u76EE\u6807\u3002", "\u042D\u0442\u0430 \u0446\u0435\u043B\u044C \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044F: \u043D\u0430\u043B\u0438\u0447\u0438\u0435 \u0441\u043E\u044E\u0437\u043D\u0438\u043A\u043E\u0432 \u0440\u044F\u0434\u043E\u043C \u043C\u0430\u043B\u043E \u0433\u043E\u0432\u043E\u0440\u0438\u0442 \u043E \u0440\u0435\u0448\u0435\u043D\u0438\u0438. \u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0440\u0443\u0433\u0443\u044E \u0446\u0435\u043B\u044C."));
7298
7305
  const h = HABITS[goal?.habit];
7299
7306
  if (!h || !Number.isFinite(goal.max) || h.from === "audit" && !(goal.name?.en && goal.name?.zh)) return out("unknown", t("Unknown goal.", "\u65E0\u6CD5\u8BC6\u522B\u7684\u76EE\u6807\u3002", "\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u0446\u0435\u043B\u044C."));
@@ -7412,9 +7419,6 @@ var init_goals = __esm({
7412
7419
  GAP = new Set(GAP_CLOSERS);
7413
7420
  clock4 = (sec) => `${Math.floor(Math.max(0, sec) / 60)}:${String(Math.round(Math.max(0, sec)) % 60).padStart(2, "0")}`;
7414
7421
  HABITS = {
7415
- low_health: { from: "deaths", at: ["deaths_where", "health_below_half_at_window_start"], unsure: "health_at_window_start", label: () => t("deaths that began below half health (12 s before)", "\u6B7B\u524D 12 \u79D2\u5DF2\u4E0D\u5230\u534A\u8840\u7684\u9635\u4EA1", "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0441 \u043C\u0435\u043D\u0435\u0435 \u0447\u0435\u043C \u043F\u043E\u043B\u043E\u0432\u0438\u043D\u043E\u0439 HP (\u0437\u0430 12 \u0441 \u0434\u043E \u0441\u043C\u0435\u0440\u0442\u0438)") },
7416
- // Low health, and outnumbered, outside the game's fights only: for a hero whose job is to be in them, that is where the habit shows.
7417
- low_health_outside_fights: { from: "deaths", at: ["deaths_where", "health_below_half_at_window_start_outside_fights"], unsure: "health_below_half_at_window_start_outside_fights", label: () => t("deaths outside fights that began below half health (12 s before)", "\u56E2\u6218\u4E4B\u5916\u3001\u6B7B\u524D 12 \u79D2\u5DF2\u4E0D\u5230\u534A\u8840\u7684\u9635\u4EA1", "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0432\u043D\u0435 \u0434\u0440\u0430\u043A \u0441 \u043C\u0435\u043D\u0435\u0435 \u0447\u0435\u043C \u043F\u043E\u043B\u043E\u0432\u0438\u043D\u043E\u0439 HP (\u0437\u0430 12 \u0441)") },
7418
7422
  outnumbered_outside_fights: { from: "deaths", at: ["deaths_where", "three_or_more_enemy_heroes_dealing_damage_outside_fights"], unsure: "three_or_more_enemy_heroes_dealing_damage_outside_fights", label: () => t("deaths outside fights to three or more enemy heroes", "\u56E2\u6218\u4E4B\u5916\u88AB\u4E09\u4E2A\u4EE5\u4E0A\u654C\u65B9\u82F1\u96C4\u56F4\u6740\u7684\u9635\u4EA1", "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0432\u043D\u0435 \u0434\u0440\u0430\u043A \u043E\u0442 \u0442\u0440\u0451\u0445 \u0438 \u0431\u043E\u043B\u0435\u0435 \u0432\u0440\u0430\u0433\u043E\u0432") },
7419
7423
  outnumbered: { from: "deaths", at: ["deaths_where", "three_or_more_enemy_heroes_dealing_damage"], unsure: null, label: () => t("deaths to three or more enemy heroes", "\u88AB\u4E09\u4E2A\u4EE5\u4E0A\u654C\u65B9\u82F1\u96C4\u56F4\u6740\u7684\u9635\u4EA1", "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u043E\u0442 \u0442\u0440\u0451\u0445 \u0438 \u0431\u043E\u043B\u0435\u0435 \u0432\u0440\u0430\u0433\u043E\u0432") },
7420
7424
  nothing_pressed: { from: "deaths", at: ["deaths_where", "nothing_cast_and_no_item_used"], unsure: null, label: () => t("deaths with nothing cast or used", "\u4EC0\u4E48\u90FD\u6CA1\u6309\u7684\u9635\u4EA1", "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0431\u0435\u0437 \u0435\u0434\u0438\u043D\u043E\u0439 \u043D\u0430\u0436\u0430\u0442\u043E\u0439 \u0441\u043F\u043E\u0441\u043E\u0431\u043D\u043E\u0441\u0442\u0438 \u0438\u043B\u0438 \u043F\u0440\u0435\u0434\u043C\u0435\u0442\u0430") },
@@ -7425,7 +7429,7 @@ var init_goals = __esm({
7425
7429
  died_holding: { from: "audit", at: ["deaths_with_it_ready_and_not_cast_total"], unsure: null, label: (n) => t(`deaths with ${n.en} ready and not cast`, `${n.zh}\u5C31\u7EEA\u5374\u6CA1\u653E\u7684\u9635\u4EA1`, `\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0441 \u0433\u043E\u0442\u043E\u0432\u044B\u043C, \u043D\u043E \u043D\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u043D\u044B\u043C ${n.en}`) }
7426
7430
  };
7427
7431
  HABIT_KEYS = Object.keys(HABITS);
7428
- RETIRED_HABITS = Object.freeze(["alone", "alone_not_traded"]);
7432
+ RETIRED_HABITS = Object.freeze(["alone", "alone_not_traded", "low_health", "low_health_outside_fights"]);
7429
7433
  MIN_MINUTES = 10;
7430
7434
  result = (r, evidence) => ({ result: r, evidence });
7431
7435
  }
@@ -12914,7 +12918,7 @@ import { join as join5 } from "node:path";
12914
12918
 
12915
12919
  // lib/agent/review/schema.js
12916
12920
  var DEEP_REVIEW_SCHEMA = "dota2.ai/deep-review@1";
12917
- var DEEP_REVIEW_PROMPT_VERSION = 75;
12921
+ var DEEP_REVIEW_PROMPT_VERSION = 77;
12918
12922
  var MAX_REFS = 3;
12919
12923
  var MAX_FINDINGS = 3;
12920
12924
  var MAX_HIGHLIGHTS = 4;
@@ -13002,15 +13006,15 @@ var SUBMIT_REVIEW = {
13002
13006
  type: "array",
13003
13007
  minItems: 2,
13004
13008
  maxItems: MAX_STORY,
13005
- description: "How the game came to its result, as a chain of causes in game order: each link a stretch of the game, what changed in it (gold, buildings, the chance to win, a lane), and because of what, with the records that show it. From the draft and the lanes to the turn and the end. The verdict sums this chain up in one sentence.",
13009
+ description: "Concise 1-sentence-per-phase causal backbone in game order (2\u20135 links; do not repeat full `chapters` prose): each link names a stretch, what changed (gold, buildings, lane), and because of what, backed by exact records. The verdict sums this chain up in one sentence.",
13006
13010
  items: {
13007
13011
  type: "object",
13008
13012
  additionalProperties: false,
13009
13013
  required: ["phase", "what_changed", "because", "whose", "evidence"],
13010
13014
  properties: {
13011
13015
  phase: { ...STR, description: 'The stretch, with its times: "0:00\u201310:00, the lane", "24:00\u201327:47, the turn".' },
13012
- what_changed: { ...STR, description: "What changed in it, with the tools' numbers: the gold lead, buildings, a lane's result." },
13013
- because: { ...STR, description: "Why, from the tools: where the gap came from, who came, who was where. Facts, not motives." },
13016
+ what_changed: { ...STR, description: "One concise sentence on what changed in this stretch, with the tools' numbers (gold lead, buildings, lane result)." },
13017
+ because: { ...STR, description: "One concise sentence on why, from the tools (where the gap came from, who joined, who was where). Facts, not motives." },
13014
13018
  whose: { type: "string", enum: STORY_WHOSE, description: "Whose doing this link mostly is, in your judgment: me (what the player controlled), team, enemy, draft, or unclear." },
13015
13019
  evidence: {
13016
13020
  type: "array",
@@ -13067,19 +13071,15 @@ var SUBMIT_REVIEW = {
13067
13071
  type: "object",
13068
13072
  additionalProperties: false,
13069
13073
  required: ["main_reason", "why"],
13070
- description: "Whole-game judgment beside `story` (do not repeat `story` chronology or findings): state `main_reason` and `why`, plus optional `strengths`, `line_ups`, and `against_your_plan` (only when the player stated a plan). Omit `course`, `your_part`, and `window` when `story` already covers them; attach `evidence` only for records not already cited in `story`.",
13074
+ description: "Whole-game judgment beside `chapters` and `story` (do not re-summarize draft, timeline, or findings): state only `main_reason` and `why`, plus `against_your_plan` ONLY when the opening message names the player's stated plan; attach `evidence` ONLY for records not already cited in `chapters`/`story`.",
13071
13075
  properties: {
13072
- line_ups: { ...STR, description: 'What lineup_timing shows: which heroes of each side win more in shorter or in longer public games, and which length this game had. One or two sentences; say "public games" and name the heroes. Leave out when it shows no lean on either side.' },
13073
- strengths: { ...STR, description: "Optional: what the player's hero was up against and when, from power_spikes (matchups in public/pro games, key level/item timings, and from which enemy item the kills came). Leave out what the tool has no data for." },
13074
- against_your_plan: { ...STR, description: "Only when the opening message says what the player's plan was: read the game against it (fit of items/play via build_for_plan & tempo_report, whether hero/window data supports it, and where it broke via farm_report/window_report). Leave out when the player did not state a plan." },
13075
- window: { ...STR, description: 'Optional (omit when `story` already covers the gold windows): peak lead window, buildings/fights taken, and enemy items finished near its end (never say an item "ended" the window).' },
13076
- course: { ...STR, description: "Optional (omit when `story` already covers the course of the game): summary of buildings and fights from tempo_report." },
13077
- your_part: { ...STR, description: "Optional (omit when `story` already covers the player's map presence): where the player spent time and which fights/buildings they joined." },
13076
+ against_your_plan: { ...STR, description: "ONLY when the opening message names the player's stated plan: read the game against it (fit of items/play via build_for_plan & tempo_report, whether hero/window data supports it, and where it broke via farm_report/window_report). Omit when the player did not state a plan." },
13078
13077
  main_reason: { type: "string", enum: PLAN_REASONS, description: "What the course of the game is mostly down to, in your judgment: your_play (the player's own play), team_play (the team's), enemy_play (what the enemy did), line_ups (the draft), unclear (the tools do not settle it)." },
13079
- why: { ...STR, description: "One or two sentences arguing main_reason from what the tools showed." },
13078
+ why: { ...STR, description: "One or two sentences arguing main_reason from what the tools showed, without repeating `chapters` or `story`." },
13080
13079
  evidence: {
13081
13080
  type: "array",
13082
13081
  maxItems: MAX_PLAN_EVIDENCE,
13082
+ description: "Optional: attach ONLY for records not already cited in `chapters`/`story`.",
13083
13083
  items: {
13084
13084
  type: "object",
13085
13085
  additionalProperties: false,
@@ -13092,7 +13092,6 @@ var SUBMIT_REVIEW = {
13092
13092
  }
13093
13093
  }
13094
13094
  },
13095
- did_well: { type: "array", items: STR, maxItems: 3 },
13096
13095
  encouragement: { ...STR, description: "1\u20132 sincere, specific closing sentences from the coach affirming the strengths already shown in this replay and building genuine confidence for future games." },
13097
13096
  blind_spots: { type: "array", items: STR, description: "What the replay data could not show for this review (from the tools' gaps)." }
13098
13097
  }
@@ -13145,18 +13144,19 @@ FIRST-PRINCIPLES DOTA 2 JUDGMENT
13145
13144
  - **Context-aware cast, build & macro evaluation**: Judge skill builds (\`skill_build\`), spells (\`hero_abilities\`, \`ability_audit\`, \`immunity_windows\`), items (\`build_check\`, \`pro_item_choices\`, \`my_economy\` / \`estimated_minutes_of_my_farm\`, \`player_already_held_for_this_purpose\`, \`most_built_in_this_bracket\` / \`public_items_in_this_bracket\`, \`most_built_by_pros_on_this_hero\`), and macro against THIS game's draft, economy, and timings \u2014 never just for deviating from a standard build or because a cast did not kill within 12 s (peeling, zoning, forcing BKB, stopping TPs are real value). A cast that damaged several enemies was not wasted because one was spell immune; an ability with \`casts_logged: false\` was never "0 casts". For supports, inspect \`ward_report\`, \`save_report\`, and \`my_rotations_before_10_00\` (a reference across all ranks is context, not a bracket average or quota).
13146
13145
  - **Fair attribution & emotional value**: In losses, clearly distinguish draft, team execution, and enemy tempo from what the player controlled \u2014 never charge the team's lost fights to a player who was not the cause. In EVERY game (win or loss), actively look for genuine positives (solid laning, standout \`me_in_fight\` damage/casts/saves, smart item/skill adaptation, composure in tough games) and praise them concretely with replay evidence. Write improvements in a collaborative "here is a sharper play next time" tone \u2014 never scolding, never mechanical KPI quotas.
13147
13146
 
13148
- STRUCTURE OF \`submit_review\`
13149
- - \`verdict\`: one crisp, balanced sentence summing up the game (at most 1\u20132 key numbers).
13150
- - \`opening_note\`: 2\u20133 sincere, grounded coach sentences contextualizing this game fairly (celebrating a win warmly or separating non-player factors in a loss).
13151
- - \`highlights\` (1\u2013${MAX_HIGHLIGHTS}): concrete, evidence-backed positives (optional \`evidence\` refs so the player can replay their highlight on the minimap).
13152
- - \`chapters\` (2\u2013${MAX_CHAPTERS}): adaptive breakdown across the dimensions that mattered (\`draft_and_lanes\`, \`laning\`, \`skill_build\`, \`items\`, \`teamfights\`, \`macro\`, \`other\`), each with \`assessment\` (\`praise\` / \`solid\` / \`mixed\` / \`key_gap\`), authentic coaching \`analysis\`, cited \`evidence\`, and optional \`takeaway\` ONLY when real room to improve exists (omit for \`praise\`/\`solid\`).
13153
- - \`story\` (2\u20136 causal links in game order) and \`game_plan\` (\`main_reason\` + \`why\`, plus optional \`strengths\`, \`line_ups\`, and \`against_your_plan\` ONLY when the opening message names the player's stated plan, using \`build_for_plan\`).
13147
+ STRUCTURE OF \`submit_review\` (no duplication across sections)
13148
+ - \`verdict\`: one crisp, balanced sentence summing up the game (1\u20132 key numbers max).
13149
+ - \`opening_note\`: 2\u20133 grounded coach sentences contextualizing this game (celebrate wins warmly or separate non-player factors in losses).
13150
+ - \`highlights\` (1\u2013${MAX_HIGHLIGHTS}): concrete, evidence-backed positives (optional \`evidence\` refs for minimap replay).
13151
+ - \`chapters\` (2\u2013${MAX_CHAPTERS}): carry the coaching analysis per dimension (\`draft_and_lanes\`, \`laning\`, \`skill_build\`, \`items\`, \`teamfights\`, \`macro\`, \`other\`), each with \`assessment\` (\`praise\`/\`solid\`/\`mixed\`/\`key_gap\`), \`analysis\`, \`evidence\`, and optional \`takeaway\` ONLY when real room to improve exists (omit for \`praise\`/\`solid\`).
13152
+ - \`story\` (2\u20135 links, 1 sentence per phase in game order): compact causal backbone \u2014 do not repeat \`chapters\` prose.
13153
+ - \`game_plan\`: only \`main_reason\` + \`why\` (+ \`against_your_plan\` ONLY if the opening message names a stated plan, using \`build_for_plan\`; optional \`evidence\` ONLY for records not cited in \`chapters\`/\`story\`) \u2014 never re-summarize draft or timeline already in \`chapters\`/\`story\`.
13154
13154
  - \`findings\` (0\u2013${MAX_FINDINGS}, ordered by what mattered most to this player): only high-leverage, player-controlled improvements (omit or keep concise in clean wins; link \`story_link\`; optional \`rule\` with \`when\`/\`do\`/optional \`this_game\` only for recurring decisions).
13155
- - \`encouragement\`: 1\u20132 sincere, specific closing sentences affirming the strengths already shown in this replay.
13155
+ - \`encouragement\`: 1\u20132 sincere closing sentences affirming the strengths shown in this replay.
13156
13156
 
13157
13157
  VERIFICATION & HONESTY RULES (enforced by code)
13158
- - **Facts & numbers**: every clock time (m:ss) and every number you state about the game must come verbatim from a tool result in this conversation \u2014 never add, subtract, or average. Use counts a tool directly states (\`killed_by\`, \`by_target\`, \`*_total\`, \`deaths_where\`, \`damage_share_in_death_windows\`).
13159
- - **Evidence refs**: every evidence item cites 1\u20133 exact \`ref\` strings from this conversation and states ONLY what those cited records contain. Tool summary counts belong to top-level summary refs (\`deaths:<hero>\`, \`audit:<hero>:<ability>\`, \`fights:<hero>\`, \`build:<hero>\`, \`overview\`). Never join a fact from one record to a different moment.
13158
+ - **Facts & numbers**: every clock time (m:ss) and number about the game must come verbatim from a tool result in this conversation \u2014 never add, subtract, or average. Use counts a tool states (\`killed_by\`, \`by_target\`, \`*_total\`, \`deaths_where\`, \`damage_share_in_death_windows\`).
13159
+ - **Evidence refs (summary vs child)**: each evidence item cites 1\u20133 exact \`ref\` strings and states ONLY what those records hold. Summary refs (\`deaths:<hero>\`, \`fights:<hero>\`, \`audit:<hero>:<ability>\`, \`tempo:<hero>\`, \`decision:<hero>\`, \`sieges:<hero>\`, \`roshan:<hero>\`, \`window:<hero>\`, \`overview\`) ONLY cover top-level counts/totals \u2014 NEVER individual event clocks, damage, or stun durations. Per-event details MUST cite the child record's exact \`ref\`: \`cast:<hero>:<ability>:<n>\` (single cast clock/stun/damage), \`death:<hero>:<n>\` (single death), \`fights:<hero>:<n>\` (single fight clock/damage/participants), \`phase:<hero>:<n>\` (10-min phase), \`decision:<hero>:<n>\`, \`sieges:<hero>:<n>\`, \`roshan:<hero>:<n>\`. Never join a fact from one record to a different moment.
13160
13160
  - **Never claim vision / fog of war**: replays have no vision data. Wards (\`observers_within_1600\`, \`ward_report\`) show placement, never who saw whom. Never say a player "had no vision", "did not see", or died "because of a ward". A rule's \`when\` must use only what is guaranteed on the player's own screen (own HP/mana, items/gold, clock, allies near, enemy heroes missing from the minimap, an ability an enemy just used) \u2014 never enemies seen approaching or walking toward the player.
13161
13161
  - **Read choices, not minds**: state actions, positions, and distances \u2014 never motives ("intended", "wanted", "refused", "ignored the call"). Say a hero was "farming" only when a tool reports \`doing: "farming"\`. Never state what an ability or item does from memory (always check \`hero_abilities\` / \`build_check\`; never assume spell immunity stops an ability the tools show pierced it).
13162
13162
  - **Respect tool semantics**: never quote \`key_moments\` win-chance percentages (they only rank moments, never assign fault); never say a \`save_report\` cast "saved" or "failed to save" an ally; in \`decision_points\`, "neither" means the team did not take a building/Roshan (not that it "did nothing"); in \`siege_report\`, \`owners_near\` does not prove defending and other heroes' positions are at push start (use \`me_when_it_fell\` or \`game_state\` for when it fell); in \`roshan_report\`, \`aegis_pickups_only\` never proves a side took no Roshan; in \`window_report\`, never say an item "closed/ended" a window; in \`lineup_timing\`, per-hero win rates are not a lineup win rate; quote pro vs public bracket samples accurately with their label and release/patch.
@@ -18336,7 +18336,7 @@ function meInFightRecord(trace, h, team, key, f, part) {
18336
18336
  };
18337
18337
  const ultKeys = ultimatesOf(key);
18338
18338
  const ultCast = (() => {
18339
- if (!ultKeys.length || hasNoCooldown(key) || ultKeys.every((u) => DEATH_TRIGGERED_ABILITIES.has(u)) || !Array.isArray(trace.casts)) return null;
18339
+ if (!ultKeys.length || ultKeys.every((u) => DEATH_TRIGGERED_ABILITIES.has(u)) || !Array.isArray(trace.casts)) return null;
18340
18340
  const ultIds = new Set(ultKeys.map((u) => nameId(trace, u)).filter((id) => id >= 0));
18341
18341
  let ultWindowUnknown = false;
18342
18342
  if (myNpc >= 0) {
@@ -18377,6 +18377,7 @@ function meInFightRecord(trace, h, team, key, f, part) {
18377
18377
  }
18378
18378
  if (autoMissing) return null;
18379
18379
  }
18380
+ if (hasNoCooldown(key)) return null;
18380
18381
  return ultWindowUnknown ? null : false;
18381
18382
  })();
18382
18383
  const keyItemsUsed = (() => {
@@ -19375,11 +19376,152 @@ function placeAt(trace, i, s) {
19375
19376
  if (st.alive?.[k3] !== 1 || st.x?.[k3] == null || st.y?.[k3] == null) return null;
19376
19377
  return inBase2(st.x[k3], st.y[k3]) ? "base" : third2(st.x[k3], st.y[k3]);
19377
19378
  }
19379
+ function roamingLaneProcess(trace, h) {
19380
+ const byThird = { top: 0, mid: 0, bot: 0, base: 0, dead: 0, not_known: 0 };
19381
+ const rawRuns = [];
19382
+ let curLane = null;
19383
+ let curFrom = -1;
19384
+ let curTo = -1;
19385
+ const flush = () => {
19386
+ if (curLane != null) {
19387
+ rawRuns.push([curFrom, curTo, curLane]);
19388
+ curLane = null;
19389
+ curFrom = -1;
19390
+ curTo = -1;
19391
+ }
19392
+ };
19393
+ for (let s = LANE_FROM; s < LANE_END; s += 1) {
19394
+ const p = placeAt(trace, h, s);
19395
+ if (p === 3) byThird.top += 1;
19396
+ else if (p === 2) byThird.mid += 1;
19397
+ else if (p === 1) byThird.bot += 1;
19398
+ else if (p === "base") byThird.base += 1;
19399
+ else if (p === "dead") byThird.dead += 1;
19400
+ else byThird.not_known += 1;
19401
+ if (typeof p === "number") {
19402
+ if (curLane === p) curTo = s;
19403
+ else {
19404
+ flush();
19405
+ curLane = p;
19406
+ curFrom = s;
19407
+ curTo = s;
19408
+ }
19409
+ } else {
19410
+ flush();
19411
+ }
19412
+ }
19413
+ flush();
19414
+ if (byThird.top + byThird.mid + byThird.bot === 0) {
19415
+ return { unknown: byThird.not_known > 0 ? "positions_not_known" : "no_single_lane" };
19416
+ }
19417
+ const team = trace.heroes[h].team;
19418
+ const all = trace.heroes.map((_, i) => i);
19419
+ const nameIx = (i) => trace.names.indexOf(trace.heroes[i].npc);
19420
+ const heroOfName2 = new Map(all.map((i) => [nameIx(i), i]));
19421
+ const myNpc = nameIx(h);
19422
+ const hasDamage = Array.isArray(trace.damage);
19423
+ const hasDeaths = Array.isArray(trace.deaths);
19424
+ const traceEnd = typeof trace.t0 === "number" && typeof trace.n === "number" ? trace.t0 + trace.n - 1 : null;
19425
+ const allRealDeaths = hasDeaths ? realDeaths(trace).filter((d) => d[0] >= LANE_FROM && d[0] <= LANE_END + VISIT_AFTER) : [];
19426
+ let deathPosMissing = false;
19427
+ let deathWindowTruncated = false;
19428
+ const trips = [];
19429
+ for (const [fromSec, toSec, runLane] of rawRuns) {
19430
+ const endSec = toSec + 1;
19431
+ const duration = endSec - fromSec;
19432
+ if (duration < ROTATION_MIN_SECONDS) continue;
19433
+ let tradedDamage = null;
19434
+ if (hasDamage && myNpc >= 0) {
19435
+ tradedDamage = false;
19436
+ for (const row of trace.damage) {
19437
+ const [sec, att, tgt, , val] = row;
19438
+ if (sec < fromSec || sec >= endSec) continue;
19439
+ if (val != null && !(val > 0)) continue;
19440
+ if (att === myNpc) {
19441
+ const other2 = heroOfName2.get(tgt);
19442
+ if (other2 != null && trace.heroes[other2].team !== team) {
19443
+ tradedDamage = true;
19444
+ break;
19445
+ }
19446
+ } else if (tgt === myNpc) {
19447
+ const other2 = heroOfName2.get(att);
19448
+ if (other2 != null && trace.heroes[other2].team !== team) {
19449
+ tradedDamage = true;
19450
+ break;
19451
+ }
19452
+ }
19453
+ }
19454
+ }
19455
+ let enemyDeathsInLane = null;
19456
+ let allyDeathsInLane = null;
19457
+ let myDeath = null;
19458
+ if (hasDeaths) {
19459
+ if (traceEnd != null && toSec + VISIT_AFTER > traceEnd) {
19460
+ deathWindowTruncated = true;
19461
+ } else {
19462
+ const windowDeaths = allRealDeaths.filter((d) => d[0] >= fromSec && d[0] <= toSec + VISIT_AFTER && heroOfName2.has(d[1]));
19463
+ const where2 = (d) => placeAt(trace, heroOfName2.get(d[1]), Math.floor(d[0]) - 1);
19464
+ const enemyNear = windowDeaths.filter((d) => trace.heroes[heroOfName2.get(d[1])].team !== team);
19465
+ if (enemyNear.some((d) => where2(d) == null)) {
19466
+ deathPosMissing = true;
19467
+ } else {
19468
+ enemyDeathsInLane = enemyNear.filter((d) => where2(d) === runLane).length;
19469
+ }
19470
+ const allyNear = windowDeaths.filter((d) => {
19471
+ const v = heroOfName2.get(d[1]);
19472
+ return v !== h && trace.heroes[v].team === team;
19473
+ });
19474
+ if (allyNear.some((d) => where2(d) == null)) {
19475
+ deathPosMissing = true;
19476
+ } else {
19477
+ allyDeathsInLane = allyNear.filter((d) => where2(d) === runLane).length;
19478
+ }
19479
+ }
19480
+ if (myNpc >= 0) {
19481
+ const nextPlace = placeAt(trace, h, toSec + 1);
19482
+ const myDeathInTrip = allRealDeaths.find((d) => d[1] === myNpc && d[0] >= fromSec && d[0] < endSec);
19483
+ const myDeathAfter = allRealDeaths.find((d) => d[1] === myNpc && d[0] >= endSec && d[0] <= toSec + 2);
19484
+ if (myDeathInTrip) {
19485
+ myDeath = clock3(myDeathInTrip[0]);
19486
+ } else if (myDeathAfter) {
19487
+ if (nextPlace === "dead") myDeath = clock3(myDeathAfter[0]);
19488
+ else if (nextPlace !== null) myDeath = false;
19489
+ } else if (traceEnd == null || toSec + 2 <= traceEnd) {
19490
+ myDeath = false;
19491
+ }
19492
+ }
19493
+ }
19494
+ trips.push({
19495
+ lane: LANE_NAME3[runLane],
19496
+ from: clock3(fromSec),
19497
+ to: clock3(toSec),
19498
+ duration_s: duration,
19499
+ traded_damage_with_enemy_hero: tradedDamage,
19500
+ enemy_deaths_in_lane: enemyDeathsInLane,
19501
+ ally_deaths_in_lane: allyDeathsInLane,
19502
+ my_death: myDeath
19503
+ });
19504
+ }
19505
+ const gaps = [
19506
+ { topic: "single_lane", reason: "no_single_lane_roamer" },
19507
+ ...byThird.not_known > 0 ? [{ topic: "hero_positions", reason: "position_samples_missing_before_10_00", missing_seconds: byThird.not_known }] : [],
19508
+ ...!hasDamage ? [{ topic: "roaming_damage", reason: "no_damage_rows_in_trace" }] : [],
19509
+ ...!hasDeaths ? [{ topic: "roaming_deaths", reason: "no_deaths_in_trace" }] : [],
19510
+ ...deathPosMissing ? [{ topic: "roaming_deaths", reason: "death_position_missing_during_roaming_trip" }] : [],
19511
+ ...deathWindowTruncated ? [{ topic: "roaming_deaths", reason: "trace_ends_before_roaming_death_window" }] : []
19512
+ ];
19513
+ return {
19514
+ roaming_before_10_00: true,
19515
+ my_lane_seconds_by_third: byThird,
19516
+ roaming_trips_before_10_00: trips,
19517
+ gaps
19518
+ };
19519
+ }
19378
19520
  function laneProcess(trace, h) {
19379
19521
  const lanes = trace.heroes.map((_, i) => laneOf(trace, i));
19380
19522
  const lane = lanes[h];
19381
19523
  if (lane === void 0) return { unknown: "positions_not_known" };
19382
- if (lane === null) return { unknown: "no_single_lane" };
19524
+ if (lane === null) return roamingLaneProcess(trace, h);
19383
19525
  const team = trace.heroes[h].team;
19384
19526
  const all = trace.heroes.map((_, i) => i);
19385
19527
  const inLane = all.filter((i) => lanes[i] === lane);
@@ -19644,7 +19786,7 @@ function laneProcess(trace, h) {
19644
19786
  gaps
19645
19787
  };
19646
19788
  }
19647
- var LANE_PROCESS_RULE = `gold_gap_by_source: gold the log says each side of the lane received before 10:00, by source, and lost on dying (the income every hero gets over time is in neither side); visits: a hero from outside the lane exchanging damage with the lane's other side inside the lane's third of the map, seconds ${VISIT_GAP} s or less apart are one visit, died = heroes of the lane or the visitor who died in this lane during it or ${VISIT_AFTER} s after; a hero who came without exchanging damage is not counted; a hero in no single lane who spent ${PART_TIME_SHARE * 100}% or more of the lane stage in this lane shared it (part_time_in_this_lane): not a visitor, and not in the gold sums \u2014 roster_note says when that leaves the sides uneven; a side's visit counts are null (not known) when one of its heroes exchanged damage with the lane at a second the replay has no position for them; my_rotations_before_10_00: trips between 1:00 and 10:00 where the player stayed alive outside base in another lane's third for ${ROTATION_MIN_SECONDS} s or more, with destination, power_runes_activated (power-rune buff modifier activations from trace.runes \u2014 not rune pickups, bottled runes, bounty, water or wisdom runes), wards placed (null if a same-team ward during the trip has an unknown placer), enemy deaths in [from, to + 10 s] that the player damaged during [from, to + 1 s) within 15 s before the death, whether the player died on the trip, and any fixed lane partner deaths while away (null when positions or source logs are missing)`;
19789
+ var LANE_PROCESS_RULE = `gold_gap_by_source: gold the log says each side of the lane received before 10:00, by source, and lost on dying (the income every hero gets over time is in neither side); visits: a hero from outside the lane exchanging damage with the lane's other side inside the lane's third of the map, seconds ${VISIT_GAP} s or less apart are one visit, died = heroes of the lane or the visitor who died in this lane during it or ${VISIT_AFTER} s after; a hero who came without exchanging damage is not counted; a hero in no single lane who spent ${PART_TIME_SHARE * 100}% or more of the lane stage in this lane shared it (part_time_in_this_lane): not a visitor, and not in the gold sums \u2014 roster_note says when that leaves the sides uneven; a side's visit counts are null (not known) when one of its heroes exchanged damage with the lane at a second the replay has no position for them; my_rotations_before_10_00: trips between 1:00 and 10:00 where the player stayed alive outside base in another lane's third for ${ROTATION_MIN_SECONDS} s or more, with destination, power_runes_activated (power-rune buff modifier activations from trace.runes \u2014 not rune pickups, bottled runes, bounty, water or wisdom runes), wards placed (null if a same-team ward during the trip has an unknown placer), enemy deaths in [from, to + 10 s] that the player damaged during [from, to + 1 s) within 15 s before the death, whether the player died on the trip, and any fixed lane partner deaths while away (null when positions or source logs are missing); roaming_before_10_00: when the player spent under 60% of 1:00\u201310:00 in any single lane, my_lane_seconds_by_third counts seconds per lane third (top/mid/bot/base/dead/not_known) and roaming_trips_before_10_00 lists contiguous stays of ${ROTATION_MIN_SECONDS} s or more in one lane third (broken by missing positions, base, or death) with whether the player traded hero damage during [from, to + 1 s), enemy and ally deaths in that lane within [from, to + ${VISIT_AFTER} s] (null when any death's pre-death position or the log is missing), and my_death`;
19648
19790
  var LANE_PROCESS_REFERENCE = "On 209 parsed games: in the 444 lane sides that lost their lane in the 194 games whose gold log has dying rows, the gold behind from hero kills, assists and dying (netted together) added up to about as much as the gold behind from lane creeps (255k against 286k), and was the larger part in 44% of them (197). How many times enemies visited a lane did not go with losing it (lost 39% with no visit, 37% with three or more); visits that cost the lane side more deaths in the lane than the enemy did (one or more net) did: lost 48% (141 of 295), against 36% (333 of 930) otherwise. 168 of the 1225 lane sides had a hero sharing the lane part-time (their sums leave that hero out); without them the same holds (45% of 392; 46% against 35%). On 59 games (562 single-lane heroes, 302 early rotation trips of 20 s+ before 10:00): 56% (170/302) included an enemy death the player damaged, 20% (59/302) placed a ward, 8% (24/302) activated a power rune, and in 7% (22/302) a fixed lane partner died while the player was away. A reference for how much each part usually weighs, not what happened here.";
19649
19791
 
19650
19792
  // lib/agent/draftReport.js
@@ -20323,7 +20465,22 @@ function levelAt(trace, seatIndex, t6) {
20323
20465
  }
20324
20466
  return null;
20325
20467
  }
20326
- function snapshotAtHeroLevel(trace, seatIndex, targetLevel, heroAbilitiesList, initialOnlyKeys) {
20468
+ function upgradeSequence(levels) {
20469
+ const sorted = [...levels].sort((a, b) => a[0] - b[0]);
20470
+ const seq = [];
20471
+ let highest = 0;
20472
+ for (const [at, lv] of sorted) {
20473
+ if (!(lv > highest)) continue;
20474
+ seq.push([at, lv]);
20475
+ highest = lv;
20476
+ }
20477
+ return seq;
20478
+ }
20479
+ function sameUpgradeSequence(a, b) {
20480
+ if (!a.length || a.length !== b.length) return false;
20481
+ return a.every(([tA, lvA], i) => lvA === b[i][1] && Math.abs(tA - b[i][0]) <= 1);
20482
+ }
20483
+ function snapshotAtHeroLevel(trace, seatIndex, targetLevel, heroAbilitiesList, initialOnlyKeys, linkedGroupKeyByMember) {
20327
20484
  const levels = trace.states?.[seatIndex]?.level;
20328
20485
  if (!Array.isArray(levels) || !levels.some((v) => Number.isFinite(v))) return null;
20329
20486
  const i = levels.findIndex((v) => Number.isFinite(v) && v >= targetLevel);
@@ -20347,7 +20504,10 @@ function snapshotAtHeroLevel(trace, seatIndex, targetLevel, heroAbilitiesList, i
20347
20504
  for (const [k3, entry] of heroAbilitiesList) {
20348
20505
  if (initialOnlyKeys.has(k3)) continue;
20349
20506
  const lv = abilityLevel(entry, evalT);
20350
- if (lv > 0) abilities[k3] = lv;
20507
+ if (lv > 0) {
20508
+ const outKey = linkedGroupKeyByMember.get(k3) ?? k3;
20509
+ abilities[outKey] = Math.max(abilities[outKey] ?? 0, lv);
20510
+ }
20351
20511
  }
20352
20512
  return { clock: clock3(reachedT), abilities };
20353
20513
  }
@@ -20405,6 +20565,24 @@ function skillBuild(trace, args = {}, ctx = {}) {
20405
20565
  ]
20406
20566
  };
20407
20567
  }
20568
+ const primaryUltKey = pd.ultimate(hero.id)?.key ?? ultimatesOf(slug2)[0] ?? null;
20569
+ const ultEntries = heroAbilitiesList.filter(([k3]) => ultKeys.has(k3)).map(([k3, entry]) => ({ key: k3, seq: upgradeSequence(entry.levels) })).sort((a, b) => a.key === primaryUltKey ? -1 : b.key === primaryUltKey ? 1 : a.key.localeCompare(b.key));
20570
+ const ultGroups = [];
20571
+ for (const item of ultEntries) {
20572
+ const match = ultGroups.find((g) => sameUpgradeSequence(g.seq, item.seq));
20573
+ if (match) match.keys.push(item.key);
20574
+ else ultGroups.push({ seq: item.seq, keys: [item.key] });
20575
+ }
20576
+ const linkedUltimates = ultGroups.filter((g) => g.keys.length > 1).map((g) => g.keys);
20577
+ const linkedWithMap = /* @__PURE__ */ new Map();
20578
+ const linkedGroupKeyByMember = /* @__PURE__ */ new Map();
20579
+ for (const group of linkedUltimates) {
20580
+ const combinedKey = group.join("+");
20581
+ for (const k3 of group) {
20582
+ linkedWithMap.set(k3, group.filter((other2) => other2 !== k3));
20583
+ linkedGroupKeyByMember.set(k3, combinedKey);
20584
+ }
20585
+ }
20408
20586
  const upgradeTimeline = [];
20409
20587
  const innateMetaExact = Boolean(pd.exact && pd.major === ABILITIES6.patch);
20410
20588
  const nonPointKeys = /* @__PURE__ */ new Set();
@@ -20416,6 +20594,7 @@ function skillBuild(trace, args = {}, ctx = {}) {
20416
20594
  const firstLearned = sorted.find(([, lv]) => lv > 0);
20417
20595
  const maxLv = sorted.reduce((m, [, lv]) => lv > m ? lv : m, 0);
20418
20596
  const isUlt = ultKeys.has(k3);
20597
+ const linkedWith = linkedWithMap.get(k3);
20419
20598
  const isLearnable = pdMap.has(k3) || isUlt;
20420
20599
  const isMetadataNonPoint = !isLearnable && innateMetaExact && Boolean(ALL_ABILITIES2[k3]);
20421
20600
  const isKnownInnate = isMetadataNonPoint && Boolean(firstLearned && firstLearned[0] <= trace.t0 + 2 && firstLearned[1] === 1);
@@ -20437,6 +20616,7 @@ function skillBuild(trace, args = {}, ctx = {}) {
20437
20616
  name: abilityDisplayName(k3),
20438
20617
  ability_level: lv,
20439
20618
  ...isUlt ? { ultimate: true } : {},
20619
+ ...linkedWith ? { linked_with: linkedWith } : {},
20440
20620
  ...isInitialInnate ? { initial: true, innate: true } : {}
20441
20621
  });
20442
20622
  if (cap != null && !maxedRecorded && lv >= cap) {
@@ -20459,10 +20639,17 @@ function skillBuild(trace, args = {}, ctx = {}) {
20459
20639
  const levelsMissing = !Array.isArray(levelsArr) || !levelsArr.some((v) => Number.isFinite(v));
20460
20640
  const hasIncompleteLevels = missingLevelAbilities.length > 0;
20461
20641
  const ultLevelsIncomplete = missingLevelAbilities.some((k3) => ultKeys.has(k3));
20462
- const atLevel6 = hasIncompleteLevels ? null : snapshotAtHeroLevel(trace, seatIndex, 6, heroAbilitiesList, nonPointKeys);
20463
- const atLevel10 = hasIncompleteLevels ? null : snapshotAtHeroLevel(trace, seatIndex, 10, heroAbilitiesList, nonPointKeys);
20642
+ const atLevel6 = hasIncompleteLevels ? null : snapshotAtHeroLevel(trace, seatIndex, 6, heroAbilitiesList, nonPointKeys, linkedGroupKeyByMember);
20643
+ const atLevel10 = hasIncompleteLevels ? null : snapshotAtHeroLevel(trace, seatIndex, 10, heroAbilitiesList, nonPointKeys, linkedGroupKeyByMember);
20464
20644
  const maxedOrder = hasIncompleteLevels ? null : maxedEntries.map(({ t: _t, ...rest }) => rest);
20465
- const ultimateLevels = ultLevelsIncomplete ? null : upgradeTimeline.filter((u) => u.ultimate === true).map((u) => ({ ability: u.ability, name: u.name, level: u.ability_level, clock: u.clock, hero_level: u.hero_level }));
20645
+ const ultimateLevels = ultLevelsIncomplete ? null : upgradeTimeline.filter((u) => u.ultimate === true).map((u) => ({
20646
+ ability: u.ability,
20647
+ name: u.name,
20648
+ level: u.ability_level,
20649
+ clock: u.clock,
20650
+ hero_level: u.hero_level,
20651
+ ...u.linked_with ? { linked_with: u.linked_with } : {}
20652
+ }));
20466
20653
  return {
20467
20654
  ref: `skill_build:${slug2}`,
20468
20655
  hero: slug2,
@@ -20472,8 +20659,9 @@ function skillBuild(trace, args = {}, ctx = {}) {
20472
20659
  at_level_10: atLevel10,
20473
20660
  maxed_order: maxedOrder,
20474
20661
  ultimate_levels: ultimateLevels,
20662
+ ...linkedUltimates.length ? { linked_ultimates: linkedUltimates } : {},
20475
20663
  talents,
20476
- note: "Upgrade times come from replay ability-level samples. Innate and Scepter/Shard-granted abilities established by Valve patch metadata are excluded from at_level_6 / at_level_10 skill-point distributions (innates are marked innate: true, initial: true); normal learnable skills kept at level 1 stay included. maxed_order records when each non-ultimate ability reaches its ability cap.",
20664
+ note: 'Upgrade times come from replay ability-level samples. Innate and Scepter/Shard-granted abilities established by Valve patch metadata are excluded from at_level_6 / at_level_10 skill-point distributions (innates are marked innate: true, initial: true); normal learnable skills kept at level 1 stay included. Linked ultimates that level together on one skill point (e.g. Dark Willow Bedlam + Terrorize) stay listed in upgrade_timeline and ultimate_levels with linked_with, and are combined under a "+" key in at_level_6 / at_level_10 so each shared skill point is counted once. maxed_order records when each non-ultimate ability reaches its ability cap.',
20477
20665
  gaps: [
20478
20666
  ...hasIncompleteLevels ? [{ topic: "skill_build", reason: "incomplete_ability_level_samples", abilities: missingLevelAbilities }] : [],
20479
20667
  ...levelsMissing ? [{ topic: "hero_levels", reason: "level_samples_missing_in_trace" }] : [],
@@ -20632,6 +20820,7 @@ function laneReport(trace, args = {}, ctx = {}) {
20632
20820
  return k3 ? k3.key : null;
20633
20821
  };
20634
20822
  const proc = laneProcess(trace, seatIndex);
20823
+ const howTheLaneWent = proc.unknown ? null : proc.roaming_before_10_00 ? { ...proc, rule: LANE_PROCESS_RULE } : (({ lane: lane2, heroes_in_lane, ...rest }) => ({ lane_read_from_replay: lane2, heroes_in_lane_read_from_replay: heroes_in_lane, ...rest, rule: LANE_PROCESS_RULE, reference: LANE_PROCESS_REFERENCE }))(proc);
20635
20824
  const base = {
20636
20825
  ref: `lane:${slug2}`,
20637
20826
  hero: slug2,
@@ -20639,10 +20828,10 @@ function laneReport(trace, args = {}, ctx = {}) {
20639
20828
  my_deaths_before_10_00: early.map((d) => ({ clock: clock3(d[0]), killer: killer(d[2]) })),
20640
20829
  // Its own lane and roster, read from the replay's positions: the match record's lane above may group the heroes
20641
20830
  // differently (a hero it marks as roaming), and these sums are over this roster, not that one.
20642
- how_the_lane_went: proc.unknown ? null : (({ lane: lane2, heroes_in_lane, ...rest }) => ({ lane_read_from_replay: lane2, heroes_in_lane_read_from_replay: heroes_in_lane, ...rest, rule: LANE_PROCESS_RULE, reference: LANE_PROCESS_REFERENCE }))(proc),
20831
+ how_the_lane_went: howTheLaneWent,
20643
20832
  ...proc.unknown ? { how_the_lane_went_not_known: proc.unknown } : {},
20644
20833
  // The visit counts again, one level down: the tool's own counts a sentence may quote (null: not known).
20645
- ...proc.unknown ? {} : { lane_visit_counts: {
20834
+ ...proc.unknown || proc.roaming_before_10_00 ? {} : { lane_visit_counts: {
20646
20835
  enemy_visits: proc.enemy_visits?.visits ?? null,
20647
20836
  my_team_deaths_in_enemy_visits: proc.enemy_visits?.my_team_deaths_in_them ?? null,
20648
20837
  enemy_deaths_in_enemy_visits: proc.enemy_visits?.enemy_deaths_in_them ?? null,
@@ -20815,7 +21004,7 @@ var KNOWLEDGE_TOOLS = [
20815
21004
  },
20816
21005
  {
20817
21006
  name: "lane_report",
20818
- description: "The laning stage of a hero (use it for the player): who was in the lane, and per hero the last hits at 5:00 and 10:00, denies, gold and XP at 10:00, the lane's result and the rule it is called by, when each side's first tower fell, the player's deaths before 10:00, and how the lane went (how_the_lane_went, from the replay, with the lane and the heroes it was read over \u2014 the record may group them differently): the lane's gold gap before 10:00 split by source \u2014 last hits, kills and assists, gold lost on dying \u2014 and running every two minutes, the visits of heroes from outside the lane who exchanged damage in it and who died then, where the player spent the lane stage, and the player's early rotation trips away from their main lane (`my_rotations_before_10_00`: trips of 20 s+ with destination, power runes activated, wards placed, enemy deaths damaged, and lane partner deaths while away) \u2014 next to how the same core matchup usually stands at 10:00 in professional games and how the lane goes in public games of the player's bracket. Look here before saying anything about the lane. When the match data has no per-minute numbers it reads the lane, last hits, denies and the lane's result from the replay instead (read_from: replay; no XP, no pro or public baseline), and says what it could not read under gaps.",
21007
+ description: "The laning stage of a hero (use it for the player): who was in the lane, and per hero the last hits at 5:00 and 10:00, denies, gold and XP at 10:00, the lane's result and the rule it is called by, when each side's first tower fell, the player's deaths before 10:00, and how the lane went (how_the_lane_went, from the replay, with the lane and the heroes it was read over \u2014 the record may group them differently): the lane's gold gap before 10:00 split by source \u2014 last hits, kills and assists, gold lost on dying \u2014 and running every two minutes, the visits of heroes from outside the lane who exchanged damage in it and who died then, where the player spent the lane stage, and the player's early rotation trips away from their main lane (`my_rotations_before_10_00`: trips of 20 s+ with destination, power runes activated, wards placed, enemy deaths damaged, and lane partner deaths while away) \u2014 or, for a roaming hero in no single lane before 10:00, `roaming_before_10_00: true`, `my_lane_seconds_by_third` (seconds in top/mid/bot/base/dead/not_known), and `roaming_trips_before_10_00` (contiguous 20 s+ lane stays with enemy damage exchange, lane deaths, and own death, while `lane` stays null) \u2014 next to how the same core matchup usually stands at 10:00 in professional games and how the lane goes in public games of the player's bracket. Look here before saying anything about the lane. When the match data has no per-minute numbers it reads the lane, last hits, denies and the lane's result from the replay instead (read_from: replay; no XP, no pro or public baseline), and says what it could not read under gaps.",
20819
21008
  input_schema: { type: "object", properties: { hero: HERO4 }, required: ["hero"], additionalProperties: false },
20820
21009
  run: laneReport
20821
21010
  },
@@ -20947,6 +21136,7 @@ function namesIn(value, lang) {
20947
21136
  } else if (Array.isArray(v)) v.forEach(walk);
20948
21137
  else if (v && typeof v === "object") for (const [k3, x] of Object.entries(v)) {
20949
21138
  if (/^[a-z][a-z0-9_]{1,60}$/.test(k3) && typeof x === "number") see(k3);
21139
+ else if (typeof x === "number" && /^[a-z][a-z0-9_]{1,60}(\+[a-z][a-z0-9_]{1,60})+$/.test(k3)) k3.split("+").forEach(see);
20950
21140
  else if (typeof x === "number" && /^[a-z][a-z0-9_]{1,60}: /.test(k3)) see(k3.slice(0, k3.indexOf(":")));
20951
21141
  walk(x);
20952
21142
  }
@@ -21116,22 +21306,27 @@ function collectFacts(sources) {
21116
21306
  }
21117
21307
  if (span && own) out.moments.push({ from: span[0], to: span[1], numbers: own });
21118
21308
  };
21119
- const cite = (value) => {
21309
+ const cite = (value, summaryParent = null) => {
21120
21310
  if (Array.isArray(value)) {
21121
- for (const v of value) cite(v);
21311
+ for (const v of value) cite(v, summaryParent);
21122
21312
  return;
21123
21313
  }
21124
21314
  if (!value || typeof value !== "object") return;
21315
+ let nextParent = summaryParent;
21125
21316
  if (typeof value.ref === "string") {
21126
- const inner = value.ref_scope === "summary" ? summaryFactsOf(value) : collectFactsOf(value);
21317
+ const isSummary = value.ref_scope === "summary";
21318
+ const inner = isSummary ? summaryFactsOf(value) : collectFactsOf(value);
21127
21319
  const at = typeof value.t === "number" ? value.t : typeof value.from === "number" ? value.from : typeof value.first_held?.t === "number" ? value.first_held.t : null;
21128
- const r = out.refs.get(value.ref) ?? { at, times: /* @__PURE__ */ new Set(), numbers: /* @__PURE__ */ new Set() };
21320
+ const r = out.refs.get(value.ref) ?? { at, times: /* @__PURE__ */ new Set(), numbers: /* @__PURE__ */ new Set(), scope: isSummary ? "summary" : "record", children: /* @__PURE__ */ new Set() };
21129
21321
  for (const t6 of inner.times) r.times.add(t6);
21130
21322
  for (const n of inner.numbers) r.numbers.add(n);
21131
21323
  if (r.at == null) r.at = at;
21324
+ if (!isSummary && r.scope === "summary") r.scope = "record";
21132
21325
  out.refs.set(value.ref, r);
21326
+ if (summaryParent && summaryParent !== value.ref) out.refs.get(summaryParent)?.children.add(value.ref);
21327
+ nextParent = isSummary ? value.ref : null;
21133
21328
  }
21134
- for (const v of Object.values(value)) cite(v);
21329
+ for (const v of Object.values(value)) cite(v, nextParent);
21135
21330
  };
21136
21331
  for (const src of [].concat(sources ?? [])) {
21137
21332
  walk(src, null);
@@ -21293,17 +21488,52 @@ var has = (set, n, slack) => {
21293
21488
  return false;
21294
21489
  };
21295
21490
  var percentOk = (set, n) => has(set, n.value / 100, 6e-3) || n.value >= 1 && has(set, n.value, 0.5);
21491
+ var bigOk = (n, set) => has(set, n.value, n.approx ? n.value * 0.06 : 1);
21492
+ var timeInSet = (times, clock10) => {
21493
+ const t6 = clockToSeconds(clock10);
21494
+ if (t6 == null) return false;
21495
+ for (let d = -CLOCK_TOLERANCE; d <= CLOCK_TOLERANCE; d += 1) if (times.has(t6 + d)) return true;
21496
+ return false;
21497
+ };
21498
+ var numberInEvidence = (local, n) => n.percent ? percentOk(local, n) : n.value >= BIG ? bigOk(n, local) : n.value > TRIVIAL || n.decimal ? has(local, n.value, n.decimal ? 0.05 : 0.5) : false;
21499
+ var MOMENT_PROBLEM = /^(.+?)\s+\(not in ([^)]+)\)$/;
21500
+ function suggestChildRefs(problem, sources = [], knownRefs = null) {
21501
+ if (!problem || problem.kind !== "moment" || typeof problem.text !== "string") return [];
21502
+ const m = MOMENT_PROBLEM.exec(problem.text);
21503
+ if (!m) return [];
21504
+ const rawVal = m[1].trim();
21505
+ const citedRefs = m[2].split(",").map((s) => s.trim()).filter(Boolean);
21506
+ if (!rawVal || !citedRefs.length) return [];
21507
+ const isClock = clockToSeconds(rawVal) != null;
21508
+ const num = isClock ? null : statedFacts(rawVal).numbers[0] ?? null;
21509
+ if (!isClock && !num) return [];
21510
+ const hasMeta = knownRefs instanceof Map && citedRefs.some((r) => knownRefs.get(r)?.children instanceof Set);
21511
+ const refsMap = hasMeta ? knownRefs : collectFacts(sources).refs;
21512
+ const citedSet = new Set(citedRefs);
21513
+ const out = [];
21514
+ const seen = /* @__PURE__ */ new Set();
21515
+ for (const ref of citedRefs) {
21516
+ const entry = refsMap.get(ref);
21517
+ if (!entry || entry.scope !== "summary" || !(entry.children instanceof Set) || !entry.children.size) continue;
21518
+ for (const childRef of entry.children) {
21519
+ if (seen.has(childRef) || citedSet.has(childRef)) continue;
21520
+ const child = refsMap.get(childRef);
21521
+ if (!child || child.scope === "summary") continue;
21522
+ const matches = isClock ? timeInSet(child.times, rawVal) : numberInEvidence(child.numbers, num);
21523
+ if (matches) {
21524
+ seen.add(childRef);
21525
+ out.push(childRef);
21526
+ if (out.length >= 3) return out;
21527
+ }
21528
+ }
21529
+ }
21530
+ return out;
21531
+ }
21296
21532
  function verifyReview(review, sources, accepted = []) {
21297
21533
  const listOf2 = (v) => Array.isArray(v) ? v : [];
21298
21534
  const known = collectFacts(sources);
21299
21535
  for (const text of listOf2(accepted)) for (const n of statedFacts(text).numbers) if (n.counted && !n.decimal) known.summary.add(n.value);
21300
- const timeOk = (clock10) => {
21301
- const t6 = clockToSeconds(clock10);
21302
- if (t6 == null) return false;
21303
- for (let d = -CLOCK_TOLERANCE; d <= CLOCK_TOLERANCE; d += 1) if (known.times.has(t6 + d)) return true;
21304
- return false;
21305
- };
21306
- const bigOk = (n, set) => has(set, n.value, n.approx ? n.value * 0.06 : 1);
21536
+ const timeOk = (clock10) => timeInSet(known.times, clock10);
21307
21537
  const problems = [];
21308
21538
  const notes = [];
21309
21539
  const names2 = [].concat(sources ?? []).find((s) => s && typeof s === "object" && !Array.isArray(s) && s.hero_names) ?? {};
@@ -21365,23 +21595,14 @@ function verifyReview(review, sources, accepted = []) {
21365
21595
  for (const t6 of c.times) times.add(t6);
21366
21596
  for (const n of c.numbers) local.add(n);
21367
21597
  }
21368
- const inRecord = (clock10) => {
21369
- const t6 = clockToSeconds(clock10);
21370
- if (t6 == null) return false;
21371
- for (let d = -CLOCK_TOLERANCE; d <= CLOCK_TOLERANCE; d += 1) if (times.has(t6 + d)) return true;
21372
- return false;
21373
- };
21598
+ const inRecord = (clock10) => timeInSet(times, clock10);
21374
21599
  const fact = typeof e?.fact === "string" ? e.fact : "";
21375
21600
  const stated = statedFacts(fact);
21376
21601
  wording(where2, index3, fact);
21377
21602
  for (const s of sightClaims(fact)) problems.push({ where: where2, index: index3, kind: "sight", text: s });
21378
21603
  for (const c of new Set(stated.times)) if (!inRecord(c)) problems.push({ where: where2, index: index3, kind: "moment", text: `${c} (not in ${refs.join(", ")})` });
21379
21604
  for (const n of stated.numbers) {
21380
- if (n.percent) {
21381
- if (!percentOk(local, n)) problems.push({ where: where2, index: index3, kind: "moment", text: `${n.text} (not in ${refs.join(", ")})` });
21382
- } else if (n.value >= BIG) {
21383
- if (!bigOk(n, local)) problems.push({ where: where2, index: index3, kind: "moment", text: `${n.text} (not in ${refs.join(", ")})` });
21384
- } else if ((n.value > TRIVIAL || n.decimal) && !has(local, n.value, n.decimal ? 0.05 : 0.5)) problems.push({ where: where2, index: index3, kind: "moment", text: `${n.text} (not in ${refs.join(", ")})` });
21605
+ if ((n.percent || n.value >= BIG || n.value > TRIVIAL || n.decimal) && !numberInEvidence(local, n)) problems.push({ where: where2, index: index3, kind: "moment", text: `${n.text} (not in ${refs.join(", ")})` });
21385
21606
  }
21386
21607
  };
21387
21608
  prose2("verdict", 0, review?.verdict);
@@ -23057,7 +23278,7 @@ var REPAIR_HELP = {
23057
23278
  time: "this time is not in any tool result",
23058
23279
  number: "this number is not in any tool result",
23059
23280
  count: "no tool gave this count; use the count a tool states (killed_by, by_target, *_total)",
23060
- moment: "the cited record does not hold this; cite the record that does, or remove it",
23281
+ moment: "the cited record does not hold this (summary refs only cover top-level totals, not individual events); if suggested_refs are listed, verify and cite the specific child ref(s), or remove the unsupported detail",
23061
23282
  ref: "no tool record with this ref was returned in this conversation; copy a ref exactly",
23062
23283
  missing: "this finding has no title: give it a heading of a few words",
23063
23284
  language: "write this in the language of the rest of the review",
@@ -23190,6 +23411,16 @@ ${JSON.stringify(context)}`;
23190
23411
  const midRepair = from?.first && from.run ? from.run : null;
23191
23412
  if (!midRepair) save(done, null);
23192
23413
  const placeOf = (p) => p.where === "findings" ? "findings" : p.where === "game_plan" ? "game_plan" : p.where === "plan" ? `game_plan.${PLAN_TEXTS[p.index]}` : p.where === "plan_evidence" ? `game_plan.evidence ${p.index + 1}` : p.where === "story" ? `story ${p.index + 1}` : p.where === "story_evidence" ? `story ${p.index + 1}, evidence ${(p.item ?? 0) + 1}` : p.where === "highlight" ? `highlight ${p.index + 1}` : p.where === "highlight_evidence" ? `highlight ${p.index + 1}, evidence ${(p.item ?? 0) + 1}` : p.where === "chapter" ? `chapter ${p.index + 1}` : p.where === "chapter_evidence" ? `chapter ${p.index + 1}, evidence ${(p.item ?? 0) + 1}` : p.where === "finding" ? `finding ${p.index + 1}` : p.where === "title" ? `finding ${p.index + 1}, title` : p.where === "rule" ? `finding ${p.index + 1}, rule.this_game` : `${p.where}${p.where === "verdict" || p.where === "opening_note" || p.where === "encouragement" ? "" : ` ${p.index + 1}`}`;
23414
+ const repairSources = sources();
23415
+ const formatProblem = (p) => {
23416
+ const suggested = p.kind === "moment" ? suggestChildRefs(p, repairSources, check.refs) : [];
23417
+ return {
23418
+ in: placeOf(p),
23419
+ text: p.text,
23420
+ why: REPAIR_HELP[p.kind],
23421
+ ...suggested.length ? { suggested_refs: suggested } : {}
23422
+ };
23423
+ };
23193
23424
  const second = await runAgent({
23194
23425
  ...base,
23195
23426
  ...midRepair ? { resume: resumed(midRepair) } : {},
@@ -23198,7 +23429,7 @@ ${JSON.stringify(context)}`;
23198
23429
  messages: midRepair ? midRepair.messages : [...first.messages, ...first.messages.at(-1).tool_calls.map((c) => ({
23199
23430
  role: "tool",
23200
23431
  tool_call_id: c.id,
23201
- content: c === lastCall ? JSON.stringify({ error: "unsupported_facts", detail: "Look each one up with a tool, or rewrite the sentence without it, then call submit_review again with the whole review.", problems: check.problems.map((p) => ({ in: placeOf(p), text: p.text, why: REPAIR_HELP[p.kind] })) }) : JSON.stringify({ error: "not_run" })
23432
+ content: c === lastCall ? JSON.stringify({ error: "unsupported_facts", detail: "Look each one up with a tool, or rewrite the sentence without it, then call submit_review again with the whole review.", problems: check.problems.map(formatProblem) }) : JSON.stringify({ error: "not_run" })
23202
23433
  }))]
23203
23434
  });
23204
23435
  add(second);
@@ -25263,7 +25494,7 @@ function shapeReview(matchId, hero, lang, state) {
25263
25494
  ...typeof r.encouragement === "string" && r.encouragement.trim() ? { encouragement: r.encouragement } : {},
25264
25495
  blind_spots: list(r.blind_spots),
25265
25496
  checked: { against: "replay records", removed_for_lack_of_evidence: state.verification?.dropped ?? 0 },
25266
- note: "Times and numbers were checked against the replay. Quote them as given, say what the review cannot see (blind_spots), and link the url: it has every piece of evidence and a coach to ask."
25497
+ note: "Times and numbers were checked against the replay. Present in a warm, constructive coach tone (verdict + opening_note, concrete highlights, key chapters/findings, encouragement) with zero mechanical next-game KPI quotas. Quote times and numbers as given, say what the review cannot see (blind_spots), and link the url: it has every piece of evidence and a coach to ask."
25267
25498
  };
25268
25499
  }
25269
25500
  var OWN_MODEL = "To review now on your own model instead, install the dota2.ai plugin for DeepSeek Harness (DSH): https://dota2.ai/#ways-dsh";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qianhaoq/dsh-dota2ai",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "dota2.ai for DSH: standalone replay review page, DSH host-model agent, coach tools and skill",
5
5
  "icon": "./icon.svg",
6
6
  "homepage": "https://dota2.ai",