@elizaos/sweagent-root 2.0.0-alpha

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 (323) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +270 -0
  3. package/package.json +71 -0
  4. package/python/LICENSE +21 -0
  5. package/python/config/README.md +15 -0
  6. package/python/config/bash_only.yaml +222 -0
  7. package/python/config/benchmarks/250212_sweagent_heavy_sbl.yaml +188 -0
  8. package/python/config/benchmarks/250225_anthropic_filemap_simple_review.yaml +75 -0
  9. package/python/config/benchmarks/250522_anthropic_filemap_simple_review.yaml +92 -0
  10. package/python/config/benchmarks/250526_anthropic_filemap_simple_review_sbl.yaml +93 -0
  11. package/python/config/benchmarks/anthropic_filemap_multilingual.yaml +66 -0
  12. package/python/config/coding_challenge.yaml +104 -0
  13. package/python/config/default.yaml +69 -0
  14. package/python/config/default_backticks.yaml +69 -0
  15. package/python/config/default_mm_no_images.yaml +82 -0
  16. package/python/config/default_mm_with_images.yaml +83 -0
  17. package/python/config/demo/default.yaml +80 -0
  18. package/python/config/demo/no_instructions.yaml +69 -0
  19. package/python/config/demo/only_bash.yaml +60 -0
  20. package/python/config/exotic/default_shell.yaml +52 -0
  21. package/python/config/exotic/windowed_replace.yaml +125 -0
  22. package/python/config/exotic/windowed_replace_late_repro.yaml +127 -0
  23. package/python/config/human/human.yaml +24 -0
  24. package/python/config/human/human_demo.yaml +52 -0
  25. package/python/config/sweagent_0_7/07.yaml +101 -0
  26. package/python/config/sweagent_0_7/07_fcalling.yaml +100 -0
  27. package/python/config/sweagent_0_7/07_from_url.yaml +114 -0
  28. package/python/config/sweagent_0_7/07_thought_action.yaml +102 -0
  29. package/python/config/sweagent_0_7/07_thought_action_xml.yaml +96 -0
  30. package/python/mlc_config.json +44 -0
  31. package/python/pyproject.toml +262 -0
  32. package/python/sweagent/__init__.py +114 -0
  33. package/python/sweagent/__main__.py +4 -0
  34. package/python/sweagent/agent/__init__.py +0 -0
  35. package/python/sweagent/agent/action_sampler.py +317 -0
  36. package/python/sweagent/agent/agents.py +1294 -0
  37. package/python/sweagent/agent/extra/shell_agent.py +106 -0
  38. package/python/sweagent/agent/history_processors.py +399 -0
  39. package/python/sweagent/agent/hooks/__init__.py +0 -0
  40. package/python/sweagent/agent/hooks/abstract.py +139 -0
  41. package/python/sweagent/agent/hooks/status.py +34 -0
  42. package/python/sweagent/agent/models.py +896 -0
  43. package/python/sweagent/agent/problem_statement.py +312 -0
  44. package/python/sweagent/agent/reviewer.py +664 -0
  45. package/python/sweagent/environment/__init__.py +0 -0
  46. package/python/sweagent/environment/hooks/__init__.py +0 -0
  47. package/python/sweagent/environment/hooks/abstract.py +60 -0
  48. package/python/sweagent/environment/hooks/status.py +28 -0
  49. package/python/sweagent/environment/repo.py +219 -0
  50. package/python/sweagent/environment/swe_env.py +276 -0
  51. package/python/sweagent/exceptions.py +54 -0
  52. package/python/sweagent/inspector/README.md +6 -0
  53. package/python/sweagent/inspector/__init__.py +0 -0
  54. package/python/sweagent/inspector/favicon.ico +0 -0
  55. package/python/sweagent/inspector/fileViewer.js +354 -0
  56. package/python/sweagent/inspector/icons/computer.png +0 -0
  57. package/python/sweagent/inspector/icons/edit_icon.svg +11 -0
  58. package/python/sweagent/inspector/icons/swe-agent-logo-50.png +0 -0
  59. package/python/sweagent/inspector/icons/swellama_blue.png +0 -0
  60. package/python/sweagent/inspector/icons/swellama_brown.png +0 -0
  61. package/python/sweagent/inspector/icons/swellama_grey.png +0 -0
  62. package/python/sweagent/inspector/icons/swellama_tan.png +0 -0
  63. package/python/sweagent/inspector/index.html +25 -0
  64. package/python/sweagent/inspector/server.py +354 -0
  65. package/python/sweagent/inspector/static.py +169 -0
  66. package/python/sweagent/inspector/style.css +454 -0
  67. package/python/sweagent/run/__init__.py +0 -0
  68. package/python/sweagent/run/_progress.py +158 -0
  69. package/python/sweagent/run/batch_instances.py +419 -0
  70. package/python/sweagent/run/common.py +387 -0
  71. package/python/sweagent/run/compare_runs.py +123 -0
  72. package/python/sweagent/run/extract_pred.py +19 -0
  73. package/python/sweagent/run/hooks/__init__.py +0 -0
  74. package/python/sweagent/run/hooks/abstract.py +67 -0
  75. package/python/sweagent/run/hooks/apply_patch.py +106 -0
  76. package/python/sweagent/run/hooks/open_pr.py +244 -0
  77. package/python/sweagent/run/hooks/swe_bench_evaluate.py +113 -0
  78. package/python/sweagent/run/inspector_cli.py +493 -0
  79. package/python/sweagent/run/merge_predictions.py +64 -0
  80. package/python/sweagent/run/quick_stats.py +96 -0
  81. package/python/sweagent/run/remove_unfinished.py +63 -0
  82. package/python/sweagent/run/rich_test.py +91 -0
  83. package/python/sweagent/run/run.py +147 -0
  84. package/python/sweagent/run/run_batch.py +442 -0
  85. package/python/sweagent/run/run_replay.py +219 -0
  86. package/python/sweagent/run/run_shell.py +155 -0
  87. package/python/sweagent/run/run_single.py +225 -0
  88. package/python/sweagent/run/run_traj_to_demo.py +85 -0
  89. package/python/sweagent/tools/__init__.py +0 -0
  90. package/python/sweagent/tools/bundle.py +57 -0
  91. package/python/sweagent/tools/commands.py +220 -0
  92. package/python/sweagent/tools/parsing.py +619 -0
  93. package/python/sweagent/tools/tools.py +430 -0
  94. package/python/sweagent/tools/utils.py +108 -0
  95. package/python/sweagent/types.py +102 -0
  96. package/python/sweagent/utils/__init__.py +0 -0
  97. package/python/sweagent/utils/config.py +80 -0
  98. package/python/sweagent/utils/files.py +27 -0
  99. package/python/sweagent/utils/github.py +118 -0
  100. package/python/sweagent/utils/jinja_warnings.py +14 -0
  101. package/python/sweagent/utils/log.py +175 -0
  102. package/python/sweagent/utils/patch_formatter.py +152 -0
  103. package/python/sweagent/utils/serialization.py +45 -0
  104. package/python/tests/__init__.py +0 -0
  105. package/python/tests/conftest.py +191 -0
  106. package/python/tests/test_agent.py +258 -0
  107. package/python/tests/test_batch_instance.py +43 -0
  108. package/python/tests/test_commands/_interactive_dummy.py +35 -0
  109. package/python/tests/test_commands/interactive_dummy_wrapper.sh +29 -0
  110. package/python/tests/test_data/config_files/dummy_interactive.yaml +62 -0
  111. package/python/tests/test_data/data_sources/ctf/crypto/Katy/Dockerfile +20 -0
  112. package/python/tests/test_data/data_sources/ctf/crypto/Katy/README.md +13 -0
  113. package/python/tests/test_data/data_sources/ctf/crypto/Katy/challenge.json +12 -0
  114. package/python/tests/test_data/data_sources/ctf/crypto/Katy/customrandom.c +50 -0
  115. package/python/tests/test_data/data_sources/ctf/crypto/Katy/docker-compose.yml +14 -0
  116. package/python/tests/test_data/data_sources/ctf/crypto/Katy/release +0 -0
  117. package/python/tests/test_data/data_sources/ctf/crypto/Katy/server +0 -0
  118. package/python/tests/test_data/data_sources/ctf/crypto/Katy/solver.py +12 -0
  119. package/python/tests/test_data/data_sources/ctf/forensics/flash/README.md +16 -0
  120. package/python/tests/test_data/data_sources/ctf/forensics/flash/challenge.json +9 -0
  121. package/python/tests/test_data/data_sources/ctf/forensics/flash/flash_c8429a430278283c0e571baebca3d139.zip +0 -0
  122. package/python/tests/test_data/data_sources/ctf/misc/networking_1/README.md +15 -0
  123. package/python/tests/test_data/data_sources/ctf/misc/networking_1/challenge.json +10 -0
  124. package/python/tests/test_data/data_sources/ctf/misc/networking_1/networking.pcap +0 -0
  125. package/python/tests/test_data/data_sources/ctf/pwn/warmup/Dockerfile +28 -0
  126. package/python/tests/test_data/data_sources/ctf/pwn/warmup/README.md +14 -0
  127. package/python/tests/test_data/data_sources/ctf/pwn/warmup/challenge.json +14 -0
  128. package/python/tests/test_data/data_sources/ctf/pwn/warmup/docker-compose.yml +14 -0
  129. package/python/tests/test_data/data_sources/ctf/pwn/warmup/flag.txt +1 -0
  130. package/python/tests/test_data/data_sources/ctf/pwn/warmup/warmup +0 -0
  131. package/python/tests/test_data/data_sources/ctf/pwn/warmup/warmup.c +26 -0
  132. package/python/tests/test_data/data_sources/ctf/pwn/warmup/warmup.py +9 -0
  133. package/python/tests/test_data/data_sources/ctf/rev/rock/README.md +14 -0
  134. package/python/tests/test_data/data_sources/ctf/rev/rock/challenge.json +8 -0
  135. package/python/tests/test_data/data_sources/ctf/rev/rock/rock +0 -0
  136. package/python/tests/test_data/data_sources/ctf/rev/rock/rock.cpp +167 -0
  137. package/python/tests/test_data/data_sources/ctf/rev/rock/solution.cpp +24 -0
  138. package/python/tests/test_data/data_sources/ctf/rev/rock/test_solver/solution.py +6 -0
  139. package/python/tests/test_data/data_sources/ctf/rev/rock/test_solver/test.sh +10 -0
  140. package/python/tests/test_data/data_sources/ctf/web/i_got_id_demo/000-default.conf +18 -0
  141. package/python/tests/test_data/data_sources/ctf/web/i_got_id_demo/Dockerfile +20 -0
  142. package/python/tests/test_data/data_sources/ctf/web/i_got_id_demo/cgi/file.pl +38 -0
  143. package/python/tests/test_data/data_sources/ctf/web/i_got_id_demo/cgi/forms.pl +40 -0
  144. package/python/tests/test_data/data_sources/ctf/web/i_got_id_demo/cgi/hello.pl +11 -0
  145. package/python/tests/test_data/data_sources/ctf/web/i_got_id_demo/challenge.json +12 -0
  146. package/python/tests/test_data/data_sources/ctf/web/i_got_id_demo/docker-compose.yml +14 -0
  147. package/python/tests/test_data/data_sources/ctf/web/i_got_id_demo/flag +1 -0
  148. package/python/tests/test_data/data_sources/ctf/web/i_got_id_demo/index.html +11 -0
  149. package/python/tests/test_data/data_sources/ctf/web/i_got_id_demo/solution.txt +1 -0
  150. package/python/tests/test_data/data_sources/debug_20240322.json +1 -0
  151. package/python/tests/test_data/data_sources/expert_instances.yaml +16 -0
  152. package/python/tests/test_data/data_sources/human_eval.json +1 -0
  153. package/python/tests/test_data/data_sources/simple_instances.yaml +3 -0
  154. package/python/tests/test_data/data_sources/simple_instances_long.yaml +30 -0
  155. package/python/tests/test_data/data_sources/swe-bench-dev-easy.json +1 -0
  156. package/python/tests/test_data/data_sources/swe-bench-dev-easy_first_only.json +1 -0
  157. package/python/tests/test_data/data_sources/swe-bench-lite-test.json +1 -0
  158. package/python/tests/test_data/trajectories/gpt4__swe-agent-test-repo__default_from_url__t-0.00__p-0.95__c-3.00__install-1/6e44b9__sweagenttestrepo-1c2844.traj +342 -0
  159. package/python/tests/test_data/trajectories/gpt4__swe-agent-test-repo__default_from_url__t-0.00__p-0.95__c-3.00__install-1/solution_missing_colon.py +15 -0
  160. package/python/tests/test_data/trajectories/gpt4__swe-agent__test-repo__default_from_url__t-0.00__p-0.95__c-3.00__install-1/args.yaml +518 -0
  161. package/python/tests/test_data/trajectories/gpt4__swe-agent__test-repo__default_from_url__t-0.00__p-0.95__c-3.00__install-1/swe-agent__test-repo-i1.traj +124 -0
  162. package/python/tests/test_data/trajectories/gpt4__swe-bench-dev-easy_first_only__default__t-0.00__p-0.95__c-3.00__install-1/all_preds.jsonl +1 -0
  163. package/python/tests/test_data/trajectories/gpt4__swe-bench-dev-easy_first_only__default__t-0.00__p-0.95__c-3.00__install-1/args.yaml +520 -0
  164. package/python/tests/test_data/trajectories/gpt4__swe-bench-dev-easy_first_only__default__t-0.00__p-0.95__c-3.00__install-1/patches/pydicom__pydicom-1458.patch +18 -0
  165. package/python/tests/test_data/trajectories/gpt4__swe-bench-dev-easy_first_only__default__t-0.00__p-0.95__c-3.00__install-1/pydicom__pydicom-1458.traj +257 -0
  166. package/python/tests/test_env.py +66 -0
  167. package/python/tests/test_env_utils.py +129 -0
  168. package/python/tests/test_history_processors.py +40 -0
  169. package/python/tests/test_models.py +23 -0
  170. package/python/tests/test_openai_live.py +164 -0
  171. package/python/tests/test_packaging.py +7 -0
  172. package/python/tests/test_parsing.py +131 -0
  173. package/python/tests/test_problem_statement_multimodal.py +111 -0
  174. package/python/tests/test_quick_stats.py +42 -0
  175. package/python/tests/test_run.py +37 -0
  176. package/python/tests/test_run_batch.py +110 -0
  177. package/python/tests/test_run_hooks.py +114 -0
  178. package/python/tests/test_run_replay.py +33 -0
  179. package/python/tests/test_run_single.py +125 -0
  180. package/python/tests/test_tools_command_parsing.py +193 -0
  181. package/python/tests/test_utils.py +15 -0
  182. package/python/tests/tools/__init__.py +0 -0
  183. package/python/tests/tools/conftest.py +12 -0
  184. package/python/tests/tools/test_default_utils.py +153 -0
  185. package/python/tests/tools/test_edit_replace.py +0 -0
  186. package/python/tests/tools/test_split_string.py +82 -0
  187. package/python/tests/utils.py +29 -0
  188. package/python/tools/diff_state/bin/_state_diff_state +52 -0
  189. package/python/tools/diff_state/config.yaml +2 -0
  190. package/python/tools/edit_anthropic/bin/_state_anthropic +21 -0
  191. package/python/tools/edit_anthropic/bin/str_replace_editor +710 -0
  192. package/python/tools/edit_anthropic/config.yaml +56 -0
  193. package/python/tools/edit_anthropic/install.sh +3 -0
  194. package/python/tools/filemap/bin/filemap +45 -0
  195. package/python/tools/filemap/config.yaml +9 -0
  196. package/python/tools/filemap/install.sh +2 -0
  197. package/python/tools/forfeit/bin/exit_forfeit +5 -0
  198. package/python/tools/forfeit/config.yaml +5 -0
  199. package/python/tools/image_tools/bin/view_image +36 -0
  200. package/python/tools/image_tools/config.yaml +9 -0
  201. package/python/tools/multilingual_setup/bin/do_nothing +2 -0
  202. package/python/tools/multilingual_setup/config.yaml +1 -0
  203. package/python/tools/multilingual_setup/install.sh +45 -0
  204. package/python/tools/registry/bin/_read_env +10 -0
  205. package/python/tools/registry/bin/_write_env +10 -0
  206. package/python/tools/registry/config.yaml +1 -0
  207. package/python/tools/registry/install.sh +6 -0
  208. package/python/tools/registry/lib/__init__.py +0 -0
  209. package/python/tools/registry/lib/registry.py +56 -0
  210. package/python/tools/review_on_submit_m/README.md +6 -0
  211. package/python/tools/review_on_submit_m/bin/submit +54 -0
  212. package/python/tools/review_on_submit_m/config.yaml +6 -0
  213. package/python/tools/review_on_submit_m/install.sh +0 -0
  214. package/python/tools/search/bin/find_file +31 -0
  215. package/python/tools/search/bin/search_dir +39 -0
  216. package/python/tools/search/bin/search_file +55 -0
  217. package/python/tools/search/config.yaml +37 -0
  218. package/python/tools/search/install.sh +3 -0
  219. package/python/tools/submit/bin/submit +17 -0
  220. package/python/tools/submit/config.yaml +5 -0
  221. package/python/tools/web_browser/bin/click_mouse +41 -0
  222. package/python/tools/web_browser/bin/close_site +28 -0
  223. package/python/tools/web_browser/bin/double_click_mouse +37 -0
  224. package/python/tools/web_browser/bin/drag_mouse +46 -0
  225. package/python/tools/web_browser/bin/execute_script_on_page +39 -0
  226. package/python/tools/web_browser/bin/get_console_output +48 -0
  227. package/python/tools/web_browser/bin/move_mouse +35 -0
  228. package/python/tools/web_browser/bin/navigate_back +33 -0
  229. package/python/tools/web_browser/bin/navigate_forward +33 -0
  230. package/python/tools/web_browser/bin/open_site +36 -0
  231. package/python/tools/web_browser/bin/press_keys_on_page +51 -0
  232. package/python/tools/web_browser/bin/reload_page +33 -0
  233. package/python/tools/web_browser/bin/run_web_browser_server +394 -0
  234. package/python/tools/web_browser/bin/screenshot_site +38 -0
  235. package/python/tools/web_browser/bin/scroll_on_page +40 -0
  236. package/python/tools/web_browser/bin/set_browser_window_size +40 -0
  237. package/python/tools/web_browser/bin/type_text +34 -0
  238. package/python/tools/web_browser/bin/wait_time +39 -0
  239. package/python/tools/web_browser/config.yaml +155 -0
  240. package/python/tools/web_browser/install.sh +22 -0
  241. package/python/tools/web_browser/lib/browser_manager.py +404 -0
  242. package/python/tools/web_browser/lib/web_browser_config.py +33 -0
  243. package/python/tools/web_browser/lib/web_browser_utils.py +126 -0
  244. package/python/tools/web_browser/test_console.html +1 -0
  245. package/python/tools/windowed/bin/_state +25 -0
  246. package/python/tools/windowed/bin/create +29 -0
  247. package/python/tools/windowed/bin/goto +37 -0
  248. package/python/tools/windowed/bin/open +49 -0
  249. package/python/tools/windowed/bin/scroll_down +12 -0
  250. package/python/tools/windowed/bin/scroll_up +13 -0
  251. package/python/tools/windowed/config.yaml +38 -0
  252. package/python/tools/windowed/install.sh +15 -0
  253. package/python/tools/windowed/lib/__init__.py +0 -0
  254. package/python/tools/windowed/lib/flake8_utils.py +147 -0
  255. package/python/tools/windowed/lib/windowed_file.py +312 -0
  256. package/python/tools/windowed_edit_linting/bin/edit +128 -0
  257. package/python/tools/windowed_edit_linting/config.yaml +31 -0
  258. package/python/tools/windowed_edit_linting/install.sh +5 -0
  259. package/python/tools/windowed_edit_replace/bin/edit +172 -0
  260. package/python/tools/windowed_edit_replace/bin/insert +77 -0
  261. package/python/tools/windowed_edit_replace/config.yaml +60 -0
  262. package/python/tools/windowed_edit_replace/install.sh +5 -0
  263. package/python/tools/windowed_edit_rewrite/bin/edit +78 -0
  264. package/python/tools/windowed_edit_rewrite/config.yaml +11 -0
  265. package/python/tools/windowed_edit_rewrite/install.sh +5 -0
  266. package/python/trajectories/demonstrations/ctf/crypto/BabyEncryption.traj +318 -0
  267. package/python/trajectories/demonstrations/ctf/crypto/BabyTimeCapsule.traj +197 -0
  268. package/python/trajectories/demonstrations/ctf/crypto/eps.traj +289 -0
  269. package/python/trajectories/demonstrations/ctf/crypto/katy.traj +368 -0
  270. package/python/trajectories/demonstrations/ctf/forensics/flash.traj +102 -0
  271. package/python/trajectories/demonstrations/ctf/misc/networking_1.traj +102 -0
  272. package/python/trajectories/demonstrations/ctf/pwn/warmup.traj +159 -0
  273. package/python/trajectories/demonstrations/ctf/rev/rock.traj +251 -0
  274. package/python/trajectories/demonstrations/ctf/web/i_got_id_demo.traj +422 -0
  275. package/python/trajectories/demonstrations/function_calling_simple.traj +151 -0
  276. package/python/trajectories/demonstrations/human_thought__swe-bench-HumanEvalFix-python__lcb__t-0.00__p-0.95__c-4.00__install-0/humanevalfix-python-0.traj +129 -0
  277. package/python/trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__default__t-0.20__p-0.95__c-2.00__install-1___install_from_source/marshmallow-code__marshmallow-1867.traj +318 -0
  278. package/python/trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__default_sys-env_cursors_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj +251 -0
  279. package/python/trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__default_sys-env_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj +399 -0
  280. package/python/trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__function_calling__install-1/marshmallow-code__marshmallow-1867.traj +594 -0
  281. package/python/trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__function_calling_replace__install-1/marshmallow-code__marshmallow-1867.traj +592 -0
  282. package/python/trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__function_calling_replace_from_source/marshmallow-code__marshmallow-1867.traj +3316 -0
  283. package/python/trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__xml_sys-env_cursors_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj +251 -0
  284. package/python/trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__xml_sys-env_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj +399 -0
  285. package/python/trajectories/demonstrations/str_replace_anthropic_demo.yaml +432 -0
  286. package/rust/Cargo.toml +100 -0
  287. package/rust/README.md +49 -0
  288. package/rust/src/agent/action_sampler.rs +130 -0
  289. package/rust/src/agent/agents.rs +1029 -0
  290. package/rust/src/agent/history_processors.rs +277 -0
  291. package/rust/src/agent/hooks/mod.rs +208 -0
  292. package/rust/src/agent/mod.rs +24 -0
  293. package/rust/src/agent/models.rs +837 -0
  294. package/rust/src/agent/problem_statement.rs +355 -0
  295. package/rust/src/agent/reviewer.rs +505 -0
  296. package/rust/src/bin/sweagent.rs +784 -0
  297. package/rust/src/environment/deployment.rs +631 -0
  298. package/rust/src/environment/hooks/mod.rs +114 -0
  299. package/rust/src/environment/mod.rs +16 -0
  300. package/rust/src/environment/repo.rs +265 -0
  301. package/rust/src/environment/runtime.rs +237 -0
  302. package/rust/src/environment/swe_env.rs +248 -0
  303. package/rust/src/exceptions.rs +228 -0
  304. package/rust/src/lib.rs +68 -0
  305. package/rust/src/monitoring.rs +482 -0
  306. package/rust/src/run/hooks/mod.rs +134 -0
  307. package/rust/src/run/mod.rs +12 -0
  308. package/rust/src/run/run_batch.rs +563 -0
  309. package/rust/src/run/run_single.rs +196 -0
  310. package/rust/src/tools/bundle.rs +224 -0
  311. package/rust/src/tools/commands.rs +173 -0
  312. package/rust/src/tools/mod.rs +295 -0
  313. package/rust/src/tools/parsing.rs +354 -0
  314. package/rust/src/tools/registry.rs +143 -0
  315. package/rust/src/types.rs +554 -0
  316. package/rust/src/utils/config.rs +105 -0
  317. package/rust/src/utils/files.rs +137 -0
  318. package/rust/src/utils/github.rs +171 -0
  319. package/rust/src/utils/log.rs +65 -0
  320. package/rust/src/utils/mod.rs +17 -0
  321. package/rust/src/utils/serialization.rs +181 -0
  322. package/rust/src/utils/template.rs +173 -0
  323. package/typescript/README.md +335 -0
@@ -0,0 +1,520 @@
1
+ actions:
2
+ apply_patch_locally: false
3
+ open_pr: false
4
+ push_gh_repo_url: ''
5
+ skip_if_commits_reference_issue: true
6
+ agent:
7
+ config:
8
+ _commands:
9
+ - arguments:
10
+ line_number:
11
+ description: the line number to move the window to (if not provided, the
12
+ window will start at the top of the file)
13
+ required: false
14
+ type: integer
15
+ path:
16
+ description: the path to the file to open
17
+ required: true
18
+ type: string
19
+ code: 'open() { if [ -z "$1" ] then echo "Usage: open <file>" return fi #
20
+ Check if the second argument is provided if [ -n "$2" ]; then #
21
+ Check if the provided argument is a valid number if ! [[ $2 =~ ^[0-9]+$
22
+ ]]; then echo "Usage: open <file> [<line_number>]" echo
23
+ "Error: <line_number> must be a number" return # Exit if the line
24
+ number is not valid fi local max_line=$(awk ''END {print NR}''
25
+ $1) if [ $2 -gt $max_line ]; then echo "Warning: <line_number>
26
+ ($2) is greater than the number of lines in the file ($max_line)" echo
27
+ "Warning: Setting <line_number> to $max_line" local line_number=$(jq
28
+ -n "$max_line") # Set line number to max if greater than max elif
29
+ [ $2 -lt 1 ]; then echo "Warning: <line_number> ($2) is less than
30
+ 1" echo "Warning: Setting <line_number> to 1" local
31
+ line_number=$(jq -n "1") # Set line number to 1 if less than 1 else local
32
+ OFFSET=$(jq -n "$WINDOW/6" | jq ''floor'') local line_number=$(jq
33
+ -n "[$2 + $WINDOW/2 - $OFFSET, 1] | max | floor") fi else local
34
+ line_number=$(jq -n "$WINDOW/2") # Set default line number if not provided fi if
35
+ [ -f "$1" ]; then export CURRENT_FILE=$(realpath $1) export
36
+ CURRENT_LINE=$line_number _constrain_line _print elif [ -d
37
+ "$1" ]; then echo "Error: $1 is a directory. You can only open files.
38
+ Use cd or ls to navigate directories." else echo "File $1 not found" fi}'
39
+ docstring: opens the file at the given path in the editor. If line_number is
40
+ provided, the window will be move to include that line
41
+ end_name: null
42
+ name: open
43
+ signature: open <path> [<line_number>]
44
+ - arguments:
45
+ line_number:
46
+ description: the line number to move the window to
47
+ required: true
48
+ type: integer
49
+ code: 'goto() { if [ $# -gt 1 ]; then echo "goto allows only one line
50
+ number at a time." return fi if [ -z "$CURRENT_FILE" ] then echo
51
+ "No file open. Use the open command first." return fi if [ -z
52
+ "$1" ] then echo "Usage: goto <line>" return fi if
53
+ ! [[ $1 =~ ^[0-9]+$ ]] then echo "Usage: goto <line>" echo
54
+ "Error: <line> must be a number" return fi local max_line=$(awk
55
+ ''END {print NR}'' $CURRENT_FILE) if [ $1 -gt $max_line ] then echo
56
+ "Error: <line> must be less than or equal to $max_line" return fi local
57
+ OFFSET=$(jq -n "$WINDOW/6" | jq ''floor'') export CURRENT_LINE=$(jq -n
58
+ "[$1 + $WINDOW/2 - $OFFSET, 1] | max | floor") _constrain_line _print}'
59
+ docstring: moves the window to show <line_number>
60
+ end_name: null
61
+ name: goto
62
+ signature: goto <line_number>
63
+ - arguments: null
64
+ code: scroll_down() { if [ -z "$CURRENT_FILE" ] then echo "No file
65
+ open. Use the open command first." return fi export CURRENT_LINE=$(jq
66
+ -n "$CURRENT_LINE + $WINDOW - $OVERLAP") _constrain_line _print}
67
+ docstring: moves the window down {WINDOW} lines
68
+ end_name: null
69
+ name: scroll_down
70
+ signature: scroll_down
71
+ - arguments: null
72
+ code: scroll_up() { if [ -z "$CURRENT_FILE" ] then echo "No file
73
+ open. Use the open command first." return fi export CURRENT_LINE=$(jq
74
+ -n "$CURRENT_LINE - $WINDOW + $OVERLAP") _constrain_line _print}
75
+ docstring: moves the window down {WINDOW} lines
76
+ end_name: null
77
+ name: scroll_up
78
+ signature: scroll_down
79
+ - arguments:
80
+ filename:
81
+ description: the name of the file to create
82
+ required: true
83
+ type: string
84
+ code: "create() { if [ -z \"$1\" ]; then echo \"Usage: create <filename>\"\
85
+ \ return fi # Check if the file already exists if [ -e \"\
86
+ $1\" ]; then echo \"Error: File '$1' already exists.\"\t\topen \"$1\"\
87
+ \ return fi # Create the file an empty new line printf \"\\\
88
+ n\" > \"$1\" # Use the existing open command to open the created file \
89
+ \ open \"$1\"}"
90
+ docstring: creates and opens a new file with the given name
91
+ end_name: null
92
+ name: create
93
+ signature: create <filename>
94
+ - arguments: null
95
+ code: 'submit() { cd $ROOT # Check if the patch file exists and is non-empty if
96
+ [ -s "/root/test.patch" ]; then # Apply the patch in reverse git
97
+ apply -R < "/root/test.patch" fi git add -A git diff --cached > model.patch echo
98
+ "<<SUBMISSION||" cat model.patch echo "||SUBMISSION>>"}'
99
+ docstring: submits your current code and terminates the session
100
+ end_name: null
101
+ name: submit
102
+ signature: submit
103
+ - arguments:
104
+ dir:
105
+ description: the directory to search in (if not provided, searches in the
106
+ current directory)
107
+ required: false
108
+ type: string
109
+ search_term:
110
+ description: the term to search for
111
+ required: true
112
+ type: string
113
+ code: 'search_dir() { if [ $# -eq 1 ]; then local search_term="$1" local
114
+ dir="./" elif [ $# -eq 2 ]; then local search_term="$1" if
115
+ [ -d "$2" ]; then local dir="$2" else echo "Directory
116
+ $2 not found" return fi else echo "Usage: search_dir
117
+ <search_term> [<dir>]" return fi dir=$(realpath "$dir") local
118
+ matches=$(find "$dir" -type f ! -path ''*/.*'' -exec grep -nIH -- "$search_term"
119
+ {} + | cut -d: -f1 | sort | uniq -c) # if no matches, return if [ -z
120
+ "$matches" ]; then echo "No matches found for \"$search_term\" in $dir" return fi #
121
+ Calculate total number of matches local num_matches=$(echo "$matches" |
122
+ awk ''{sum+=$1} END {print sum}'') # calculate total number of files matched local
123
+ num_files=$(echo "$matches" | wc -l | awk ''{$1=$1; print $0}'') # if num_files
124
+ is > 100, print an error if [ $num_files -gt 100 ]; then echo "More
125
+ than $num_files files matched for \"$search_term\" in $dir. Please narrow
126
+ your search." return fi echo "Found $num_matches matches
127
+ for \"$search_term\" in $dir:" echo "$matches" | awk ''{$2=$2; gsub(/^\.+\/+/,
128
+ "./", $2); print $2 " ("$1" matches)"}'' echo "End of matches for \"$search_term\"
129
+ in $dir"}'
130
+ docstring: searches for search_term in all files in dir. If dir is not provided,
131
+ searches in the current directory
132
+ end_name: null
133
+ name: search_dir
134
+ signature: search_dir <search_term> [<dir>]
135
+ - arguments:
136
+ file:
137
+ description: the file to search in (if not provided, searches in the current
138
+ open file)
139
+ required: false
140
+ type: string
141
+ search_term:
142
+ description: the term to search for
143
+ required: true
144
+ type: string
145
+ code: 'search_file() { # Check if the first argument is provided if [
146
+ -z "$1" ]; then echo "Usage: search_file <search_term> [<file>]" return fi #
147
+ Check if the second argument is provided if [ -n "$2" ]; then #
148
+ Check if the provided argument is a valid file if [ -f "$2" ]; then local
149
+ file="$2" # Set file if valid else echo "Usage: search_file
150
+ <search_term> [<file>]" echo "Error: File name $2 not found. Please
151
+ provide a valid file name." return # Exit if the file is not valid fi else #
152
+ Check if a file is open if [ -z "$CURRENT_FILE" ]; then echo
153
+ "No file open. Use the open command first." return # Exit if no
154
+ file is open fi local file="$CURRENT_FILE" # Set file to the
155
+ current open file fi local search_term="$1" file=$(realpath "$file") #
156
+ Use grep to directly get the desired formatted output local matches=$(grep
157
+ -nH -- "$search_term" "$file") # Check if no matches were found if [
158
+ -z "$matches" ]; then echo "No matches found for \"$search_term\" in
159
+ $file" return fi # Calculate total number of matches local
160
+ num_matches=$(echo "$matches" | wc -l | awk ''{$1=$1; print $0}'') #
161
+ calculate total number of lines matched local num_lines=$(echo "$matches"
162
+ | cut -d: -f1 | sort | uniq | wc -l | awk ''{$1=$1; print $0}'') # if num_lines
163
+ is > 100, print an error if [ $num_lines -gt 100 ]; then echo "More
164
+ than $num_lines lines matched for \"$search_term\" in $file. Please narrow
165
+ your search." return fi # Print the total number of matches and
166
+ the matches themselves echo "Found $num_matches matches for \"$search_term\"
167
+ in $file:" echo "$matches" | cut -d: -f1-2 | sort -u -t: -k2,2n | while
168
+ IFS=: read -r filename line_number; do echo "Line $line_number:$(sed
169
+ -n "${line_number}p" "$file")" done echo "End of matches for \"$search_term\"
170
+ in $file"}'
171
+ docstring: searches for search_term in file. If file is not provided, searches
172
+ in the current open file
173
+ end_name: null
174
+ name: search_file
175
+ signature: search_file <search_term> [<file>]
176
+ - arguments:
177
+ dir:
178
+ description: the directory to search in (if not provided, searches in the
179
+ current directory)
180
+ required: false
181
+ type: string
182
+ file_name:
183
+ description: the name of the file to search for
184
+ required: true
185
+ type: string
186
+ code: 'find_file() { if [ $# -eq 1 ]; then local file_name="$1" local
187
+ dir="./" elif [ $# -eq 2 ]; then local file_name="$1" if
188
+ [ -d "$2" ]; then local dir="$2" else echo "Directory
189
+ $2 not found" return fi else echo "Usage: find_file
190
+ <file_name> [<dir>]" return fi dir=$(realpath "$dir") local
191
+ matches=$(find "$dir" -type f -name "$file_name") # if no matches, return if
192
+ [ -z "$matches" ]; then echo "No matches found for \"$file_name\" in
193
+ $dir" return fi # Calculate total number of matches local
194
+ num_matches=$(echo "$matches" | wc -l | awk ''{$1=$1; print $0}'') echo
195
+ "Found $num_matches matches for \"$file_name\" in $dir:" echo "$matches"
196
+ | awk ''{print $0}''}'
197
+ docstring: finds all files with the given name in dir. If dir is not provided,
198
+ searches in the current directory
199
+ end_name: null
200
+ name: find_file
201
+ signature: find_file <file_name> [<dir>]
202
+ - arguments:
203
+ end_line:
204
+ description: the line number to end the edit at (inclusive)
205
+ required: true
206
+ type: integer
207
+ replacement_text:
208
+ description: the text to replace the current selection with
209
+ required: true
210
+ type: string
211
+ start_line:
212
+ description: the line number to start the edit at
213
+ required: true
214
+ type: integer
215
+ code: 'edit() { if [ -z "$CURRENT_FILE" ] then echo ''No file open.
216
+ Use the `open` command first.'' return fi local start_line="$(echo
217
+ $1: | cut -d: -f1)" local end_line="$(echo $1: | cut -d: -f2)" if [
218
+ -z "$start_line" ] || [ -z "$end_line" ] then echo "Usage: edit
219
+ <start_line>:<end_line>" return fi local re=''^[0-9]+$'' if
220
+ ! [[ $start_line =~ $re ]]; then echo "Usage: edit <start_line>:<end_line>" echo
221
+ "Error: start_line must be a number" return fi if ! [[ $end_line
222
+ =~ $re ]]; then echo "Usage: edit <start_line>:<end_line>" echo
223
+ "Error: end_line must be a number" return fi # Bash array starts
224
+ at 0, so let''s adjust local start_line=$((start_line - 1)) local end_line=$((end_line)) local
225
+ line_count=0 local replacement=() while IFS= read -r line do replacement+=("$line") ((line_count++)) done #
226
+ Create a backup of the current file cp "$CURRENT_FILE" "/root/$(basename
227
+ "$CURRENT_FILE")_backup" # Read the file line by line into an array mapfile
228
+ -t lines < "$CURRENT_FILE" local new_lines=("${lines[@]:0:$start_line}"
229
+ "${replacement[@]}" "${lines[@]:$((end_line))}") # Write the new stuff
230
+ directly back into the original file printf "%s\n" "${new_lines[@]}" >|
231
+ "$CURRENT_FILE" # Run linter if [[ $CURRENT_FILE == *.py ]]; then lint_output=$(flake8
232
+ --select=F821,F822,F831,E111,E112,E113,E999,E902 "$CURRENT_FILE" 2>&1) else #
233
+ do nothing lint_output="" fi # if there is no output, then the
234
+ file is good if [ -z "$lint_output" ]; then export CURRENT_LINE=$start_line _constrain_line _print echo
235
+ "File updated. Please review the changes and make sure they are correct (correct
236
+ indentation, no duplicate lines, etc). Edit the file again if necessary." else echo
237
+ "Your proposed edit has introduced new syntax error(s). Please understand
238
+ the fixes and retry your edit command." echo "" echo "ERRORS:" _split_string
239
+ "$lint_output" echo "" # Save original values original_current_line=$CURRENT_LINE original_window=$WINDOW #
240
+ Update values export CURRENT_LINE=$(( (line_count / 2) + start_line
241
+ )) # Set to "center" of edit export WINDOW=$((line_count + 10)) # Show
242
+ +/- 5 lines around edit echo "This is how your edit would have looked
243
+ if applied" echo "-------------------------------------------------" _constrain_line _print echo
244
+ "-------------------------------------------------" echo "" #
245
+ Restoring CURRENT_FILE to original contents. cp "/root/$(basename "$CURRENT_FILE")_backup"
246
+ "$CURRENT_FILE" export CURRENT_LINE=$(( ((end_line - start_line + 1)
247
+ / 2) + start_line )) export WINDOW=$((end_line - start_line + 10)) echo
248
+ "This is the original code before your edit" echo "-------------------------------------------------" _constrain_line _print echo
249
+ "-------------------------------------------------" # Restore original
250
+ values export CURRENT_LINE=$original_current_line export WINDOW=$original_window echo
251
+ "Your changes have NOT been applied. Please fix your edit command and try
252
+ again." echo "You either need to 1) Specify the correct start/end line
253
+ arguments or 2) Correct your edit code." echo "DO NOT re-run the same
254
+ failed edit command. Running it again will lead to the same error." fi #
255
+ Remove backup file rm -f "/root/$(basename "$CURRENT_FILE")_backup"}'
256
+ docstring: replaces lines <start_line> through <end_line> (inclusive) with the
257
+ given text in the open file. The replacement text is terminated by a line
258
+ with only end_of_edit on it. All of the <replacement text> will be entered,
259
+ so make sure your indentation is formatted properly. Python files will be
260
+ checked for syntax errors after the edit. If the system detects a syntax error,
261
+ the edit will not be executed. Simply try to edit the file again, but make
262
+ sure to read the error message and modify the edit command you issue accordingly.
263
+ Issuing the same command a second time will just lead to the same error message
264
+ again.
265
+ end_name: end_of_edit
266
+ name: edit
267
+ signature: |-
268
+ edit <start_line>:<end_line>
269
+ <replacement_text>
270
+ end_of_edit
271
+ _subroutines: {}
272
+ blocklist:
273
+ - vim
274
+ - vi
275
+ - emacs
276
+ - nano
277
+ - nohup
278
+ - git
279
+ blocklist_error_template: Interactive operation '{name}' is not supported by this
280
+ environment
281
+ blocklist_standalone:
282
+ - python
283
+ - python3
284
+ - ipython
285
+ - bash
286
+ - sh
287
+ - exit
288
+ - /bin/bash
289
+ - /bin/sh
290
+ - nohup
291
+ - vi
292
+ - vim
293
+ - emacs
294
+ - nano
295
+ command_docs: |+
296
+ open:
297
+ docstring: opens the file at the given path in the editor. If line_number is provided, the window will be move to include that line
298
+ signature: open <path> [<line_number>]
299
+ arguments:
300
+ - path (string) [required]: the path to the file to open
301
+ - line_number (integer) [optional]: the line number to move the window to (if not provided, the window will start at the top of the file)
302
+
303
+ goto:
304
+ docstring: moves the window to show <line_number>
305
+ signature: goto <line_number>
306
+ arguments:
307
+ - line_number (integer) [required]: the line number to move the window to
308
+
309
+ scroll_down:
310
+ docstring: moves the window down {WINDOW} lines
311
+ signature: scroll_down
312
+
313
+ scroll_up:
314
+ docstring: moves the window down {WINDOW} lines
315
+ signature: scroll_down
316
+
317
+ create:
318
+ docstring: creates and opens a new file with the given name
319
+ signature: create <filename>
320
+ arguments:
321
+ - filename (string) [required]: the name of the file to create
322
+
323
+ submit:
324
+ docstring: submits your current code and terminates the session
325
+ signature: submit
326
+
327
+ search_dir:
328
+ docstring: searches for search_term in all files in dir. If dir is not provided, searches in the current directory
329
+ signature: search_dir <search_term> [<dir>]
330
+ arguments:
331
+ - search_term (string) [required]: the term to search for
332
+ - dir (string) [optional]: the directory to search in (if not provided, searches in the current directory)
333
+
334
+ search_file:
335
+ docstring: searches for search_term in file. If file is not provided, searches in the current open file
336
+ signature: search_file <search_term> [<file>]
337
+ arguments:
338
+ - search_term (string) [required]: the term to search for
339
+ - file (string) [optional]: the file to search in (if not provided, searches in the current open file)
340
+
341
+ find_file:
342
+ docstring: finds all files with the given name in dir. If dir is not provided, searches in the current directory
343
+ signature: find_file <file_name> [<dir>]
344
+ arguments:
345
+ - file_name (string) [required]: the name of the file to search for
346
+ - dir (string) [optional]: the directory to search in (if not provided, searches in the current directory)
347
+
348
+ edit:
349
+ docstring: replaces lines <start_line> through <end_line> (inclusive) with the given text in the open file. The replacement text is terminated by a line with only end_of_edit on it. All of the <replacement text> will be entered, so make sure your indentation is formatted properly. Python files will be checked for syntax errors after the edit. If the system detects a syntax error, the edit will not be executed. Simply try to edit the file again, but make sure to read the error message and modify the edit command you issue accordingly. Issuing the same command a second time will just lead to the same error message again.
350
+ signature: edit <start_line>:<end_line>
351
+ <replacement_text>
352
+ end_of_edit
353
+ arguments:
354
+ - start_line (integer) [required]: the line number to start the edit at
355
+ - end_line (integer) [required]: the line number to end the edit at (inclusive)
356
+ - replacement_text (string) [required]: the text to replace the current selection with
357
+
358
+ command_files:
359
+ - config/commands/defaults.sh
360
+ - config/commands/search.sh
361
+ - config/commands/edit_linting.sh
362
+ - config/commands/_split_string.py
363
+ demonstration_template: |
364
+ Here is a demonstration of how to correctly accomplish this task.
365
+ It is included to show you how to correctly use the interface.
366
+ You do not need to follow exactly what is done in the demonstration.
367
+ --- DEMONSTRATION ---
368
+ {demonstration}
369
+ --- END OF DEMONSTRATION ---
370
+ demonstrations:
371
+ - trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__default_sys-env_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj
372
+ env_variables:
373
+ CURRENT_FILE: ''
374
+ CURRENT_LINE: '0'
375
+ OVERLAP: '2'
376
+ SEARCH_FILES: ()
377
+ SEARCH_INDEX: '0'
378
+ SEARCH_RESULTS: ()
379
+ WINDOW: '100'
380
+ format_error_template: |
381
+ Your output was not formatted correctly. You must always include one discussion and one command as part of your response. Make sure you do not have multiple discussion/command tags.
382
+ Please make sure your output precisely matches the following format:
383
+ DISCUSSION
384
+ Discuss here with yourself about what your planning and what you're going to do in this step.
385
+
386
+ ```
387
+ command(s) that you're going to run
388
+ ```
389
+ history_processors: []
390
+ instance_template: "We're currently solving the following issue within our repository.\
391
+ \ Here's the issue text:\nISSUE:\n{issue}\n\nINSTRUCTIONS:\nNow, you're going\
392
+ \ to solve this issue on your own. Your terminal session has started and you're\
393
+ \ in the repository's root directory. You can use any bash commands or the special\
394
+ \ interface to help you. Edit all the files you need to and run any checks or\
395
+ \ tests that you want. \nRemember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME.\
396
+ \ You should always wait for feedback after every command. \nWhen you're satisfied\
397
+ \ with all of the changes you've made, you can submit your changes to the code\
398
+ \ base by simply running the submit command.\nNote however that you cannot use\
399
+ \ any interactive session commands (e.g. python, vim) in this environment, but\
400
+ \ you can write scripts and run them. E.g. you can write a python script and\
401
+ \ then run it with `python <script_name>.py`.\n\nNOTE ABOUT THE EDIT COMMAND:\
402
+ \ Indentation really matters! When editing a file, make sure to insert appropriate\
403
+ \ indentation before each line! \n\nIMPORTANT TIPS:\n1. Always start by trying\
404
+ \ to replicate the bug that the issues discusses. \n If the issue includes\
405
+ \ code for reproducing the bug, we recommend that you re-implement that in your\
406
+ \ environment, and run it to make sure you can reproduce the bug.\n Then start\
407
+ \ trying to fix it.\n When you think you've fixed the bug, re-run the bug\
408
+ \ reproduction script to make sure that the bug has indeed been fixed.\n \n\
409
+ \ If the bug reproduction script does not print anything when it successfully\
410
+ \ runs, we recommend adding a print(\"Script completed successfully, no errors.\"\
411
+ ) command at the end of the file,\n so that you can be sure that the script\
412
+ \ indeed ran fine all the way through. \n\n2. If you run a command and it doesn't\
413
+ \ work, try running a different command. A command that did not work once will\
414
+ \ not work the second time unless you modify it!\n\n3. If you open a file and\
415
+ \ need to get to an area around a specific line that is not in the first 100\
416
+ \ lines, say line 583, don't just use the scroll_down command multiple times.\
417
+ \ Instead, use the goto 583 command. It's much quicker. \n \n4. If the bug\
418
+ \ reproduction script requires inputting/reading a specific file, such as buggy-input.png,\
419
+ \ and you'd like to understand how to input that file, conduct a search in the\
420
+ \ existing repo code, to see whether someone else has already done that. Do\
421
+ \ this by running the command: find_file \"buggy-input.png\" If that doensn't\
422
+ \ work, use the linux 'find' command. \n\n5. Always make sure to look at the\
423
+ \ currently open file and the current working directory (which appears right\
424
+ \ after the currently open file). The currently open file might be in a different\
425
+ \ directory than the working directory! Note that some commands, such as 'create',\
426
+ \ open files, so they might change the current open file.\n\n6. When editing\
427
+ \ files, it is easy to accidentally specify a wrong line number or to write\
428
+ \ code with incorrect indentation. Always check the code after you issue an\
429
+ \ edit to make sure that it reflects what you wanted to accomplish. If it didn't,\
430
+ \ issue another command to fix it.\n \n\n(Open file: {open_file})\n(Current\
431
+ \ directory: {working_dir})\nbash-$"
432
+ next_step_no_output_template: |-
433
+ Your command ran successfully and did not produce any output.
434
+ (Open file: {open_file})
435
+ (Current directory: {working_dir})
436
+ bash-$
437
+ next_step_template: |-
438
+ {observation}
439
+ (Open file: {open_file})
440
+ (Current directory: {working_dir})
441
+ bash-$
442
+ parse_command: {}
443
+ parse_function: {}
444
+ put_demos_in_history: false
445
+ strategy_template: null
446
+ submit_command: submit
447
+ subroutine_types: []
448
+ system_template: "SETTING: You are an autonomous programmer, and you're working\
449
+ \ directly in the command line with a special interface.\n\nThe special interface\
450
+ \ consists of a file editor that shows you {WINDOW} lines of a file at a time.\n\
451
+ In addition to typical bash commands, you can also use the following commands\
452
+ \ to help you navigate and edit files.\n\nCOMMANDS:\n{command_docs}\n\nPlease\
453
+ \ note that THE EDIT COMMAND REQUIRES PROPER INDENTATION. \nIf you'd like to\
454
+ \ add the line ' print(x)' you must fully write that out, with all those\
455
+ \ spaces before the code! Indentation is important and code that is not indented\
456
+ \ correctly will fail and require fixing before it can be run.\n\nRESPONSE FORMAT:\n\
457
+ Your shell prompt is formatted as follows:\n(Open file: <path>) <cwd> $\n\n\
458
+ You need to format your output using two fields; discussion and command.\nYour\
459
+ \ output should always include _one_ discussion and _one_ command field EXACTLY\
460
+ \ as in the following example:\nDISCUSSION\nFirst I'll start by using ls to\
461
+ \ see what files are in the current directory. Then maybe we can look at some\
462
+ \ relevant files to see what they look like.\n```\nls -a\n```\n\nYou should\
463
+ \ only include a *SINGLE* command in the command section and then wait for a\
464
+ \ response from the shell before continuing with more discussion and commands.\
465
+ \ Everything you include in the DISCUSSION section will be saved for future\
466
+ \ reference.\nIf you'd like to issue two commands at once, PLEASE DO NOT DO\
467
+ \ THAT! Please instead first submit just the first command, and then after receiving\
468
+ \ a response you'll be able to issue the second command. \nYou're free to use\
469
+ \ any other bash commands you want (e.g. find, grep, cat, ls, cd) in addition\
470
+ \ to the special commands listed above.\nHowever, the environment does NOT support\
471
+ \ interactive session commands (e.g. python, vim), so please do not invoke them."
472
+ util_functions:
473
+ - arguments: null
474
+ code: '_print() { local total_lines=$(awk ''END {print NR}'' $CURRENT_FILE) echo
475
+ "[File: $(realpath $CURRENT_FILE) ($total_lines lines total)]" lines_above=$(jq
476
+ -n "$CURRENT_LINE - $WINDOW/2" | jq ''[0, .] | max | floor'') lines_below=$(jq
477
+ -n "$total_lines - $CURRENT_LINE - $WINDOW/2" | jq ''[0, .] | max | round'') if
478
+ [ $lines_above -gt 0 ]; then echo "($lines_above more lines above)" fi cat
479
+ $CURRENT_FILE | grep -n $ | head -n $(jq -n "[$CURRENT_LINE + $WINDOW/2, $WINDOW/2]
480
+ | max | floor") | tail -n $(jq -n "$WINDOW") if [ $lines_below -gt 0 ];
481
+ then echo "($lines_below more lines below)" fi}'
482
+ docstring: null
483
+ end_name: null
484
+ name: _print
485
+ signature: _print
486
+ - arguments: null
487
+ code: _constrain_line() { if [ -z "$CURRENT_FILE" ] then echo "No
488
+ file open. Use the open command first." return fi local max_line=$(awk
489
+ 'END {print NR}' $CURRENT_FILE) local half_window=$(jq -n "$WINDOW/2" |
490
+ jq 'floor') export CURRENT_LINE=$(jq -n "[$CURRENT_LINE, $max_line - $half_window]
491
+ | min") export CURRENT_LINE=$(jq -n "[$CURRENT_LINE, $half_window] | max")}
492
+ docstring: null
493
+ end_name: null
494
+ name: _constrain_line
495
+ signature: _constrain_line
496
+ config_file: config/anthropic_filemap.yaml
497
+ model:
498
+ host_url: localhost:11434
499
+ model_name: gpt4
500
+ per_instance_cost_limit: 3.0
501
+ replay_path: null
502
+ temperature: 0.0
503
+ top_p: 0.95
504
+ total_cost_limit: 0.0
505
+ environment:
506
+ base_commit: null
507
+ container_name: null
508
+ data_path: tests/test_data/data_sources/swe-bench-dev-easy_first_only.json
509
+ environment_setup: null
510
+ image_name: sweagent/swe-agent:latest
511
+ install_environment: true
512
+ no_mirror: false
513
+ repo_path: ''
514
+ split: dev
515
+ timeout: 35
516
+ verbose: true
517
+ instance_filter: .*
518
+ raise_exceptions: false
519
+ skip_existing: true
520
+ suffix: ''
@@ -0,0 +1,18 @@
1
+
2
+ diff --git a/pydicom/pixel_data_handlers/numpy_handler.py b/pydicom/pixel_data_handlers/numpy_handler.py
3
+ index 8e8d319ae..6a1221b72 100644
4
+ --- a/pydicom/pixel_data_handlers/numpy_handler.py
5
+ +++ b/pydicom/pixel_data_handlers/numpy_handler.py
6
+ @@ -285,9 +285,10 @@ def get_pixeldata(ds: "Dataset", read_only: bool = False) -> "np.ndarray":
7
+ )
8
+
9
+ required_elements = [
10
+ - 'BitsAllocated', 'Rows', 'Columns', 'PixelRepresentation',
11
+ - 'SamplesPerPixel', 'PhotometricInterpretation'
12
+ + 'BitsAllocated', 'Rows', 'Columns', 'SamplesPerPixel', 'PhotometricInterpretation'
13
+ ]
14
+ + if 'PixelData' in ds:
15
+ + required_elements.append('PixelRepresentation')
16
+ missing = [elem for elem in required_elements if elem not in ds]
17
+ if missing:
18
+ raise AttributeError(