py-opencode-wrapper 0.2.1__tar.gz → 0.2.2__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 (25) hide show
  1. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/PKG-INFO +7 -1
  2. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/README.md +6 -0
  3. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/opencode_wrapper/client.py +1 -1
  4. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/opencode_wrapper/config.py +4 -0
  5. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/py_opencode_wrapper.egg-info/PKG-INFO +7 -1
  6. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/pyproject.toml +1 -1
  7. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/tests/test_client_async.py +13 -0
  8. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/opencode_wrapper/__init__.py +0 -0
  9. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/opencode_wrapper/errors.py +0 -0
  10. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/opencode_wrapper/events.py +0 -0
  11. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/py_opencode_wrapper.egg-info/SOURCES.txt +0 -0
  12. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/py_opencode_wrapper.egg-info/dependency_links.txt +0 -0
  13. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/py_opencode_wrapper.egg-info/requires.txt +0 -0
  14. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/py_opencode_wrapper.egg-info/top_level.txt +0 -0
  15. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/setup.cfg +0 -0
  16. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/tests/test_config_instructions.py +0 -0
  17. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/tests/test_config_permission.py +0 -0
  18. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/tests/test_event_parser.py +0 -0
  19. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/tests/test_integration_external_directory.py +0 -0
  20. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/tests/test_integration_instructions.py +0 -0
  21. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/tests/test_integration_multi_agent_weather.py +0 -0
  22. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/tests/test_integration_opencode.py +0 -0
  23. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/tests/test_integration_parallel.py +0 -0
  24. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/tests/test_run_result_fuzzy_text.py +0 -0
  25. {py_opencode_wrapper-0.2.1 → py_opencode_wrapper-0.2.2}/tests/test_user_config_isolation.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py-opencode-wrapper
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Async Python wrapper for OpenCode CLI (opencode run --format json)
5
5
  Project-URL: Homepage, https://github.com/idailylife/oc_py_wrapper
6
6
  Project-URL: Repository, https://github.com/idailylife/oc_py_wrapper
@@ -61,6 +61,12 @@ async def main():
61
61
  asyncio.run(main())
62
62
  ```
63
63
 
64
+ Set `RunConfig(record_thinking=True)` when you want OpenCode reasoning/thinking
65
+ parts included in `result.events` and `log_file` JSON lines. This only maps to
66
+ OpenCode's display/output flag `--thinking`; it does not change model reasoning
67
+ effort. Use `variant` separately if you intentionally want a provider-specific
68
+ reasoning effort.
69
+
64
70
  ### Stream structured JSON events
65
71
 
66
72
  ```python
@@ -48,6 +48,12 @@ async def main():
48
48
  asyncio.run(main())
49
49
  ```
50
50
 
51
+ Set `RunConfig(record_thinking=True)` when you want OpenCode reasoning/thinking
52
+ parts included in `result.events` and `log_file` JSON lines. This only maps to
53
+ OpenCode's display/output flag `--thinking`; it does not change model reasoning
54
+ effort. Use `variant` separately if you intentionally want a provider-specific
55
+ reasoning effort.
56
+
51
57
  ### Stream structured JSON events
52
58
 
53
59
  ```python
@@ -73,7 +73,7 @@ def build_argv(
73
73
  cmd.extend(["--port", str(run_cfg.port)])
74
74
  if run_cfg.variant:
75
75
  cmd.extend(["--variant", run_cfg.variant])
76
- if run_cfg.thinking is True:
76
+ if run_cfg.record_thinking is True or run_cfg.thinking is True:
77
77
  cmd.append("--thinking")
78
78
 
79
79
  if prompt:
@@ -147,6 +147,10 @@ class RunConfig:
147
147
  remote_dir: str | None = None
148
148
  port: int | None = None
149
149
  variant: str | None = None
150
+ # Include OpenCode reasoning/thinking parts in the JSON event stream.
151
+ # This maps to `opencode run --thinking`; it does not set model reasoning effort.
152
+ record_thinking: bool | None = None
153
+ # Backward-compatible alias for record_thinking.
150
154
  thinking: bool | None = None
151
155
  print_logs: bool | None = None
152
156
  log_level: str | None = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py-opencode-wrapper
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Async Python wrapper for OpenCode CLI (opencode run --format json)
5
5
  Project-URL: Homepage, https://github.com/idailylife/oc_py_wrapper
6
6
  Project-URL: Repository, https://github.com/idailylife/oc_py_wrapper
@@ -61,6 +61,12 @@ async def main():
61
61
  asyncio.run(main())
62
62
  ```
63
63
 
64
+ Set `RunConfig(record_thinking=True)` when you want OpenCode reasoning/thinking
65
+ parts included in `result.events` and `log_file` JSON lines. This only maps to
66
+ OpenCode's display/output flag `--thinking`; it does not change model reasoning
67
+ effort. Use `variant` separately if you intentionally want a provider-specific
68
+ reasoning effort.
69
+
64
70
  ### Stream structured JSON events
65
71
 
66
72
  ```python
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "py-opencode-wrapper"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = "Async Python wrapper for OpenCode CLI (opencode run --format json)"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.8"
@@ -49,6 +49,19 @@ def test_build_argv_with_agent_model_files() -> None:
49
49
  assert "-f" in argv
50
50
 
51
51
 
52
+ def test_build_argv_record_thinking_adds_display_flag_only() -> None:
53
+ cfg = RunConfig(record_thinking=True)
54
+ argv = build_argv("/x/opencode", "p", cfg)
55
+ assert "--thinking" in argv
56
+ assert "--variant" not in argv
57
+
58
+
59
+ def test_build_argv_thinking_alias_still_adds_display_flag() -> None:
60
+ cfg = RunConfig(thinking=True)
61
+ argv = build_argv("/x/opencode", "p", cfg)
62
+ assert "--thinking" in argv
63
+
64
+
52
65
  def test_build_env_config_content_and_autoupdate() -> None:
53
66
  cfg = RunConfig(permission={"bash": "deny"}, disable_autoupdate=True)
54
67
  env = build_env(cfg, base={"HOME": "/tmp"})