mng-opencode 0.1.1__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.
@@ -0,0 +1,267 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ .venv-*
142
+ env/
143
+ venv/
144
+ ENV/
145
+ env.bak/
146
+ venv.bak/
147
+
148
+ # Spyder project settings
149
+ .spyderproject
150
+ .spyproject
151
+
152
+ # Rope project settings
153
+ .ropeproject
154
+
155
+ # mkdocs documentation
156
+ /site
157
+
158
+ # mypy
159
+ .mypy_cache/
160
+ .dmypy.json
161
+ dmypy.json
162
+
163
+ # Pyre type checker
164
+ .pyre/
165
+
166
+ # pytype static type analyzer
167
+ .pytype/
168
+
169
+ # Cython debug symbols
170
+ cython_debug/
171
+
172
+ # PyCharm
173
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
174
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
175
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
176
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
177
+ .idea/
178
+
179
+ # Abstra
180
+ # Abstra is an AI-powered process automation framework.
181
+ # Ignore directories containing user credentials, local state, and settings.
182
+ # Learn more at https://abstra.io/docs
183
+ .abstra/
184
+
185
+ # Visual Studio Code
186
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
187
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
188
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
189
+ # you could uncomment the following to ignore the entire vscode folder
190
+ # .vscode/
191
+
192
+ # Ruff stuff:
193
+ .ruff_cache/
194
+
195
+ # PyPI configuration file
196
+ .pypirc
197
+
198
+ # Cursor
199
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
200
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
201
+ # refer to https://docs.cursor.com/context/ignore-files
202
+ .cursorignore
203
+ .cursorindexingignore
204
+
205
+ # Marimo
206
+ marimo/_static/
207
+ marimo/_lsp/
208
+ __marimo__/
209
+
210
+ # task folders for local custom claude workflow
211
+ */*/_tasks/
212
+ .sesskey
213
+
214
+ # Node.js
215
+ node_modules/
216
+
217
+ # Frontend build artifacts
218
+ frontend-dist/
219
+
220
+ # ignore review files
221
+ .reviews/
222
+
223
+ # files necessary to smuggle session id into reviewers
224
+ .claude/sessionid
225
+
226
+ # Claude Code local settings (session-specific permissions)
227
+ .claude/settings.local.json
228
+
229
+ # PR status and URL files written by main_claude_stop_hook.sh for status line display
230
+ .claude/pr_url
231
+ .claude/pr_status
232
+
233
+ # History of commits reviewed by main_claude_stop_hook.sh (to detect stuck agents)
234
+ .claude/reviewed_commits
235
+
236
+ # Local Claude settings backup files
237
+ .claude/*.bak
238
+
239
+ # Local mng settings (not committed)
240
+ .mng/settings.local.toml
241
+
242
+ # so the user can make their own notification script
243
+ scripts/notify_user.local.sh
244
+
245
+ # Test output files (slow tests, coverage summaries)
246
+ .test_output/
247
+
248
+ # Active session marker file (used to detect interrupted sessions)
249
+ .claude/active
250
+
251
+ # we stick the image build artifacts here
252
+ .mng/dev/build/
253
+ .mng/dev/secrets/
254
+
255
+ # Offload caches and local files
256
+ .offload/**
257
+ test-results/**
258
+ current.tar.gz
259
+
260
+ # Changelings deploy-time build artifacts
261
+ .changelings/
262
+
263
+ # Autofix working artifacts
264
+ .autofix/
265
+
266
+ # for git worktrees from other repos
267
+ .external_worktrees/
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: mng-opencode
3
+ Version: 0.1.1
4
+ Summary: OpenCode agent type plugin for mng
5
+ Requires-Python: >=3.11
6
+ Requires-Dist: mng==0.1.5
File without changes
@@ -0,0 +1,55 @@
1
+ from pydantic import Field
2
+
3
+ from imbue.mng import hookimpl
4
+ from imbue.mng.config.data_types import AgentTypeConfig
5
+ from imbue.mng.errors import ConfigParseError
6
+ from imbue.mng.interfaces.agent import AgentInterface
7
+ from imbue.mng.primitives import CommandString
8
+
9
+
10
+ class OpenCodeAgentConfig(AgentTypeConfig):
11
+ """Config for the opencode agent type."""
12
+
13
+ command: CommandString = Field(
14
+ default=CommandString("opencode"),
15
+ description="Command to run opencode agent",
16
+ )
17
+
18
+ def merge_with(self, override: AgentTypeConfig) -> AgentTypeConfig:
19
+ """
20
+ Merge this config with an override config.
21
+
22
+ Important note: despite the type signatures, any of these fields may be None in the override--this means that they were NOT set in the toml (and thus should be ignored)
23
+ """
24
+ if not isinstance(override, OpenCodeAgentConfig):
25
+ raise ConfigParseError("Cannot merge OpenCodeAgentConfig with different agent config type")
26
+
27
+ # Merge parent_type (scalar - override wins if not None)
28
+ merged_parent_type = override.parent_type if override.parent_type is not None else self.parent_type
29
+
30
+ # Merge command (scalar - override wins if not None)
31
+ merged_command = self.command
32
+ if hasattr(override, "command") and override.command is not None:
33
+ merged_command = override.command
34
+
35
+ # Merge cli_args (concatenate both tuples)
36
+ merged_cli_args = self.cli_args + override.cli_args if override.cli_args else self.cli_args
37
+
38
+ # Merge permissions (list - concatenate if override is not None)
39
+ merged_permissions = self.permissions
40
+ if override.permissions is not None:
41
+ merged_permissions = list(self.permissions) + list(override.permissions)
42
+
43
+ return self.__class__(
44
+ parent_type=merged_parent_type,
45
+ cli_args=merged_cli_args,
46
+ command=merged_command,
47
+ permissions=merged_permissions,
48
+ )
49
+
50
+
51
+ # Module-level hook implementation for pluggy entry point discovery
52
+ @hookimpl
53
+ def register_agent_type() -> tuple[str, type[AgentInterface] | None, type[AgentTypeConfig]]:
54
+ """Register the opencode agent type."""
55
+ return ("opencode", None, OpenCodeAgentConfig)
@@ -0,0 +1,25 @@
1
+ """Unit tests for OpenCodeAgentConfig."""
2
+
3
+ from imbue.mng_opencode.plugin import OpenCodeAgentConfig
4
+
5
+
6
+ def test_opencode_agent_config_has_correct_defaults() -> None:
7
+ """Verify that OpenCodeAgentConfig has the expected default values."""
8
+ config = OpenCodeAgentConfig()
9
+
10
+ assert str(config.command) == "opencode"
11
+ assert config.cli_args == ()
12
+ assert config.permissions == []
13
+ assert config.parent_type is None
14
+
15
+
16
+ def test_opencode_agent_config_merge_with_override() -> None:
17
+ """Verify that merge_with works correctly for OpenCodeAgentConfig."""
18
+ base = OpenCodeAgentConfig()
19
+ override = OpenCodeAgentConfig(cli_args=("--verbose",))
20
+
21
+ merged = base.merge_with(override)
22
+
23
+ assert isinstance(merged, OpenCodeAgentConfig)
24
+ assert merged.cli_args == ("--verbose",)
25
+ assert str(merged.command) == "opencode"
@@ -0,0 +1,27 @@
1
+ [project]
2
+ name = "mng-opencode"
3
+ version = "0.1.1"
4
+ description = "OpenCode agent type plugin for mng"
5
+ requires-python = ">=3.11"
6
+ dependencies = [
7
+ "mng==0.1.5",
8
+ ]
9
+
10
+ [project.entry-points.mng]
11
+ opencode = "imbue.mng_opencode.plugin"
12
+
13
+ [build-system]
14
+ requires = ["hatchling"]
15
+ build-backend = "hatchling.build"
16
+
17
+ [tool.hatch.build.targets.wheel]
18
+ packages = ["imbue"]
19
+
20
+ [tool.uv.sources]
21
+ mng = { workspace = true }
22
+
23
+ [tool.pyright]
24
+ venvPath = "../.."
25
+ venv = ".venv"
26
+ pythonVersion = "3.11"
27
+ strict = ["**/*.py"]