2026-07-17 21:19:33 +08:00
<!-- Generated by scripts/gen-website-api.ts — do not edit by hand. Run `pnpm run gen-website-api` to regenerate. -->
# ctx.bashEnv
`BashEnvRegistry` — provided by `@deepseek-ai/dsh-tool-bash` .
Registry (`ctx.bashEnv` ) for trusted, per-execution `DSH_*` variables. The namespace is rebuilt for every model bash call: ambient `DSH_*` values are discarded by the executor, then the registry's current snapshot is injected. Built-in shell facts remain owned by the registry itself while plugins can register additional, enumerable facts with effect-scoped disposal.
2026-07-20 11:40:29 +08:00
[Source ](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/bash/tool-bash/src/index.ts#L103 )
2026-07-17 21:19:33 +08:00
### ctx.bashEnv.register(contributor)
```ts website-api
2026-07-19 14:14:02 +08:00
/**
* Register one environment contributor. Names and keys are unique; built-in
* keys are reserved. Registration is disposed with the calling plugin fiber.
* @param contributor - declared key ownership and per-execution resolver.
* @returns the disposer that unregisters the contribution.
*/
2026-07-17 21:19:33 +08:00
register(contributor: BashEnvContributor): () => void
` ``
Register one environment contributor. Names and keys are unique; built-in keys are reserved. Registration is disposed with the calling plugin fiber.
- ` contributor` — declared key ownership and per-execution resolver.
**Returns** the disposer that unregisters the contribution.
2026-07-20 11:40:29 +08:00
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/bash/tool-bash/src/index.ts#L124)
2026-07-17 21:19:33 +08:00
### ctx.bashEnv.collect(execution)
` ``ts website-api
2026-07-19 14:14:02 +08:00
/**
* Build the trusted ` DSH_*` snapshot for one bash tool execution.
* @param execution - the current tool execution.
* @returns an immutable environment overlay containing built-ins and current contributions.
*/
2026-07-17 21:19:33 +08:00
collect(execution: ToolExecution): DshEnvironment
` ``
Build the trusted ` DSH_*` snapshot for one bash tool execution.
- ` execution` — the current tool execution.
**Returns** an immutable environment overlay containing built-ins and current contributions.
2026-07-20 11:40:29 +08:00
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/bash/tool-bash/src/index.ts#L166)
2026-07-17 21:19:33 +08:00
### ctx.bashEnv.list()
` ``ts website-api
2026-07-19 14:14:02 +08:00
/**
* Enumerate plugin-contributed variables without executing their resolvers.
* @returns declarations sorted by environment variable name.
*/
2026-07-17 21:19:33 +08:00
list(): BashEnvVariableInfo[]
` ``
Enumerate plugin-contributed variables without executing their resolvers.
**Returns ** declarations sorted by environment variable name.
2026-07-20 11:40:29 +08:00
[Source ](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/bash/tool-bash/src/index.ts#L198 )