Python · 1549 bytes Raw Blame History
1 """Adversarial replay harvest — pull mode.
2
3 Post-training, `dlm harvest` reads a sway JSON report, extracts
4 failing probes with known references, and writes them back as
5 `!probe`-tagged `::instruction::` sections. The document grows to
6 contain its own weaknesses; the next retrain picks them up via the
7 existing probe-sampling path.
8
9 Public surface:
10
11 - :class:`HarvestCandidate` / :func:`read_sway_report` — pull
12 failing probes out of a sway JSON report.
13 - :func:`build_plan` / :class:`HarvestPlan` — dedup candidates
14 against the current document, materialize Sections.
15 - :func:`render_plan` — plain-text diff for ``--dry-run``.
16 - :func:`apply_plan` / :func:`revert_all_auto_harvests` — commit the
17 plan to disk (or strip auto-harvested sections on revert).
18 """
19
20 from __future__ import annotations
21
22 from dlm.harvest.applier import HarvestSummary, apply_plan, revert_all_auto_harvests
23 from dlm.harvest.diff import (
24 HarvestPlan,
25 PlannedAddition,
26 SkippedCandidate,
27 SkipReason,
28 build_plan,
29 render_plan,
30 )
31 from dlm.harvest.errors import (
32 HarvestError,
33 MalformedSwayReportError,
34 NoReferenceError,
35 )
36 from dlm.harvest.sway_reader import HarvestCandidate, read_sway_report
37
38 __all__ = [
39 "HarvestCandidate",
40 "HarvestError",
41 "HarvestPlan",
42 "HarvestSummary",
43 "MalformedSwayReportError",
44 "NoReferenceError",
45 "PlannedAddition",
46 "SkipReason",
47 "SkippedCandidate",
48 "apply_plan",
49 "build_plan",
50 "read_sway_report",
51 "render_plan",
52 "revert_all_auto_harvests",
53 ]