agent-tune-kit 2.4.2__tar.gz → 2.4.3__tar.gz

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 (195) hide show
  1. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/.codex-plugin/plugin.json +1 -1
  2. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/PKG-INFO +3 -10
  3. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/README.en.md +2 -9
  4. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/README.md +2 -9
  5. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/__init__.py +1 -1
  6. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/cli/dataset.py +14 -39
  7. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/cli/evaluation.py +9 -2
  8. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/cli/main.py +5 -5
  9. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/cli/output.py +2 -1
  10. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/cli/results.py +17 -8
  11. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/cli/trace.py +35 -12
  12. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/cli/visualize.py +9 -24
  13. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/datasets/prepare.py +9 -1
  14. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/datasets/truth.py +66 -22
  15. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/datasets/updates.py +53 -26
  16. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/datasets/validation.py +13 -6
  17. agent_tune_kit-2.4.3/agent_tune_kit/execution/__init__.py +17 -0
  18. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/execution/calibration.py +31 -7
  19. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/execution/logs.py +16 -4
  20. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/execution/rules.py +19 -2
  21. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/execution/runner.py +197 -60
  22. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/execution/runtime.py +48 -23
  23. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/execution/tracing.py +44 -56
  24. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/installer.py +51 -27
  25. agent_tune_kit-2.4.3/agent_tune_kit/models.py +1598 -0
  26. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/results/assessment.py +34 -11
  27. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/results/evidence.py +272 -80
  28. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/results/judgments.py +28 -5
  29. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/results/summary.py +63 -29
  30. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/results/versions.py +35 -17
  31. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/traces/archive.py +58 -29
  32. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/traces/capture.py +125 -25
  33. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/traces/categories.py +45 -13
  34. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/traces/langfuse.py +71 -29
  35. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/traces/migrate.py +23 -2
  36. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/traces/progress.py +16 -7
  37. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/traces/projects.py +74 -16
  38. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/traces/query.py +87 -43
  39. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/traces/records.py +200 -61
  40. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/traces/segments.py +63 -19
  41. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/traces/store.py +116 -185
  42. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/utils/csv_io.py +7 -3
  43. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/utils/files.py +8 -3
  44. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/dataset/app.js +40 -18
  45. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/dataset/styles.css +0 -2
  46. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/failures/app.js +54 -9
  47. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/failures/styles.css +0 -1
  48. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/shared/base.css +12 -0
  49. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/trace/app.js +184 -1
  50. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/trace/lanes.js +31 -0
  51. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/trace/styles.css +9 -0
  52. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/traces/app.js +70 -0
  53. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/traces/styles.css +9 -0
  54. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/dataset.py +63 -33
  55. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/failures.py +70 -32
  56. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/fields.py +7 -2
  57. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/history.py +78 -26
  58. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/render.py +2 -0
  59. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/timeline.py +71 -29
  60. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/trace.py +144 -50
  61. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/traces.py +72 -30
  62. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/docs/codex_agent_tuning_prd.md +1 -1
  63. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/docs/shared-versioning-and-confirmation.md +5 -7
  64. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/docs/skill-template-pack-usage.md +12 -41
  65. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/docs/trace-tuning.md +2 -2
  66. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/pyproject.toml +8 -2
  67. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/scripts/check-release.py +39 -22
  68. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/scripts/publish-release.py +11 -15
  69. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/scripts/release-version.py +4 -0
  70. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/scripts/validate_skill_pack.py +17 -18
  71. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/skills/atk-dataset/SKILL.md +0 -1
  72. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/skills/atk-init/SKILL.md +1 -1
  73. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/skills/atk-trace-verify/SKILL.md +10 -1
  74. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/templates/.atk/runner/eval_runner.py.md +4 -2
  75. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/templates/.atk/runner/failure_rule.py.md +3 -2
  76. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/templates/.atk/runner/import_evidence.py.md +2 -2
  77. agent_tune_kit-2.4.3/tests/fixtures/legacy_trace/captures/CAP-001/manifest.json +1 -0
  78. agent_tune_kit-2.4.3/tests/fixtures/legacy_trace/captures/CAP-001/raw/export.json +1 -0
  79. agent_tune_kit-2.4.3/tests/fixtures/legacy_trace/session.json +1 -0
  80. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/fixtures/managed_v1.py.md +3 -2
  81. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_assessment_contract.py +4 -11
  82. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_dataset_updates.py +18 -27
  83. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_diagnosis.py +12 -15
  84. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_evidence_import.py +2 -6
  85. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_execution_evidence.py +1 -2
  86. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_execution_tracing.py +10 -24
  87. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_generate_dataset_browser.py +4 -14
  88. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_generate_failure_browser.py +3 -15
  89. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_install_plugin.py +17 -30
  90. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_judge_calibration.py +1 -6
  91. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_plugin_cache.py +2 -12
  92. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_release_scripts.py +3 -2
  93. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_runtime_contracts.py +1 -2
  94. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_trace_capture.py +16 -17
  95. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_trace_categories.py +7 -4
  96. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_trace_cli.py +58 -17
  97. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_trace_langfuse.py +0 -9
  98. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_trace_projects.py +37 -11
  99. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_trace_records.py +24 -10
  100. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_trace_scroll_layout.py +5 -7
  101. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_trace_store.py +33 -31
  102. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_truth_cli.py +1 -2
  103. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_truth_contract.py +1 -4
  104. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_visualize_trace.py +6 -5
  105. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_visualize_traces.py +6 -5
  106. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/trace-projects.cjs +14 -0
  107. agent_tune_kit-2.4.3/tests/trace_fixtures.py +67 -0
  108. agent_tune_kit-2.4.2/agent_tune_kit/execution/__init__.py +0 -13
  109. agent_tune_kit-2.4.2/docs/assets/arch-en.png +0 -0
  110. agent_tune_kit-2.4.2/docs/assets/arch.png +0 -0
  111. agent_tune_kit-2.4.2/docs/assets/architecture.en.svg +0 -86
  112. agent_tune_kit-2.4.2/docs/assets/architecture.svg +0 -86
  113. agent_tune_kit-2.4.2/docs/ato-atk-project-boundary-recommendation-2026-11-05.md +0 -98
  114. agent_tune_kit-2.4.2/docs/cli-skill-modularization-plan.md +0 -599
  115. agent_tune_kit-2.4.2/docs/execution-evidence-and-tracing-plan.md +0 -902
  116. agent_tune_kit-2.4.2/docs/ground-truth-and-grading-assessment-2026-10-25.md +0 -405
  117. agent_tune_kit-2.4.2/docs/surginame-atk-capability-review-2026-10-27.md +0 -51
  118. agent_tune_kit-2.4.2/docs/trace-change-verification-readability-diagnosis.md +0 -124
  119. agent_tune_kit-2.4.2/docs/trace-dashboard-design.md +0 -339
  120. agent_tune_kit-2.4.2/docs/trace-swimlane-design.md +0 -150
  121. agent_tune_kit-2.4.2/docs/trace-tuning-validation.md +0 -97
  122. agent_tune_kit-2.4.2/scripts/dev-refresh-install.sh +0 -9
  123. agent_tune_kit-2.4.2/scripts/install_plugin.py +0 -26
  124. agent_tune_kit-2.4.2/scripts/publish-pypi.sh +0 -9
  125. agent_tune_kit-2.4.2/skills/atk-dataset/scripts/update_dataset.py +0 -18
  126. agent_tune_kit-2.4.2/skills/atk-visualize-dataset/scripts/generate_dataset_browser.py +0 -18
  127. agent_tune_kit-2.4.2/skills/atk-visualize-failures/scripts/generate_failure_browser.py +0 -18
  128. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/.gitignore +0 -0
  129. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/cli/__init__.py +0 -0
  130. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/cli/__main__.py +0 -0
  131. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/datasets/__init__.py +0 -0
  132. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/errors.py +0 -0
  133. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/results/__init__.py +0 -0
  134. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/traces/__init__.py +0 -0
  135. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/utils/__init__.py +0 -0
  136. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/__init__.py +0 -0
  137. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/dataset/page.html +0 -0
  138. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/dataset/vendor/echarts.min.js +0 -0
  139. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/failures/page.html +0 -0
  140. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/trace/page.html +0 -0
  141. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/trace/vendor/markdown-it.LICENSE +0 -0
  142. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/trace/vendor/markdown-it.min.js +0 -0
  143. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/visualize/assets/traces/page.html +0 -0
  144. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/agent_tune_kit/workspace.py +0 -0
  145. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/docs/assets/agent_tune_kit_evaluation.png +0 -0
  146. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/docs/assets/agent_tune_kit_trace.png +0 -0
  147. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/docs/local-context.md +0 -0
  148. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/docs/trace-project-attribution-design.md +0 -0
  149. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/docs/truth-and-assessment.md +0 -0
  150. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/scripts/release-version.sh +0 -0
  151. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/skills/atk-diagnose/SKILL.md +0 -0
  152. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/skills/atk-eval/SKILL.md +0 -0
  153. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/skills/atk-optimize/SKILL.md +0 -0
  154. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/skills/atk-report/SKILL.md +0 -0
  155. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/skills/atk-trace-capture/SKILL.md +0 -0
  156. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/skills/atk-trace-detect/SKILL.md +0 -0
  157. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/skills/atk-trace-diagnose/SKILL.md +0 -0
  158. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/skills/atk-trace-init/SKILL.md +0 -0
  159. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/skills/atk-trace-optimize/SKILL.md +0 -0
  160. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/skills/atk-visualize-dataset/SKILL.md +0 -0
  161. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/skills/atk-visualize-failures/SKILL.md +0 -0
  162. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/skills/atk-visualize-trace/SKILL.md +0 -0
  163. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/templates/.gitkeep +0 -0
  164. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/__init__.py +0 -0
  165. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/conftest.py +0 -0
  166. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/fixtures/legacy_eval_runner.py.txt +0 -0
  167. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_atk_init_contract.py +0 -0
  168. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_cli_workflow.py +0 -0
  169. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_evidence_judgments.py +0 -0
  170. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_evidence_packaging.py +0 -0
  171. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_evidence_versions.py +0 -0
  172. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_execution_outcomes.py +0 -0
  173. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_local_context.py +0 -0
  174. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_runner_output_columns.py +0 -0
  175. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_runner_template_row_logging.py +0 -0
  176. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_snapshot_reads.py +0 -0
  177. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_trace_event_list.py +0 -0
  178. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_trace_progress.py +0 -0
  179. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_trace_query.py +0 -0
  180. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_trace_segments.py +0 -0
  181. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_truth_browser.py +0 -0
  182. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_truth_runner.py +0 -0
  183. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/test_v2_progress.py +0 -0
  184. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/trace-controls.cjs +0 -0
  185. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/trace-dashboard.cjs +0 -0
  186. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/trace-event-detail.cjs +0 -0
  187. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/trace-event-layout.cjs +0 -0
  188. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/trace-event-list.cjs +0 -0
  189. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/trace-event-wheel.cjs +0 -0
  190. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/trace-fragments.cjs +0 -0
  191. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/trace-issue-cards.cjs +0 -0
  192. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/trace-preview-scroll.cjs +0 -0
  193. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/trace-scroll-layout.cjs +0 -0
  194. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/trace-selection-reason.cjs +0 -0
  195. {agent_tune_kit-2.4.2 → agent_tune_kit-2.4.3}/tests/trace-stage-cards.cjs +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-tune-kit",
3
- "version": "2.4.2",
3
+ "version": "2.4.3",
4
4
  "description": "Local Codex plugin for batch Agent evaluation and session trace tuning with evidence-backed issues, focused changes, verification and offline review.",
5
5
  "author": {
6
6
  "name": "hustyichi",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: agent-tune-kit
3
- Version: 2.4.2
3
+ Version: 2.4.3
4
4
  Summary: Local Codex plugin for iterative Agent tuning with guided Skills, reusable runner templates, versioned results, and static validation.
5
5
  Project-URL: Homepage, https://github.com/hustyichi/agent-tune-kit
6
6
  Project-URL: Repository, https://github.com/hustyichi/agent-tune-kit
@@ -25,7 +25,7 @@ Agent Tune Kit is a **local Codex plugin** for tuning an Agent's prompts, code,
25
25
 
26
26
  ## Install and Enable
27
27
 
28
- Run these commands in your terminal to install ATK and its bundled Skills.
28
+ Run these commands in your terminal to install ATK from PyPI and set up its bundled Skills.
29
29
 
30
30
  ```sh
31
31
  uv tool install agent-tune-kit
@@ -35,14 +35,7 @@ atk install
35
35
  In Codex, enter `/plugins`, select and enable `Agent Tune Kit`, then restart Codex and open a new session.
36
36
 
37
37
  <details>
38
- <summary>Install with pipx or from local source</summary>
39
-
40
- To install with pipx, run the following commands.
41
-
42
- ```sh
43
- pipx install agent-tune-kit
44
- atk install
45
- ```
38
+ <summary>Install from local source</summary>
46
39
 
47
40
  To install from local source, update your chosen branch and run these commands from the **ATK repository root**. Rerun them after source updates, including when the version stays the same.
48
41
 
@@ -11,7 +11,7 @@ Agent Tune Kit is a **local Codex plugin** for tuning an Agent's prompts, code,
11
11
 
12
12
  ## Install and Enable
13
13
 
14
- Run these commands in your terminal to install ATK and its bundled Skills.
14
+ Run these commands in your terminal to install ATK from PyPI and set up its bundled Skills.
15
15
 
16
16
  ```sh
17
17
  uv tool install agent-tune-kit
@@ -21,14 +21,7 @@ atk install
21
21
  In Codex, enter `/plugins`, select and enable `Agent Tune Kit`, then restart Codex and open a new session.
22
22
 
23
23
  <details>
24
- <summary>Install with pipx or from local source</summary>
25
-
26
- To install with pipx, run the following commands.
27
-
28
- ```sh
29
- pipx install agent-tune-kit
30
- atk install
31
- ```
24
+ <summary>Install from local source</summary>
32
25
 
33
26
  To install from local source, update your chosen branch and run these commands from the **ATK repository root**. Rerun them after source updates, including when the version stays the same.
34
27
 
@@ -11,7 +11,7 @@ Agent Tune Kit 是一个**本地 Codex 插件**,用于调优 Agent 的提示
11
11
 
12
12
  ## 安装与启用
13
13
 
14
- 在终端运行以下命令安装 ATK 和配套 Skills。
14
+ 在终端运行以下命令,从 PyPI 安装 ATK,再安装配套 Skills。
15
15
 
16
16
  ```sh
17
17
  uv tool install agent-tune-kit
@@ -21,14 +21,7 @@ atk install
21
21
  在 Codex 中输入 `/plugins`,选择并启用 `Agent Tune Kit`,然后重启 Codex 并新建会话。
22
22
 
23
23
  <details>
24
- <summary>使用 pipx 或本地源码安装</summary>
25
-
26
- 用 pipx 安装。
27
-
28
- ```sh
29
- pipx install agent-tune-kit
30
- atk install
31
- ```
24
+ <summary>从本地源码安装</summary>
32
25
 
33
26
  从本地源码安装时,先更新所需分支,再在 **ATK 仓库根目录**运行以下命令。更新源码后可重新执行,包括版本号未变的情况。
34
27
 
@@ -1,3 +1,3 @@
1
1
  """Agent Tune Kit package."""
2
2
 
3
- __version__ = "2.4.2"
3
+ __version__ = "2.4.3"
@@ -1,9 +1,14 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ from collections.abc import Mapping
5
+ from typing import Any
6
+
1
7
  from agent_tune_kit import datasets
2
- from agent_tune_kit.datasets import updates
3
8
  from agent_tune_kit.workspace import DATASET_PATH
4
9
 
5
10
 
6
- def add_options(parser):
11
+ def add_options(parser: argparse.ArgumentParser) -> None:
7
12
  parser.add_argument("--dataset-path", default=str(DATASET_PATH))
8
13
  parser.add_argument("--field", default="ground_truth")
9
14
  parser.add_argument("--input-fields", nargs="+")
@@ -14,10 +19,11 @@ def add_options(parser):
14
19
  parser.add_argument("--json", action="store_true")
15
20
 
16
21
 
17
- def register(subparsers):
22
+ def register(subparsers: argparse._SubParsersAction[argparse.ArgumentParser]) -> None:
18
23
  commands = subparsers.add_parser("dataset", help="prepare, inspect and update evaluation data").add_subparsers(
19
24
  dest="action", required=True
20
25
  )
26
+
21
27
  prepare = commands.add_parser("prepare")
22
28
  prepare.add_argument("--source", required=True)
23
29
  prepare.add_argument("--dataset-path", default=str(DATASET_PATH))
@@ -25,16 +31,19 @@ def register(subparsers):
25
31
  mode.add_argument("--append", action="store_true")
26
32
  mode.add_argument("--overwrite", action="store_true")
27
33
  prepare.add_argument("--json", action="store_true")
34
+
28
35
  add_options(commands.add_parser("inspect"))
36
+
29
37
  update = commands.add_parser("update")
30
38
  add_options(update)
31
39
  update.add_argument("--updates-path")
32
40
 
33
41
 
34
- def execute(args):
42
+ def execute(args: argparse.Namespace) -> Mapping[str, object]:
35
43
  if args.action == "prepare":
36
44
  return datasets.prepare_dataset(args.source, args.dataset_path, append=args.append, overwrite=args.overwrite)
37
- options = dict(
45
+
46
+ options: dict[str, Any] = dict(
38
47
  dataset_path=args.dataset_path,
39
48
  direct=args.direct,
40
49
  review_path=args.review_path,
@@ -45,37 +54,3 @@ def execute(args):
45
54
  if args.action == "inspect":
46
55
  return datasets.inspect_dataset(**options)
47
56
  return datasets.update_dataset(args.updates_path, **options)
48
-
49
-
50
- def legacy_main(argv=None):
51
- import argparse
52
- import json
53
- import sys
54
-
55
- parser = argparse.ArgumentParser()
56
- add_options(parser)
57
- parser.add_argument("--updates-path")
58
- parser.add_argument("--dump-context", action="store_true")
59
- args = parser.parse_args(argv)
60
- options = dict(
61
- dataset_path=args.dataset_path,
62
- direct=args.direct,
63
- review_path=args.review_path,
64
- field=args.field,
65
- home_dir=args.home_dir,
66
- input_fields=args.input_fields,
67
- )
68
- try:
69
- if args.dump_context or not args.updates_path:
70
- print(json.dumps(datasets.inspect_dataset(**options), ensure_ascii=False, indent=2))
71
- if args.updates_path:
72
- from .output import emit
73
-
74
- emit(datasets.update_dataset(args.updates_path, **options))
75
- return 0
76
- except updates.UserActionRequired as exc:
77
- print(str(exc), file=sys.stderr)
78
- return 2
79
- except Exception as exc:
80
- print(f"Unexpected error: {exc}", file=sys.stderr)
81
- return 1
@@ -1,21 +1,28 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+
1
5
  from agent_tune_kit.execution import run_evaluation
6
+ from agent_tune_kit.models import EvaluationResult
2
7
 
3
8
 
4
- def register(subparsers):
9
+ def register(subparsers: argparse._SubParsersAction[argparse.ArgumentParser]) -> None:
5
10
  parser = subparsers.add_parser("eval", help="run the project Agent with the shared engine")
6
11
  parser.add_argument("--check", action="store_true")
7
12
  parser.add_argument("--limit", type=int)
8
13
  parser.add_argument("--offset", type=int, default=0)
9
14
  parser.add_argument("--concurrency", type=int, default=1)
15
+
10
16
  selection = parser.add_mutually_exclusive_group()
11
17
  selection.add_argument("--only-failures", action="store_true")
12
18
  selection.add_argument("--ids", nargs="+", help="select canonical samples by stable atk_id before offset/limit")
19
+
13
20
  parser.add_argument("--no-progress", action="store_true")
14
21
  parser.add_argument("--python")
15
22
  parser.add_argument("--json", action="store_true")
16
23
 
17
24
 
18
- def execute(args):
25
+ def execute(args: argparse.Namespace) -> EvaluationResult:
19
26
  return run_evaluation(
20
27
  **{
21
28
  key: getattr(args, key)
@@ -1,7 +1,10 @@
1
1
  """Public command dispatch; business behavior lives in domain packages."""
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import argparse
4
6
  import sys
7
+ from collections.abc import Sequence
5
8
 
6
9
  from agent_tune_kit import installer
7
10
  from agent_tune_kit.errors import UserActionRequired
@@ -13,12 +16,8 @@ from .output import emit
13
16
  HANDLERS = {"dataset": dataset, "eval": evaluation, "results": results, "visualize": visualize, "trace": trace}
14
17
 
15
18
 
16
- def main(argv=None):
19
+ def main(argv: Sequence[str] | None = None) -> int:
17
20
  argv = list(sys.argv[1:] if argv is None else argv)
18
- if argv and argv[0] == "_legacy":
19
- if argv[1] == "atk-dataset":
20
- return dataset.legacy_main(argv[2:])
21
- return visualize.legacy_main("dataset" if argv[1] == "atk-visualize-dataset" else "failures", argv[2:])
22
21
  if not argv or argv[0] not in HANDLERS:
23
22
  if argv and argv[0] in ["-h", "--help"]:
24
23
  parser = argparse.ArgumentParser(description="Register Agent Tune Kit and run shared project capabilities")
@@ -30,6 +29,7 @@ def main(argv=None):
30
29
  parser.print_help()
31
30
  return 0
32
31
  return installer.main(argv)
32
+
33
33
  parser = argparse.ArgumentParser(prog="atk")
34
34
  subparsers = parser.add_subparsers(dest="command", required=True)
35
35
  for module in HANDLERS.values():
@@ -1,7 +1,8 @@
1
1
  import json
2
+ from collections.abc import Mapping
2
3
 
3
4
 
4
- def emit(result, json_output=False):
5
+ def emit(result: Mapping[str, object], json_output: bool = False) -> None:
5
6
  if json_output:
6
7
  print(json.dumps(result, ensure_ascii=False))
7
8
  else:
@@ -1,11 +1,19 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ from collections.abc import Mapping
5
+
1
6
  from agent_tune_kit import results
2
7
  from agent_tune_kit.execution import run_rule
8
+ from agent_tune_kit.execution.calibration import launch_calibration
9
+ from agent_tune_kit.results.evidence import import_evidence, query_evidence
3
10
 
4
11
 
5
- def register(subparsers):
12
+ def register(subparsers: argparse._SubParsersAction[argparse.ArgumentParser]) -> None:
6
13
  commands = subparsers.add_parser("results", help="inspect and judge versioned results").add_subparsers(
7
14
  dest="action", required=True
8
15
  )
16
+
9
17
  calibration = commands.add_parser(
10
18
  "calibrate", help="check a judge against reviewed outputs without running the Agent"
11
19
  )
@@ -18,12 +26,14 @@ def register(subparsers):
18
26
  calibration.add_argument("--instructions")
19
27
  calibration.add_argument("--python")
20
28
  calibration.add_argument("--json", action="store_true")
29
+
21
30
  for name in ["inspect", "run-rule", "apply-judgments", "compare", "evidence", "import-evidence"]:
22
31
  parser = commands.add_parser(name)
23
32
  parser.add_argument("--results-dir", default=".atk/results")
24
33
  parser.add_argument("--json", action="store_true")
25
34
  if name != "import-evidence":
26
35
  parser.add_argument("--version")
36
+
27
37
  if name == "run-rule":
28
38
  parser.add_argument("--rule-path", default=".atk/runner/failure_rule.py")
29
39
  parser.add_argument("--python")
@@ -46,10 +56,8 @@ def register(subparsers):
46
56
  parser.add_argument("--limit", type=int)
47
57
 
48
58
 
49
- def execute(args):
59
+ def execute(args: argparse.Namespace) -> Mapping[str, object]:
50
60
  if args.action == "calibrate":
51
- from agent_tune_kit.execution.calibration import launch_calibration
52
-
53
61
  return launch_calibration(
54
62
  **{
55
63
  key: getattr(args, key)
@@ -64,13 +72,11 @@ def execute(args):
64
72
  )
65
73
  }
66
74
  )
67
- if args.action == "import-evidence":
68
- from agent_tune_kit.results.evidence import import_evidence
69
75
 
76
+ if args.action == "import-evidence":
70
77
  return import_evidence(args.source, args.adapter, args.results_dir)
71
- if args.action == "evidence":
72
- from agent_tune_kit.results.evidence import query_evidence
73
78
 
79
+ if args.action == "evidence":
74
80
  return query_evidence(
75
81
  **{
76
82
  key: getattr(args, key)
@@ -88,12 +94,15 @@ def execute(args):
88
94
  ]
89
95
  }
90
96
  )
97
+
91
98
  if args.action == "inspect":
92
99
  return results.inspect_results(args.results_dir, version=args.version)
93
100
  if args.action == "compare":
94
101
  return results.compare_targets(args.ids, args.results_dir, version=args.version)
102
+
95
103
  if args.action == "apply-judgments":
96
104
  return results.apply_judgments(
97
105
  args.judgments_path, source_results=args.source_results, results_dir=args.results_dir, version=args.version
98
106
  )
107
+
99
108
  return run_rule(rule_path=args.rule_path, results_dir=args.results_dir, python=args.python, version=args.version)
@@ -1,14 +1,22 @@
1
1
  """Explicit session commands; analysis and effect judgments belong to the host."""
2
2
 
3
+ from __future__ import annotations
4
+
5
+ import argparse
3
6
  import json
7
+ from collections.abc import Mapping
4
8
  from pathlib import Path
9
+ from typing import Any, cast
5
10
 
11
+ from agent_tune_kit.models import IssueUpdate, PathInput
6
12
  from agent_tune_kit.traces import categories, records, store
7
13
  from agent_tune_kit.traces.capture import fetch_session, import_session
14
+ from agent_tune_kit.traces.migrate import migrate
15
+ from agent_tune_kit.traces.projects import discover_projects, load_projects, save_project
8
16
  from agent_tune_kit.traces.query import overview, search, show
9
17
 
10
18
 
11
- def read_json(path):
19
+ def read_json(path: PathInput | None) -> dict[str, Any] | None:
12
20
  if path is None:
13
21
  return None
14
22
  value = json.loads(Path(path).read_text(encoding="utf-8"))
@@ -17,23 +25,25 @@ def read_json(path):
17
25
  return value
18
26
 
19
27
 
20
- def add_session_options(parser):
28
+ def add_session_options(parser: argparse.ArgumentParser) -> None:
21
29
  parser.add_argument("--project-root", default=".")
22
30
  parser.add_argument("--session-id", required=True)
23
31
  parser.add_argument("--source", help="JSON file with type, instance, project and environment")
24
32
  parser.add_argument("--json", action="store_true")
25
33
 
26
34
 
27
- def register(subparsers):
35
+ def register(subparsers: argparse._SubParsersAction[argparse.ArgumentParser]) -> None:
28
36
  commands = subparsers.add_parser(
29
37
  "trace", help="capture and investigate one session, independently of batch evaluation"
30
38
  )
31
39
  actions = commands.add_subparsers(dest="action", required=True)
40
+
32
41
  init = actions.add_parser("init", help="save project context and non-secret source configuration")
33
42
  init.add_argument("--project-root", default=".")
34
43
  init.add_argument("--config", help="non-secret configuration JSON file")
35
44
  init.add_argument("--project-file", help="project context Markdown file")
36
45
  init.add_argument("--json", action="store_true")
46
+
37
47
  project = actions.add_parser("project", help="discover, list or update workspace projects")
38
48
  project.add_argument("--project-root", default=".")
39
49
  mode = project.add_mutually_exclusive_group(required=True)
@@ -41,12 +51,14 @@ def register(subparsers):
41
51
  mode.add_argument("--list", action="store_true")
42
52
  mode.add_argument("--data")
43
53
  project.add_argument("--json", action="store_true")
54
+
44
55
  category = actions.add_parser("category", help="list or update the project issue category vocabulary")
45
56
  category.add_argument("--project-root", default=".")
46
57
  mode = category.add_mutually_exclusive_group(required=True)
47
58
  mode.add_argument("--list", action="store_true", help="list categories with per-session issue counts")
48
59
  mode.add_argument("--data", help="category JSON; revising the vocabulary requires its current revision")
49
60
  category.add_argument("--json", action="store_true")
61
+
50
62
  for action in [
51
63
  "migrate",
52
64
  "fetch",
@@ -110,33 +122,34 @@ def register(subparsers):
110
122
  parser.add_argument("--expected-revision", type=int)
111
123
 
112
124
 
113
- def execute(args):
125
+ def execute(args: argparse.Namespace) -> Mapping[str, object]:
114
126
  if args.action == "project":
115
- from agent_tune_kit.traces.projects import discover_projects, load_projects, save_project
116
-
117
127
  if args.discover:
118
128
  return discover_projects(args.project_root)
119
129
  if args.list:
120
130
  return load_projects(store.trace_root(args.project_root))
121
131
  return save_project(args.project_root, read_json(args.data))
132
+
122
133
  if args.action == "init":
123
134
  text = Path(args.project_file).read_text(encoding="utf-8") if args.project_file else None
124
135
  return store.init_workspace(args.project_root, config=read_json(args.config), project_text=text)
136
+
125
137
  if args.action == "category":
126
138
  if args.list:
127
139
  return categories.list_categories(args.project_root)
128
140
  return categories.save_category(args.project_root, read_json(args.data))
141
+
129
142
  source = read_json(args.source)
130
143
  if args.action == "migrate":
131
- from agent_tune_kit.traces.migrate import migrate
132
-
133
144
  return migrate(args.project_root, args.session_id, source)
145
+
134
146
  if args.action == "fetch":
135
147
  config = read_json(args.config)
136
148
  if source is not None:
137
149
  if config is None:
138
- config = read_json(Path(args.project_root) / ".atk/traces/config.json")
150
+ config = cast(dict[str, Any], read_json(Path(args.project_root) / ".atk/traces/config.json"))
139
151
  config = {**config, "source": source}
152
+
140
153
  return fetch_session(
141
154
  args.project_root,
142
155
  args.session_id,
@@ -145,10 +158,12 @@ def execute(args):
145
158
  to_time=args.to_time,
146
159
  retention=read_json(args.retention),
147
160
  )
161
+
148
162
  if args.action == "import":
149
163
  if source is None:
150
- config = read_json(Path(args.project_root) / ".atk/traces/config.json")
164
+ config = cast(dict[str, Any], read_json(Path(args.project_root) / ".atk/traces/config.json"))
151
165
  source = config.get("source")
166
+
152
167
  return import_session(
153
168
  args.project_root,
154
169
  args.session_id,
@@ -157,21 +172,26 @@ def execute(args):
157
172
  association=read_json(args.association),
158
173
  retention=read_json(args.retention),
159
174
  )
175
+
160
176
  session_dir = store.resolve_session(args.project_root, args.session_id, source)
161
177
  if args.action in {"overview", "search", "show"}:
162
- options = {"offset": args.offset, "limit": args.limit}
178
+ options: dict[str, Any] = {"offset": args.offset, "limit": args.limit}
163
179
  if args.action == "show":
164
180
  return show(session_dir, read_json(args.ref), **options)
181
+
165
182
  options["capture_id"] = args.capture_id
166
183
  if args.action == "search":
167
184
  return search(session_dir, args.text, **options)
185
+
168
186
  if getattr(args, "trace_id", None):
169
187
  options["trace_id"] = args.trace_id
170
188
  return overview(session_dir, **options)
189
+
171
190
  if args.action == "status":
172
191
  return records.status(session_dir)
173
192
  if args.action == "ref":
174
193
  return store.evidence_ref(session_dir, args.path, args.pointer)
194
+
175
195
  if args.action == "diagnose":
176
196
  return records.save_diagnosis(
177
197
  session_dir,
@@ -180,11 +200,14 @@ def execute(args):
180
200
  diagnosis_id=args.diagnosis_id,
181
201
  expected_revision=args.expected_revision,
182
202
  )
203
+
183
204
  data = read_json(args.data)
184
205
  if args.action == "issue":
185
- return records.save_issue(session_dir, data, dry_run=bool(getattr(args, "dry_run", False)))
206
+ # prepare_issue validates the command's raw input without rewriting it.
207
+ return records.save_issue(session_dir, cast(IssueUpdate, data), dry_run=bool(getattr(args, "dry_run", False)))
186
208
  if args.action == "detect":
187
209
  return records.save_detection(session_dir, data)
210
+
188
211
  if args.action == "change":
189
212
  return records.save_change(session_dir, args.issue_id, data)
190
213
  return records.save_verification(session_dir, args.issue_id, args.change_id, data)
@@ -1,21 +1,23 @@
1
+ from __future__ import annotations
2
+
1
3
  import argparse
2
- import sys
4
+ from typing import Any
3
5
 
4
- from agent_tune_kit.errors import UserActionRequired
6
+ from agent_tune_kit.models import VisualizationResult
5
7
  from agent_tune_kit.visualize import generate_dataset, generate_failures
6
8
  from agent_tune_kit.visualize.trace import generate_trace
7
9
  from agent_tune_kit.visualize.traces import generate_traces
8
10
 
9
- from .output import emit
10
11
  from .trace import add_session_options, read_json
11
12
 
12
13
 
13
- def add_options(parser, kind):
14
+ def add_options(parser: argparse.ArgumentParser, kind: str) -> None:
14
15
  parser.add_argument("--overwrite", action="store_true")
15
16
  parser.add_argument("--open", dest="open_browser", action="store_true", default=True)
16
17
  parser.add_argument("--no-open", dest="open_browser", action="store_false")
17
18
  if kind != "trace":
18
19
  parser.add_argument("--json", action="store_true")
20
+
19
21
  if kind == "dataset":
20
22
  parser.add_argument("--dataset-path", default=".atk/datasets/dataset.csv")
21
23
  elif kind == "traces":
@@ -30,7 +32,7 @@ def add_options(parser, kind):
30
32
  parser.add_argument("--no-history", action="store_true")
31
33
 
32
34
 
33
- def register(subparsers):
35
+ def register(subparsers: argparse._SubParsersAction[argparse.ArgumentParser]) -> None:
34
36
  commands = subparsers.add_parser("visualize", help="generate offline review pages").add_subparsers(
35
37
  dest="action", required=True
36
38
  )
@@ -39,8 +41,8 @@ def register(subparsers):
39
41
  add_options(commands.add_parser(kind, help=helps.get(kind)), kind)
40
42
 
41
43
 
42
- def execute(args):
43
- options = dict(overwrite=args.overwrite, open_browser=args.open_browser)
44
+ def execute(args: argparse.Namespace) -> VisualizationResult:
45
+ options: dict[str, Any] = dict(overwrite=args.overwrite, open_browser=args.open_browser)
44
46
  if args.action == "dataset":
45
47
  return generate_dataset(args.dataset_path, **options)
46
48
  if args.action == "traces":
@@ -56,20 +58,3 @@ def execute(args):
56
58
  return generate_failures(
57
59
  args.results_dir, no_report=args.no_report, no_history=args.no_history, version=args.version, **options
58
60
  )
59
-
60
-
61
- def legacy_main(kind, argv=None):
62
- parser = argparse.ArgumentParser()
63
- add_options(parser, kind)
64
- args = parser.parse_args(argv)
65
- args.action = kind
66
- try:
67
- result = execute(args)
68
- emit(result)
69
- return 0
70
- except UserActionRequired as exc:
71
- print(str(exc), file=sys.stderr)
72
- return 2
73
- except Exception as exc:
74
- print(f"Unexpected HTML generation error: {exc}", file=sys.stderr)
75
- return 1
@@ -1,6 +1,7 @@
1
1
  from pathlib import Path
2
2
 
3
3
  from agent_tune_kit.errors import UserActionRequired
4
+ from agent_tune_kit.models import DatasetPrepareResult
4
5
  from agent_tune_kit.utils.csv_io import parse_csv, write_csv_atomic
5
6
  from agent_tune_kit.workspace import DATASET_PATH
6
7
 
@@ -8,32 +9,39 @@ from .truth import TRUTH_FIELD
8
9
  from .validation import validate_dataset_rows
9
10
 
10
11
 
11
- def prepare_dataset(source, dataset_path=DATASET_PATH, *, append=False, overwrite=False):
12
+ def prepare_dataset(
13
+ source: str | Path, dataset_path: str | Path = DATASET_PATH, *, append: bool = False, overwrite: bool = False
14
+ ) -> DatasetPrepareResult:
12
15
  source, target = Path(source), Path(dataset_path)
13
16
  fields, rows = parse_csv(source)
14
17
  old_fields, old_rows = parse_csv(target) if target.exists() else ([], [])
15
18
  if append and not target.exists():
16
19
  raise UserActionRequired("Append requires an existing canonical dataset.")
20
+
17
21
  if append:
18
22
  validate_dataset_rows(old_fields, old_rows)
19
23
  if set(fields) - {"atk_id", TRUTH_FIELD} != set(old_fields) - {"atk_id", TRUTH_FIELD}:
20
24
  raise UserActionRequired("Append fields differ; confirm the field mapping before appending.")
21
25
  if TRUTH_FIELD in fields and TRUTH_FIELD not in old_fields:
22
26
  old_fields = old_fields + [TRUTH_FIELD]
27
+
23
28
  if "atk_id" not in fields:
24
29
  fields = fields + ["atk_id"]
25
30
  start = max((int(row["atk_id"]) for row in old_rows), default=0) + 1 if append else 1
26
31
  for index, row in enumerate(rows, start):
27
32
  row["atk_id"] = str(index)
33
+
28
34
  validate_dataset_rows(fields, rows)
29
35
  if append:
30
36
  fields, rows = old_fields, old_rows + rows
31
37
  validate_dataset_rows(fields, rows)
38
+
32
39
  if old_fields == fields and old_rows == rows:
33
40
  return {"dataset": str(target), "rows": len(rows), "reused": True}
34
41
  if target.exists() and not (append or overwrite):
35
42
  raise UserActionRequired(
36
43
  f"Refusing to overwrite different canonical content: {target}; confirm and use --overwrite."
37
44
  )
45
+
38
46
  write_csv_atomic(target, fields, rows)
39
47
  return {"dataset": str(target), "rows": len(rows), "reused": False}