2026-07-16 21:36:43 +08:00
<!-- Generated by scripts/gen-website-api.ts — do not edit by hand. Run `pnpm run gen-website-api` to regenerate. -->
# ctx.permission
`PermissionService` — provided by `@deepseek-ai/dsh-permission` .
Owns the deployment's permission presets and their write path. Requires a confining `ctx.bash` executor and `ctx.approval` ; unmatched knob values are reported as CUSTOM_PRESET, not an error.
2026-07-20 11:40:29 +08:00
[Source ](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/ui/permission/src/index.ts#L97 )
2026-07-16 21:36:43 +08:00
### ctx.permission.names
```ts website-api
2026-07-19 14:14:02 +08:00
/**
* The advertised preset names, in the preset table's declaration order.
* @returns every switchable preset name.
*/
2026-07-16 21:36:43 +08:00
get names(): readonly string[]
` ``
The advertised preset names, in the preset table's declaration order.
2026-07-20 11:40:29 +08:00
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/ui/permission/src/index.ts#L137)
2026-07-16 21:36:43 +08:00
### ctx.permission.current(events)
` ``ts website-api
2026-07-19 14:14:02 +08:00
/**
* Resolve the preset matching the effective knob values. A still-matching
* last selection wins shared-bundle ties; otherwise the first table match
* wins, or {@link CUSTOM_PRESET} when no entry matches.
* @param events - the session's events in log order.
* @returns the effective preset name, or ` custom` when nothing matches.
*/
2026-07-16 21:36:43 +08:00
current(events: readonly SessionEvent[]): string
` ``
Resolve the preset matching the effective knob values. A still-matching last selection wins shared-bundle ties; otherwise the first table match wins, or CUSTOM_PRESET when no entry matches.
- ` events` — the session's events in log order.
**Returns** the effective preset name, or ` custom` when nothing matches.
2026-07-20 11:40:29 +08:00
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/ui/permission/src/index.ts#L148)
2026-07-16 21:36:43 +08:00
### ctx.permission.resolve(name)
` ``ts website-api
2026-07-19 14:14:02 +08:00
/**
* Resolve a preset's knob bundle.
* @param name - the preset name to resolve.
* @returns the configured bundle.
* @throws when ` name` is not in the table.
*/
2026-07-16 21:36:43 +08:00
resolve(name: string): PresetSpec
` ``
Resolve a preset's knob bundle.
- ` name` — the preset name to resolve.
**Returns** the configured bundle.
2026-07-20 11:40:29 +08:00
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/ui/permission/src/index.ts#L169)
2026-07-16 21:36:43 +08:00
### ctx.permission.optionOf(name)
` ``ts website-api
2026-07-19 14:14:02 +08:00
/**
* Build the client option for a table entry or {@link CUSTOM_PRESET}. A
* missing label falls back to the table key.
* @param name - a table key, or ` custom`.
* @returns the option a client renders.
* @throws when ` name` is neither a table key nor ` custom`.
*/
2026-07-16 21:36:43 +08:00
optionOf(name: string): PresetOption
` ``
Build the client option for a table entry or CUSTOM_PRESET. A missing label falls back to the table key.
- ` name` — a table key, or ` custom`.
**Returns** the option a client renders.
2026-07-20 11:40:29 +08:00
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/ui/permission/src/index.ts#L184)
2026-07-16 21:36:43 +08:00
### ctx.permission.set(session, name)
` ``ts website-api
2026-07-19 14:14:02 +08:00
/**
* Record a changed preset, then update each changed knob through its own
* setter. Selecting the effective preset again appends nothing.
* @param session - the session the switch belongs to.
* @param name - the preset to switch to; unknown names throw.
*/
2026-07-16 21:36:43 +08:00
set(session: Session, name: string): void
` ``
Record a changed preset, then update each changed knob through its own setter. Selecting the effective preset again appends nothing.
- ` session` — the session the switch belongs to.
- ` name` — the preset to switch to; unknown names throw.
2026-07-20 11:40:29 +08:00
[Source ](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/ui/permission/src/index.ts#L198 )