Skip to content

Commit 9e37c43

Browse files
committed
docs(apidocs): regenerate Python and TypeScript API references for setEnv
1 parent c85c165 commit 9e37c43

2 files changed

Lines changed: 82 additions & 0 deletions

File tree

site/src/content/apidocs/python.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,37 @@ Example:
532532
>>> bash.unmount("/mnt/ext")
533533
```
534534

535+
### `set_env`
536+
537+
```python
538+
Bash.set_env(key: str, value: str) -> None
539+
```
540+
541+
Set an exported environment variable on the live interpreter.
542+
543+
The env counterpart to :meth:`mount` — usable after construction, so a
544+
reusable setup bundle (mount + env + builtins) can be applied to an
545+
existing instance instead of only through the constructor. Scripts see
546+
it as ``$NAME``; child contexts see it in ``env``. A later script
547+
assignment wins.
548+
549+
Survives :meth:`reset`, like custom builtins and unlike env a *script*
550+
exported: only host-set values are replayed on rebuild.
551+
552+
**Parameters:**
553+
554+
- **`key`** — Variable name.
555+
- **`value`** — Variable value.
556+
557+
Example:
558+
559+
```python
560+
>>> bash = Bash()
561+
>>> bash.set_env("SKILL_PATH", "/skills/my-skill")
562+
>>> bash.execute_sync("echo $SKILL_PATH").stdout
563+
'/skills/my-skill\n'
564+
```
565+
535566
## BashTool
536567

537568
Sandboxed bash interpreter for AI agents.
@@ -1076,6 +1107,25 @@ Example:
10761107
>>> tool.unmount("/mnt/ext")
10771108
```
10781109

1110+
### `set_env`
1111+
1112+
```python
1113+
BashTool.set_env(key: str, value: str) -> None
1114+
```
1115+
1116+
Set an exported environment variable. See :meth:`Bash.set_env`.
1117+
1118+
Survives :meth:`reset`.
1119+
1120+
Example:
1121+
1122+
```python
1123+
>>> tool = BashTool()
1124+
>>> tool.set_env("SKILL_PATH", "/skills/my-skill")
1125+
>>> tool.execute_sync("echo $SKILL_PATH").stdout
1126+
'/skills/my-skill\n'
1127+
```
1128+
10791129
## ScriptedTool
10801130

10811131
Compose Python callbacks as bash builtins for multi-tool orchestration.

site/src/content/apidocs/typescript.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,30 @@ bash.restoreSnapshotKeyed(data: Uint8Array, key: Uint8Array): void
308308

309309
Restore interpreter state from a HMAC-protected snapshot.
310310

311+
### `setEnv`
312+
313+
```typescript
314+
bash.setEnv(key: string, value: string): void
315+
```
316+
317+
Set an exported environment variable on the live interpreter.
318+
319+
The env counterpart to runtime `Bash.mount` — usable after
320+
construction, so a reusable setup bundle (mount + env + builtins) can be
321+
applied to an existing instance instead of only through
322+
`BashOptions`. Scripts see it as `$NAME`; child contexts see it in
323+
`env`. A later script assignment wins.
324+
325+
Survives `reset()`, like `customBuiltins` and unlike env a *script*
326+
exported: only host-set values are replayed on rebuild.
327+
328+
```typescript
329+
const bash = new Bash();
330+
bash.mount("/skills/my-skill", skillFs);
331+
bash.setEnv("SKILL_PATH", "/skills/my-skill");
332+
await bash.execute('cat "$SKILL_PATH/SKILL.md"');
333+
```
334+
311335
### `shellState`
312336

313337
```typescript
@@ -721,6 +745,14 @@ bashTool.restoreSnapshotKeyed(data: Uint8Array, key: Uint8Array): void
721745

722746
Restore interpreter state from a HMAC-protected snapshot.
723747

748+
### `setEnv`
749+
750+
```typescript
751+
bashTool.setEnv(key: string, value: string): void
752+
```
753+
754+
Set an exported environment variable. See `Bash.setEnv`.
755+
724756
### `shellState`
725757

726758
```typescript

0 commit comments

Comments
 (0)