Skip to content

Commit 611209c

Browse files
committed
misc: small fix or general refactoring i did not bother commenting
1 parent 9b1bdd4 commit 611209c

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-2
lines changed

docs/assets/make_ns.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,26 @@
3232

3333
print(doc.strip())
3434
print()
35+
36+
if hasattr(module, "jail"):
37+
print("### Jail")
38+
print()
39+
print(
40+
"The tools in this namespace can be restricted to a specific set of paths by using the `jail` directive in the agent configuration:"
41+
)
42+
43+
print()
44+
print("```yaml")
45+
print("using:")
46+
print(f" - {modname}")
47+
print()
48+
print("jail:")
49+
print(f" {modname}:")
50+
print(' - "/only/path/to/allow"')
51+
print(' - "{{ target_path }}" # variables can be used too')
52+
print("```")
53+
print()
54+
3555
print("<details>")
3656
print("<summary><b>Show Tools</b></summary>")
3757
print()
@@ -77,5 +97,7 @@
7797

7898
print(f"* `{param_name}` <i>({base_type})</i>: {description.strip()}")
7999

100+
print()
101+
80102
print("</details>")
81103
print()

docs/namespaces.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Let the agent create its own tools in Python.
1717
**Parameters**
1818

1919
* `code` <i>(<class 'str'>)</i>: The Python code to create the tool.
20+
2021
</details>
2122

2223
## 💻 computer
@@ -41,13 +42,15 @@ Computer use primitives for mouse, keyboard, and screen.
4142
**Parameters**
4243

4344
* `keys` <i>(<class 'str'>)</i>: The hotkey sequence to press (like 'ctrl+shift+cmd+space')
45+
4446
### `keyboard_type`
4547

4648
<pre>Type the given text on the keyboard.</pre>
4749

4850
**Parameters**
4951

5052
* `text` <i>(<class 'str'>)</i>: The text to type
53+
5154
### `mouse_double_click`
5255

5356
<pre>Double click the left mouse button at the current mouse position.</pre>
@@ -64,6 +67,7 @@ Computer use primitives for mouse, keyboard, and screen.
6467

6568
* `x` <i>(<class 'int'>)</i>: The x coordinate to move to
6669
* `y` <i>(<class 'int'>)</i>: The y coordinate to move to
70+
6771
### `mouse_middle_click`
6872

6973
<pre>Click the middle mouse button at the current mouse position.</pre>
@@ -76,6 +80,7 @@ Computer use primitives for mouse, keyboard, and screen.
7680

7781
* `x` <i>(<class 'int'>)</i>: The x coordinate to move to
7882
* `y` <i>(<class 'int'>)</i>: The y coordinate to move to
83+
7984
### `mouse_right_click`
8085

8186
<pre>Click the right mouse button at the current mouse position.</pre>
@@ -88,6 +93,7 @@ Computer use primitives for mouse, keyboard, and screen.
8893

8994
* `x` <i>(<class 'int'>)</i>: The x coordinate to move to
9095
* `y` <i>(<class 'int'>)</i>: The y coordinate to move to
96+
9197
### `screenshot`
9298

9399
<pre>Take a screenshot of the current screen.</pre>
@@ -98,6 +104,20 @@ Computer use primitives for mouse, keyboard, and screen.
98104

99105
Read-only access primitives to the local filesystem.
100106

107+
### Jail
108+
109+
The tools in this namespace can be restricted to a specific set of paths by using the `jail` directive in the agent configuration:
110+
111+
```yaml
112+
using:
113+
- filesystem
114+
115+
jail:
116+
filesystem:
117+
- "/only/path/to/allow"
118+
- "{{ target_path }}" # variables can be used too
119+
```
120+
101121
<details>
102122
<summary><b>Show Tools</b></summary>
103123
@@ -108,13 +128,15 @@ Read-only access primitives to the local filesystem.
108128
**Parameters**
109129

110130
* `path` <i>(<class 'str'>)</i>: The path to the folder to list
131+
111132
### `read_file`
112133

113134
<pre>Read the contents of a file from disk.</pre>
114135

115136
**Parameters**
116137

117138
* `path` <i>(<class 'str'>)</i>: The path to the file to read
139+
118140
</details>
119141

120142
## 💬 inquire
@@ -132,6 +154,7 @@ Let the agent interactively ask questions to the user in a structured way.
132154

133155
* `question` <i>(<class 'str'>)</i>: The question to ask the user.
134156
* `default` <i>(<class 'bool'>)</i>: The default answer to the question.
157+
135158
### `ask_for_multiple_choice`
136159

137160
<pre>Ask a multiple choice question to the user.</pre>
@@ -140,6 +163,7 @@ Let the agent interactively ask questions to the user in a structured way.
140163

141164
* `question` <i>(<class 'str'>)</i>: The question to ask the user.
142165
* `choices` <i>(list[str])</i>: The choices to offer the user.
166+
143167
### `ask_for_single_choice`
144168

145169
<pre>Ask a single choice question to the user.</pre>
@@ -148,13 +172,15 @@ Let the agent interactively ask questions to the user in a structured way.
148172

149173
* `question` <i>(<class 'str'>)</i>: The question to ask the user.
150174
* `choices` <i>(list[str])</i>: The choices to offer the user.
175+
151176
### `ask_question`
152177

153178
<pre>Ask a question to the user.</pre>
154179

155180
**Parameters**
156181

157182
* `question` <i>(<class 'str'>)</i>: The question to ask the user.
183+
158184
</details>
159185

160186
## 🧠 reasoning
@@ -197,6 +223,7 @@ Simulates the reasoning process at runtime.
197223
**Parameters**
198224

199225
* `thought` <i>(<class 'str'>)</i>: A thought to think about
226+
200227
</details>
201228

202229
## 💻 shell
@@ -213,6 +240,7 @@ Let the agent execute shell commands.
213240
**Parameters**
214241

215242
* `command` <i>(<class 'str'>)</i>: The shell command to execute
243+
216244
</details>
217245

218246
## ✅ task
@@ -229,13 +257,15 @@ Let the agent autonomously set the task as complete or failed.
229257
**Parameters**
230258

231259
* `reason` <i>(str | None)</i>: Optional reason why the task is complete or report of conclusive information.
260+
232261
### `task_failed`
233262

234263
<pre>Use this tool if you determine that the given goal or task is impossible given the information you have.</pre>
235264

236265
**Parameters**
237266

238267
* `reason` <i>(<class 'str'>)</i>: The reason why the task is impossible
268+
239269
</details>
240270

241271
## 🕒 time
@@ -256,5 +286,6 @@ Provides tools for getting the current date and time and waiting for a given num
256286
**Parameters**
257287

258288
* `seconds` <i>(<class 'int'>)</i>: The number of seconds to wait
289+
259290
</details>
260291

nerve/models.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ class Configuration(BaseModel):
6464
# legacy field used to detect if the user is loading a legacy file
6565
system_prompt: str | None = Field(default=None, exclude=True)
6666

67-
# TODO: document these fields.
68-
6967
# used for versioning the agents
7068
version: str = "1.0.0"
7169
# the system prompt, the agent identity

0 commit comments

Comments
 (0)