kestrel-feature-code 0.1.0__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,2 @@
1
+ __pycache__/
2
+ *.pyc
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,80 @@
1
+ Metadata-Version: 2.4
2
+ Name: kestrel-feature-code
3
+ Version: 0.1.0
4
+ Summary: Codebase tooling feature for Kestrel Sovereign — read, search, edit, lint, test, commit, rollback with approval gates
5
+ Project-URL: Homepage, https://kestrelsovereign.com
6
+ Project-URL: Source, https://github.com/KestrelSovereignAI/kestrel-feature-code
7
+ Project-URL: Issues, https://github.com/KestrelSovereignAI/kestrel-feature-code/issues
8
+ Author: UncleSaurus
9
+ Maintainer: UncleSaurus
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: agents,ai,code-tools,kestrel,self-modification
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Software Development
24
+ Classifier: Topic :: Software Development :: Build Tools
25
+ Requires-Python: <3.14,>=3.11
26
+ Requires-Dist: kestrel-sovereign-sdk<1,>=0.2
27
+ Provides-Extra: test
28
+ Requires-Dist: pytest-asyncio>=1.1.0; extra == 'test'
29
+ Requires-Dist: pytest>=8.0.0; extra == 'test'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # kestrel-feature-code
33
+
34
+ Codebase tooling feature for Kestrel Sovereign agents — 10 tools spanning read-only inspection (read, search, diff, lint, logs) and approval-gated mutation (edit, commit, rollback, restart, test).
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ uv pip install kestrel-feature-code
40
+ ```
41
+
42
+ The feature is auto-discovered by Kestrel Sovereign via the `kestrel_sovereign.features` entry point — install it alongside `kestrel-sovereign` and `CodeEditFeature` registers itself at startup.
43
+
44
+ ## Configuration
45
+
46
+ | Variable | Description |
47
+ |----------|-------------|
48
+ | `KESTREL_CODE_ROOT` | Root directory of the codebase the feature operates on (default: project root) |
49
+
50
+ ## Tools
51
+
52
+ | Tool | Category | Description |
53
+ |------|----------|-------------|
54
+ | `code_read` | DATA_ACCESS | Read a source file |
55
+ | `code_search` | DATA_ACCESS | Search the codebase |
56
+ | `code_diff` | DATA_ACCESS | Show uncommitted git changes |
57
+ | `code_lint` | DATA_ACCESS | Run ruff linter |
58
+ | `code_logs` | DATA_ACCESS | View recent application logs |
59
+ | `code_edit` | SYSTEM | Edit a source file (approval-gated) |
60
+ | `code_commit` | SYSTEM | Commit staged changes (approval-gated) |
61
+ | `code_rollback` | SYSTEM | Roll back to a previous commit (approval-gated) |
62
+ | `code_restart` | SYSTEM | Signal server restart (approval-gated) |
63
+ | `code_test` | SYSTEM | Run pytest (full suite is approval-gated) |
64
+
65
+ ## Dependencies
66
+
67
+ - `kestrel-sovereign-sdk>=0.2,<1` — base `Feature`, `tool`, `ToolCategory`
68
+
69
+ No runtime dependency on `kestrel-sovereign` itself; the feature operates against any codebase via `KESTREL_CODE_ROOT`.
70
+
71
+ ## Development
72
+
73
+ ```bash
74
+ uv pip install -e '.[test]'
75
+ uv run pytest
76
+ ```
77
+
78
+ ## License
79
+
80
+ Apache-2.0
@@ -0,0 +1,49 @@
1
+ # kestrel-feature-code
2
+
3
+ Codebase tooling feature for Kestrel Sovereign agents — 10 tools spanning read-only inspection (read, search, diff, lint, logs) and approval-gated mutation (edit, commit, rollback, restart, test).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ uv pip install kestrel-feature-code
9
+ ```
10
+
11
+ The feature is auto-discovered by Kestrel Sovereign via the `kestrel_sovereign.features` entry point — install it alongside `kestrel-sovereign` and `CodeEditFeature` registers itself at startup.
12
+
13
+ ## Configuration
14
+
15
+ | Variable | Description |
16
+ |----------|-------------|
17
+ | `KESTREL_CODE_ROOT` | Root directory of the codebase the feature operates on (default: project root) |
18
+
19
+ ## Tools
20
+
21
+ | Tool | Category | Description |
22
+ |------|----------|-------------|
23
+ | `code_read` | DATA_ACCESS | Read a source file |
24
+ | `code_search` | DATA_ACCESS | Search the codebase |
25
+ | `code_diff` | DATA_ACCESS | Show uncommitted git changes |
26
+ | `code_lint` | DATA_ACCESS | Run ruff linter |
27
+ | `code_logs` | DATA_ACCESS | View recent application logs |
28
+ | `code_edit` | SYSTEM | Edit a source file (approval-gated) |
29
+ | `code_commit` | SYSTEM | Commit staged changes (approval-gated) |
30
+ | `code_rollback` | SYSTEM | Roll back to a previous commit (approval-gated) |
31
+ | `code_restart` | SYSTEM | Signal server restart (approval-gated) |
32
+ | `code_test` | SYSTEM | Run pytest (full suite is approval-gated) |
33
+
34
+ ## Dependencies
35
+
36
+ - `kestrel-sovereign-sdk>=0.2,<1` — base `Feature`, `tool`, `ToolCategory`
37
+
38
+ No runtime dependency on `kestrel-sovereign` itself; the feature operates against any codebase via `KESTREL_CODE_ROOT`.
39
+
40
+ ## Development
41
+
42
+ ```bash
43
+ uv pip install -e '.[test]'
44
+ uv run pytest
45
+ ```
46
+
47
+ ## License
48
+
49
+ Apache-2.0
@@ -0,0 +1,36 @@
1
+ """
2
+ Kestrel Feature Code — codebase tooling for Kestrel Sovereign agents.
3
+
4
+ Extracted from kestrel-sovereign as a standalone feature package.
5
+ Registers ``CodeEditFeature`` via the ``kestrel_sovereign.features``
6
+ entry-point group; auto-discovered when installed alongside
7
+ kestrel-sovereign.
8
+
9
+ Despite the historical class name, the feature covers general codebase
10
+ tooling — read, search, diff, lint, logs, test — alongside the
11
+ approval-gated mutation tools (edit, commit, rollback, restart). All
12
+ mutation requires explicit user approval; read-only operations do not.
13
+
14
+ Tools:
15
+ !code-read <path> Read a source file
16
+ !code-search <pattern> Search for text in codebase
17
+ !code-edit <path> Edit a source file (requires approval)
18
+ !code-diff <path> Show uncommitted changes
19
+ !code-commit <message> Commit staged changes (requires approval)
20
+ !code-restart Signal server restart (requires approval)
21
+ !code-test [path] Run pytest tests
22
+ !code-lint [path] Run ruff linter
23
+ !code-logs View recent application logs
24
+ !code-rollback [commit] Rollback to previous commit (requires approval)
25
+ """
26
+
27
+ from importlib.metadata import PackageNotFoundError, version as _version
28
+
29
+ from .feature import CodeEditFeature
30
+
31
+ try:
32
+ __version__ = _version("kestrel-feature-code")
33
+ except PackageNotFoundError:
34
+ __version__ = "0.0.0+local"
35
+
36
+ __all__ = ["CodeEditFeature", "__version__"]
@@ -0,0 +1,815 @@
1
+ """
2
+ Code Edit Feature - Self-modification capabilities for Kestrel agents.
3
+
4
+ This feature enables agents to modify their own source code with proper
5
+ constitutional controls and approval workflows.
6
+ """
7
+ import asyncio
8
+ import functools
9
+ import logging
10
+ import os
11
+ import shutil
12
+ import subprocess
13
+ from pathlib import Path
14
+ from typing import Any, Dict, List, Optional
15
+
16
+ from kestrel_sdk.features.base import Feature, tool
17
+ from kestrel_sdk.tools.base import ToolCategory
18
+
19
+ logger = logging.getLogger(__name__)
20
+
21
+ # Find binaries
22
+ GIT_PATH = shutil.which("git") or "/usr/bin/git"
23
+ PYTHON_PATH = shutil.which("python3") or shutil.which("python") or "/usr/bin/python3"
24
+
25
+ # Default to the kestrel-sovereign project root
26
+ DEFAULT_CODE_ROOT = os.environ.get(
27
+ "KESTREL_CODE_ROOT",
28
+ str(Path(__file__).parent.parent.parent.parent) # Up to kestrel-sovereign/
29
+ )
30
+
31
+ # Timeout constants (in seconds)
32
+ CODE_REVIEW_TIMEOUT = 300 # 5 minutes for user approval of code changes
33
+ TEST_SUITE_TIMEOUT = 300 # 5 minutes for running test suite
34
+ LINT_TIMEOUT = 60 # 1 minute for linting operations
35
+ GIT_OPERATION_TIMEOUT = 30 # 30 seconds for git commands (diff, commit, rollback)
36
+ GIT_QUICK_TIMEOUT = 10 # 10 seconds for quick git commands (rev-parse)
37
+
38
+
39
+ async def _run_subprocess(*args, **kwargs) -> subprocess.CompletedProcess:
40
+ """Run subprocess.run off the event loop via asyncio.to_thread."""
41
+ return await asyncio.to_thread(functools.partial(subprocess.run, *args, **kwargs))
42
+
43
+
44
+ async def _read_text(path: Path) -> str:
45
+ """Read text off the event loop."""
46
+ return await asyncio.to_thread(path.read_text, encoding="utf-8")
47
+
48
+
49
+ async def _write_text(path: Path, content: str) -> int:
50
+ """Write text off the event loop."""
51
+ return await asyncio.to_thread(path.write_text, content, encoding="utf-8")
52
+
53
+
54
+ def _search_file_contents(code_root: Path, resolved: Path, pattern: str, file_pattern: str) -> tuple[list[dict], int]:
55
+ """Search files synchronously for offloading via asyncio.to_thread."""
56
+ matches = []
57
+ total_matches = 0
58
+
59
+ for file_path in resolved.rglob(file_pattern):
60
+ if not file_path.is_file():
61
+ continue
62
+ try:
63
+ content = file_path.read_text(encoding="utf-8")
64
+ for i, line in enumerate(content.split('\n'), 1):
65
+ if pattern in line:
66
+ total_matches += 1
67
+ if len(matches) < 50:
68
+ matches.append({
69
+ "file": str(file_path.relative_to(code_root)),
70
+ "line": i,
71
+ "content": line.strip()[:200],
72
+ })
73
+ except (UnicodeDecodeError, PermissionError, OSError):
74
+ continue # Skip files that can't be read
75
+
76
+ return matches, total_matches
77
+
78
+
79
+ class CodeEditFeature(Feature):
80
+ """Feature for self-modification of source code.
81
+
82
+ Enables the agent to:
83
+ - Read its own source files
84
+ - Edit source files (with approval)
85
+ - Commit changes to git
86
+ - Signal for server restart
87
+
88
+ All destructive operations require user approval via SecurityFeature.
89
+ """
90
+
91
+ tool_name = "code_edit"
92
+ tool_description = "Read and modify the agent's own source code with approval"
93
+
94
+ def __init__(self, agent=None, code_root: str = None):
95
+ """Initialize the code edit feature.
96
+
97
+ Args:
98
+ agent: The parent agent instance
99
+ code_root: Root directory of the codebase (default: auto-detect)
100
+ """
101
+ super().__init__(agent)
102
+ self.code_root = Path(code_root or DEFAULT_CODE_ROOT).resolve()
103
+ self._pending_restart = False
104
+
105
+ async def initialize(self):
106
+ """Initialize the feature."""
107
+ logger.info(f"CodeEditFeature initialized with root: {self.code_root}")
108
+
109
+ def _resolve_path(self, path: str) -> Path:
110
+ """Resolve a path relative to code root, with security checks."""
111
+ # Handle absolute paths by making them relative
112
+ if path.startswith("/"):
113
+ path = path.lstrip("/")
114
+
115
+ resolved = (self.code_root / path).resolve()
116
+
117
+ # Security: ensure path is within code root
118
+ if not str(resolved).startswith(str(self.code_root)):
119
+ raise ValueError(f"Path escapes code root: {path}")
120
+
121
+ return resolved
122
+
123
+ def _get_security_feature(self):
124
+ """Get the security feature for approval requests."""
125
+ if hasattr(self.agent, 'get_feature'):
126
+ return self.agent.get_feature("security")
127
+ elif hasattr(self.agent, 'features'):
128
+ return self.agent.features.get("security")
129
+ return None
130
+
131
+ async def _request_approval(self, action: str, details: Dict[str, Any]) -> bool:
132
+ """Request approval for a code modification.
133
+
134
+ Args:
135
+ action: The action being requested (e.g., "code_edit")
136
+ details: Details about the modification
137
+
138
+ Returns:
139
+ True if approved, False otherwise
140
+ """
141
+ security = self._get_security_feature()
142
+
143
+ if not security or not hasattr(security, 'approval_queue'):
144
+ logger.warning("SecurityFeature not available, cannot proceed with code edit")
145
+ return False
146
+
147
+ try:
148
+ approved, scope = await security.approval_queue.request_approval(
149
+ feature_name="code_edit",
150
+ tool_name=action,
151
+ tool_args=details,
152
+ timeout=CODE_REVIEW_TIMEOUT,
153
+ )
154
+ return approved
155
+ except (TimeoutError, asyncio.TimeoutError) as e:
156
+ logger.error(f"Approval request timed out: {e}")
157
+ return False
158
+ except (AttributeError, TypeError, ValueError) as e:
159
+ logger.error(f"Approval request failed due to invalid arguments: {e}")
160
+ return False
161
+ except Exception as e:
162
+ logger.error(f"Approval request failed: {e}", exc_info=True)
163
+ return False
164
+
165
+ # ============== Read Operations (No Approval Required) ==============
166
+
167
+ @tool(
168
+ name="code_read",
169
+ description="Read a source file from the agent's codebase.",
170
+ category=ToolCategory.DATA_ACCESS,
171
+ command_prefix="!code-read"
172
+ )
173
+ async def code_read(
174
+ self,
175
+ path: str,
176
+ start_line: int = None,
177
+ end_line: int = None,
178
+ ) -> Dict[str, Any]:
179
+ """Read a source file.
180
+
181
+ Args:
182
+ path: Path to file relative to code root
183
+ start_line: Optional start line (1-indexed)
184
+ end_line: Optional end line (1-indexed)
185
+
186
+ Returns:
187
+ Dict with file content and metadata
188
+ """
189
+ try:
190
+ resolved = self._resolve_path(path)
191
+
192
+ if not resolved.exists():
193
+ return {"success": False, "error": f"File not found: {path}"}
194
+
195
+ if not resolved.is_file():
196
+ return {"success": False, "error": f"Not a file: {path}"}
197
+
198
+ content = await _read_text(resolved)
199
+ lines = content.split('\n')
200
+
201
+ # Handle line range
202
+ if start_line or end_line:
203
+ start_idx = (start_line - 1) if start_line else 0
204
+ end_idx = end_line if end_line else len(lines)
205
+ lines = lines[start_idx:end_idx]
206
+ content = '\n'.join(lines)
207
+
208
+ return {
209
+ "success": True,
210
+ "path": str(resolved.relative_to(self.code_root)),
211
+ "content": content,
212
+ "total_lines": len(content.split('\n')),
213
+ "shown_lines": len(lines),
214
+ }
215
+ except (FileNotFoundError, PermissionError, OSError) as e:
216
+ logger.error(f"Error reading file: {e}")
217
+ return {"success": False, "error": str(e)}
218
+ except (UnicodeDecodeError, ValueError) as e:
219
+ logger.error(f"Error decoding file content: {e}")
220
+ return {"success": False, "error": str(e)}
221
+ except Exception as e:
222
+ logger.error(f"Error reading file: {e}", exc_info=True)
223
+ return {"success": False, "error": str(e)}
224
+
225
+ @tool(
226
+ name="code_search",
227
+ description="Search for text in the agent's codebase.",
228
+ category=ToolCategory.DATA_ACCESS,
229
+ command_prefix="!code-search"
230
+ )
231
+ async def code_search(
232
+ self,
233
+ pattern: str,
234
+ path: str = ".",
235
+ file_pattern: str = "*.py",
236
+ ) -> Dict[str, Any]:
237
+ """Search for text in source files.
238
+
239
+ Args:
240
+ pattern: Text pattern to search for
241
+ path: Directory to search in (relative to code root)
242
+ file_pattern: Glob pattern for files to search
243
+
244
+ Returns:
245
+ Dict with matching files and lines
246
+ """
247
+ try:
248
+ resolved = self._resolve_path(path)
249
+
250
+ if not resolved.exists():
251
+ return {"success": False, "error": f"Path not found: {path}"}
252
+
253
+ matches, total_matches = await asyncio.to_thread(
254
+ _search_file_contents,
255
+ self.code_root,
256
+ resolved,
257
+ pattern,
258
+ file_pattern,
259
+ )
260
+
261
+ return {
262
+ "success": True,
263
+ "pattern": pattern,
264
+ "matches": matches,
265
+ "total_matches": total_matches,
266
+ }
267
+ except (FileNotFoundError, PermissionError, OSError) as e:
268
+ logger.error(f"Error searching: {e}")
269
+ return {"success": False, "error": str(e)}
270
+ except ValueError as e:
271
+ logger.error(f"Invalid search parameters: {e}")
272
+ return {"success": False, "error": str(e)}
273
+ except Exception as e:
274
+ logger.error(f"Error searching: {e}", exc_info=True)
275
+ return {"success": False, "error": str(e)}
276
+
277
+ # ============== Write Operations (Require Approval) ==============
278
+
279
+ @tool(
280
+ name="code_edit",
281
+ description="Edit a source file by replacing exact text. Requires approval.",
282
+ category=ToolCategory.SYSTEM,
283
+ command_prefix="!code-edit"
284
+ )
285
+ async def code_edit(
286
+ self,
287
+ path: str,
288
+ old_text: str,
289
+ new_text: str,
290
+ description: str = None,
291
+ ) -> Dict[str, Any]:
292
+ """Edit a source file by replacing exact text.
293
+
294
+ This operation requires user approval. The old_text must match
295
+ exactly (including whitespace) and appear exactly once in the file.
296
+
297
+ Args:
298
+ path: Path to file relative to code root
299
+ old_text: Exact text to find and replace
300
+ new_text: New text to replace with
301
+ description: Optional description of the change
302
+
303
+ Returns:
304
+ Dict with success status and details
305
+ """
306
+ try:
307
+ resolved = self._resolve_path(path)
308
+
309
+ if not resolved.exists():
310
+ return {"success": False, "error": f"File not found: {path}"}
311
+
312
+ content = await _read_text(resolved)
313
+
314
+ # Verify old_text exists exactly once
315
+ count = content.count(old_text)
316
+ if count == 0:
317
+ return {
318
+ "success": False,
319
+ "error": "Text to replace not found in file",
320
+ "hint": "Ensure old_text matches exactly, including whitespace"
321
+ }
322
+ if count > 1:
323
+ return {
324
+ "success": False,
325
+ "error": f"Text appears {count} times, must be unique",
326
+ "hint": "Add more context to make the match unique"
327
+ }
328
+
329
+ # Request approval
330
+ approved = await self._request_approval("code_edit", {
331
+ "path": path,
332
+ "old_text": old_text[:500] + ("..." if len(old_text) > 500 else ""),
333
+ "new_text": new_text[:500] + ("..." if len(new_text) > 500 else ""),
334
+ "description": description or "Code modification",
335
+ })
336
+
337
+ if not approved:
338
+ return {
339
+ "success": False,
340
+ "error": "Edit not approved",
341
+ "requires_approval": True,
342
+ }
343
+
344
+ # Apply the edit
345
+ new_content = content.replace(old_text, new_text, 1)
346
+ await _write_text(resolved, new_content)
347
+
348
+ logger.info(f"Applied code edit to {path}: {description or 'no description'}")
349
+
350
+ return {
351
+ "success": True,
352
+ "path": str(resolved.relative_to(self.code_root)),
353
+ "description": description,
354
+ "chars_removed": len(old_text),
355
+ "chars_added": len(new_text),
356
+ }
357
+ except (FileNotFoundError, PermissionError, OSError) as e:
358
+ logger.error(f"Error editing file: {e}")
359
+ return {"success": False, "error": str(e)}
360
+ except (UnicodeDecodeError, ValueError) as e:
361
+ logger.error(f"Error processing file content: {e}")
362
+ return {"success": False, "error": str(e)}
363
+ except Exception as e:
364
+ logger.error(f"Error editing file: {e}", exc_info=True)
365
+ return {"success": False, "error": str(e)}
366
+
367
+ @tool(
368
+ name="code_diff",
369
+ description="Show uncommitted git changes in the codebase.",
370
+ category=ToolCategory.DATA_ACCESS,
371
+ command_prefix="!code-diff"
372
+ )
373
+ async def code_diff(self, path: str = ".") -> Dict[str, Any]:
374
+ """Show uncommitted changes.
375
+
376
+ Args:
377
+ path: Path to check (relative to code root, default: all)
378
+
379
+ Returns:
380
+ Dict with diff output
381
+ """
382
+ try:
383
+ resolved = self._resolve_path(path)
384
+
385
+ result = await _run_subprocess(
386
+ [GIT_PATH, "diff", str(resolved)],
387
+ cwd=self.code_root,
388
+ capture_output=True,
389
+ text=True,
390
+ timeout=GIT_OPERATION_TIMEOUT,
391
+ )
392
+
393
+ if result.returncode != 0:
394
+ return {"success": False, "error": result.stderr}
395
+
396
+ return {
397
+ "success": True,
398
+ "diff": result.stdout or "(no changes)",
399
+ "has_changes": bool(result.stdout.strip()),
400
+ }
401
+ except subprocess.TimeoutExpired as e:
402
+ logger.error(f"Git diff timed out: {e}")
403
+ return {"success": False, "error": "Git diff operation timed out"}
404
+ except (subprocess.SubprocessError, FileNotFoundError, OSError) as e:
405
+ logger.error(f"Error getting diff: {e}")
406
+ return {"success": False, "error": str(e)}
407
+ except Exception as e:
408
+ logger.error(f"Error getting diff: {e}", exc_info=True)
409
+ return {"success": False, "error": str(e)}
410
+
411
+ @tool(
412
+ name="code_commit",
413
+ description="Commit staged changes to git. Requires approval.",
414
+ category=ToolCategory.SYSTEM,
415
+ command_prefix="!code-commit"
416
+ )
417
+ async def code_commit(
418
+ self,
419
+ message: str,
420
+ files: str = ".",
421
+ ) -> Dict[str, Any]:
422
+ """Commit changes to git.
423
+
424
+ Args:
425
+ message: Commit message
426
+ files: Files to commit (default: all changes)
427
+
428
+ Returns:
429
+ Dict with commit details
430
+ """
431
+ try:
432
+ # Request approval
433
+ approved = await self._request_approval("code_commit", {
434
+ "message": message,
435
+ "files": files,
436
+ })
437
+
438
+ if not approved:
439
+ return {
440
+ "success": False,
441
+ "error": "Commit not approved",
442
+ "requires_approval": True,
443
+ }
444
+
445
+ resolved = self._resolve_path(files)
446
+
447
+ # Stage files
448
+ await _run_subprocess(
449
+ [GIT_PATH, "add", str(resolved)],
450
+ cwd=self.code_root,
451
+ check=True,
452
+ timeout=GIT_OPERATION_TIMEOUT,
453
+ )
454
+
455
+ # Commit
456
+ result = await _run_subprocess(
457
+ [GIT_PATH, "commit", "-m", message],
458
+ cwd=self.code_root,
459
+ capture_output=True,
460
+ text=True,
461
+ timeout=GIT_OPERATION_TIMEOUT,
462
+ )
463
+
464
+ if result.returncode != 0:
465
+ if "nothing to commit" in result.stdout:
466
+ return {"success": True, "message": "Nothing to commit"}
467
+ return {"success": False, "error": result.stderr}
468
+
469
+ # Get commit hash
470
+ hash_result = await _run_subprocess(
471
+ [GIT_PATH, "rev-parse", "HEAD"],
472
+ cwd=self.code_root,
473
+ capture_output=True,
474
+ text=True,
475
+ timeout=GIT_QUICK_TIMEOUT,
476
+ )
477
+
478
+ commit_hash = hash_result.stdout.strip()[:8]
479
+
480
+ logger.info(f"Committed changes: {commit_hash} - {message}")
481
+
482
+ return {
483
+ "success": True,
484
+ "commit": commit_hash,
485
+ "message": message,
486
+ }
487
+ except subprocess.CalledProcessError as e:
488
+ return {"success": False, "error": str(e)}
489
+ except subprocess.TimeoutExpired as e:
490
+ logger.error(f"Git commit timed out: {e}")
491
+ return {"success": False, "error": "Git commit operation timed out"}
492
+ except (subprocess.SubprocessError, FileNotFoundError, OSError) as e:
493
+ logger.error(f"Error committing: {e}")
494
+ return {"success": False, "error": str(e)}
495
+ except Exception as e:
496
+ logger.error(f"Error committing: {e}", exc_info=True)
497
+ return {"success": False, "error": str(e)}
498
+
499
+ @tool(
500
+ name="code_restart",
501
+ description="Signal that the server should restart to apply code changes.",
502
+ category=ToolCategory.SYSTEM,
503
+ command_prefix="!code-restart"
504
+ )
505
+ async def code_restart(self, reason: str = None) -> Dict[str, Any]:
506
+ """Signal server restart.
507
+
508
+ This sets a flag that can be checked by external process managers.
509
+ The actual restart is handled by the deployment infrastructure.
510
+
511
+ Args:
512
+ reason: Optional reason for restart
513
+
514
+ Returns:
515
+ Dict with restart status
516
+ """
517
+ try:
518
+ # Request approval
519
+ approved = await self._request_approval("code_restart", {
520
+ "reason": reason or "Apply code changes",
521
+ })
522
+
523
+ if not approved:
524
+ return {
525
+ "success": False,
526
+ "error": "Restart not approved",
527
+ "requires_approval": True,
528
+ }
529
+
530
+ self._pending_restart = True
531
+
532
+ # Write restart signal file
533
+ restart_file = self.code_root / ".restart_requested"
534
+ await _write_text(restart_file, reason or "Code changes applied")
535
+
536
+ logger.info(f"Restart signaled: {reason}")
537
+
538
+ return {
539
+ "success": True,
540
+ "message": "Restart signaled. Server will restart when possible.",
541
+ "reason": reason,
542
+ }
543
+ except (PermissionError, OSError) as e:
544
+ logger.error(f"Error signaling restart: {e}")
545
+ return {"success": False, "error": str(e)}
546
+ except Exception as e:
547
+ logger.error(f"Error signaling restart: {e}", exc_info=True)
548
+ return {"success": False, "error": str(e)}
549
+
550
+ @property
551
+ def pending_restart(self) -> bool:
552
+ """Check if a restart has been requested."""
553
+ return self._pending_restart
554
+
555
+ # ============== Testing & Validation ==============
556
+
557
+ @tool(
558
+ name="code_test",
559
+ description="Run pytest tests on the codebase. Requires approval for full test suite.",
560
+ category=ToolCategory.SYSTEM,
561
+ command_prefix="!code-test"
562
+ )
563
+ async def code_test(
564
+ self,
565
+ path: str = None,
566
+ verbose: bool = False,
567
+ fail_fast: bool = True,
568
+ ) -> Dict[str, Any]:
569
+ """Run pytest tests.
570
+
571
+ Args:
572
+ path: Specific test file or directory (default: all tests)
573
+ verbose: Show verbose output
574
+ fail_fast: Stop on first failure
575
+
576
+ Returns:
577
+ Dict with test results
578
+ """
579
+ try:
580
+ # Build pytest command
581
+ cmd = [PYTHON_PATH, "-m", "pytest"]
582
+
583
+ if path:
584
+ resolved = self._resolve_path(path)
585
+ cmd.append(str(resolved))
586
+ else:
587
+ # Running full test suite requires approval
588
+ approved = await self._request_approval("code_test", {
589
+ "scope": "full test suite",
590
+ "reason": "Running all tests",
591
+ })
592
+ if not approved:
593
+ return {
594
+ "success": False,
595
+ "error": "Full test suite requires approval",
596
+ "requires_approval": True,
597
+ }
598
+
599
+ if verbose:
600
+ cmd.append("-v")
601
+ if fail_fast:
602
+ cmd.append("-x")
603
+
604
+ # Add timeout and capture
605
+ cmd.extend(["--tb=short", "--no-header", "-q"])
606
+
607
+ result = await _run_subprocess(
608
+ cmd,
609
+ cwd=self.code_root,
610
+ capture_output=True,
611
+ text=True,
612
+ timeout=TEST_SUITE_TIMEOUT,
613
+ env={**os.environ, "PYTHONPATH": str(self.code_root)},
614
+ )
615
+
616
+ passed = result.returncode == 0
617
+
618
+ return {
619
+ "success": True,
620
+ "passed": passed,
621
+ "return_code": result.returncode,
622
+ "output": result.stdout[-2000:] if len(result.stdout) > 2000 else result.stdout,
623
+ "errors": result.stderr[-1000:] if result.stderr else None,
624
+ }
625
+ except subprocess.TimeoutExpired:
626
+ return {"success": False, "error": "Test timeout (5 minutes)"}
627
+ except (subprocess.SubprocessError, FileNotFoundError, OSError) as e:
628
+ logger.error(f"Error running tests: {e}")
629
+ return {"success": False, "error": str(e)}
630
+ except Exception as e:
631
+ logger.error(f"Error running tests: {e}", exc_info=True)
632
+ return {"success": False, "error": str(e)}
633
+
634
+ @tool(
635
+ name="code_lint",
636
+ description="Run linters (ruff) on source files.",
637
+ category=ToolCategory.DATA_ACCESS,
638
+ command_prefix="!code-lint"
639
+ )
640
+ async def code_lint(self, path: str = ".") -> Dict[str, Any]:
641
+ """Run ruff linter on source files.
642
+
643
+ Args:
644
+ path: Path to lint (default: all)
645
+
646
+ Returns:
647
+ Dict with linting results
648
+ """
649
+ try:
650
+ resolved = self._resolve_path(path)
651
+
652
+ result = await _run_subprocess(
653
+ [PYTHON_PATH, "-m", "ruff", "check", str(resolved), "--output-format=text"],
654
+ cwd=self.code_root,
655
+ capture_output=True,
656
+ text=True,
657
+ timeout=LINT_TIMEOUT,
658
+ env={**os.environ, "PYTHONPATH": str(self.code_root)},
659
+ )
660
+
661
+ has_issues = result.returncode != 0
662
+
663
+ return {
664
+ "success": True,
665
+ "has_issues": has_issues,
666
+ "output": result.stdout[-2000:] if result.stdout else "(no issues)",
667
+ "issue_count": result.stdout.count("\n") if result.stdout else 0,
668
+ }
669
+ except subprocess.TimeoutExpired as e:
670
+ logger.error(f"Linting timed out: {e}")
671
+ return {"success": False, "error": "Linting operation timed out"}
672
+ except (subprocess.SubprocessError, FileNotFoundError, OSError) as e:
673
+ logger.error(f"Error linting: {e}")
674
+ return {"success": False, "error": str(e)}
675
+ except Exception as e:
676
+ logger.error(f"Error linting: {e}", exc_info=True)
677
+ return {"success": False, "error": str(e)}
678
+
679
+ @tool(
680
+ name="code_logs",
681
+ description="View recent application logs.",
682
+ category=ToolCategory.DATA_ACCESS,
683
+ command_prefix="!code-logs"
684
+ )
685
+ async def code_logs(
686
+ self,
687
+ lines: int = 50,
688
+ errors_only: bool = False,
689
+ log_file: str = None,
690
+ ) -> Dict[str, Any]:
691
+ """View recent logs.
692
+
693
+ Args:
694
+ lines: Number of lines to show
695
+ errors_only: Only show ERROR level logs
696
+ log_file: Specific log file (default: auto-detect)
697
+
698
+ Returns:
699
+ Dict with log content
700
+ """
701
+ try:
702
+ # Try common log locations
703
+ log_paths = [
704
+ log_file,
705
+ "/tmp/kestrel-claw.log",
706
+ self.code_root / "logs" / "kestrel.log",
707
+ self.code_root / "kestrel.log",
708
+ ]
709
+
710
+ log_content = None
711
+ used_path = None
712
+
713
+ for lp in log_paths:
714
+ if lp is None:
715
+ continue
716
+ lp = Path(lp)
717
+ if lp.exists():
718
+ log_content = await _read_text(lp)
719
+ used_path = str(lp)
720
+ break
721
+
722
+ if log_content is None:
723
+ return {"success": False, "error": "No log file found"}
724
+
725
+ # Get last N lines
726
+ log_lines = log_content.split('\n')
727
+
728
+ if errors_only:
729
+ log_lines = [l for l in log_lines if 'ERROR' in l or 'CRITICAL' in l]
730
+
731
+ recent = log_lines[-lines:]
732
+
733
+ return {
734
+ "success": True,
735
+ "log_file": used_path,
736
+ "lines": len(recent),
737
+ "content": '\n'.join(recent),
738
+ }
739
+ except (FileNotFoundError, PermissionError, OSError) as e:
740
+ logger.error(f"Error reading logs: {e}")
741
+ return {"success": False, "error": str(e)}
742
+ except (UnicodeDecodeError, ValueError) as e:
743
+ logger.error(f"Error processing log content: {e}")
744
+ return {"success": False, "error": str(e)}
745
+ except Exception as e:
746
+ logger.error(f"Error reading logs: {e}", exc_info=True)
747
+ return {"success": False, "error": str(e)}
748
+
749
+ @tool(
750
+ name="code_rollback",
751
+ description="Rollback to a previous commit. Requires approval.",
752
+ category=ToolCategory.SYSTEM,
753
+ command_prefix="!code-rollback"
754
+ )
755
+ async def code_rollback(
756
+ self,
757
+ commit: str = "HEAD~1",
758
+ hard: bool = False,
759
+ ) -> Dict[str, Any]:
760
+ """Rollback to a previous commit.
761
+
762
+ Args:
763
+ commit: Commit to rollback to (default: previous commit)
764
+ hard: Use --hard reset (discards all changes)
765
+
766
+ Returns:
767
+ Dict with rollback status
768
+ """
769
+ try:
770
+ # Always require approval for rollback
771
+ approved = await self._request_approval("code_rollback", {
772
+ "commit": commit,
773
+ "hard": hard,
774
+ "warning": "This will modify git history",
775
+ })
776
+
777
+ if not approved:
778
+ return {
779
+ "success": False,
780
+ "error": "Rollback not approved",
781
+ "requires_approval": True,
782
+ }
783
+
784
+ cmd = [GIT_PATH, "reset"]
785
+ if hard:
786
+ cmd.append("--hard")
787
+ cmd.append(commit)
788
+
789
+ result = await _run_subprocess(
790
+ cmd,
791
+ cwd=self.code_root,
792
+ capture_output=True,
793
+ text=True,
794
+ timeout=GIT_OPERATION_TIMEOUT,
795
+ )
796
+
797
+ if result.returncode != 0:
798
+ return {"success": False, "error": result.stderr}
799
+
800
+ logger.info(f"Rolled back to {commit}")
801
+
802
+ return {
803
+ "success": True,
804
+ "message": f"Rolled back to {commit}",
805
+ "output": result.stdout,
806
+ }
807
+ except subprocess.TimeoutExpired as e:
808
+ logger.error(f"Git rollback timed out: {e}")
809
+ return {"success": False, "error": "Git rollback operation timed out"}
810
+ except (subprocess.SubprocessError, FileNotFoundError, OSError) as e:
811
+ logger.error(f"Error rolling back: {e}")
812
+ return {"success": False, "error": str(e)}
813
+ except Exception as e:
814
+ logger.error(f"Error rolling back: {e}", exc_info=True)
815
+ return {"success": False, "error": str(e)}
@@ -0,0 +1,61 @@
1
+ [project]
2
+ name = "kestrel-feature-code"
3
+ version = "0.1.0"
4
+ description = "Codebase tooling feature for Kestrel Sovereign — read, search, edit, lint, test, commit, rollback with approval gates"
5
+ readme = "README.md"
6
+ requires-python = ">=3.11,<3.14"
7
+ license = "Apache-2.0"
8
+ license-files = ["LICENSE"]
9
+ authors = [{ name = "UncleSaurus" }]
10
+ maintainers = [{ name = "UncleSaurus" }]
11
+ keywords = [
12
+ "ai",
13
+ "agents",
14
+ "kestrel",
15
+ "code-tools",
16
+ "self-modification",
17
+ ]
18
+ classifiers = [
19
+ "Development Status :: 4 - Beta",
20
+ "Intended Audience :: Developers",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Operating System :: POSIX :: Linux",
26
+ "Operating System :: MacOS",
27
+ "Operating System :: Microsoft :: Windows",
28
+ "Topic :: Software Development",
29
+ "Topic :: Software Development :: Build Tools",
30
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
31
+ ]
32
+ dependencies = [
33
+ "kestrel-sovereign-sdk>=0.2,<1",
34
+ ]
35
+
36
+ [project.optional-dependencies]
37
+ test = [
38
+ "pytest>=8.0.0",
39
+ "pytest-asyncio>=1.1.0",
40
+ ]
41
+
42
+ [project.urls]
43
+ Homepage = "https://kestrelsovereign.com"
44
+ Source = "https://github.com/KestrelSovereignAI/kestrel-feature-code"
45
+ Issues = "https://github.com/KestrelSovereignAI/kestrel-feature-code/issues"
46
+
47
+ [project.entry-points."kestrel_sovereign.features"]
48
+ CodeEditFeature = "kestrel_feature_code.feature:CodeEditFeature"
49
+
50
+ [build-system]
51
+ requires = ["hatchling"]
52
+ build-backend = "hatchling.build"
53
+
54
+ [tool.hatch.build.targets.wheel]
55
+ packages = ["kestrel_feature_code"]
56
+
57
+ [tool.hatch.build.targets.sdist]
58
+ include = ["kestrel_feature_code/**/*", "README.md", "LICENSE", "pyproject.toml"]
59
+
60
+ [tool.pytest.ini_options]
61
+ asyncio_mode = "auto"