Review follow-up (tianyicui): plan mode and the sandbox are orthogonal
AXES, not just orthogonal state — entering plan must not change what the
sandbox enforces, matching Codex's separation of Plan/Default
collaboration presets from sandbox and approval settings.
ModeDefinition.access, the bash/resolve-mode clamp, and both cap-derived
guards are removed; a ModeDefinition is exactly { section }, and a mode
now carries only its guidance section plus the exit_plan_mode review.
The bash seam's resolveMode + waterfall go with their only listener:
dsh-bash and dsh-tool-bash revert to master byte-for-byte, and the
dsh-mode → dsh-bash dependency edge is gone. A deployment that wants
kernel-enforced read-only planning pairs the mode picker with the
independent sandbox-mode option, in either order.
The RFC archives this as the second removed enforcement shape (after
the interim allowlist) with the same restart trigger — effects
self-declaration; the orthogonality FAQ now answers with the two-axis
rule. The plan example demonstrates the axes side by side, and the
re-recorded fixtures pin the guidance-only section.
59 lines
2.2 KiB
Markdown
59 lines
2.2 KiB
Markdown
<!-- Generated by scripts/gen-website-api.ts — do not edit by hand. Run `pnpm run gen-website-api` to regenerate. -->
|
|
|
|
# ctx.modes
|
|
|
|
`ModesService` — provided by `@deepseek-ai/dsh-mode`.
|
|
|
|
`ctx.modes`: the session-mode service. Owns the `mode/set` vocabulary, the pending-intent flush, the boundary narration, the `mode:policy` section, and the exit tool's visibility rule. UIs read mode flips off `session/event`; there is no live mirror.
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/mode/mode/src/index.ts#L216)
|
|
|
|
### ctx.modes.resolved
|
|
|
|
```ts website-api
|
|
readonly resolved: ResolvedModes
|
|
```
|
|
|
|
Validated definitions (built-in `plan` merged unless overridden).
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/mode/mode/src/index.ts#L220)
|
|
|
|
### ctx.modes.list()
|
|
|
|
```ts website-api
|
|
list(): string[]
|
|
```
|
|
|
|
The selectable mode vocabulary: DEFAULT_MODE first, then the configured definitions — the list a mode picker advertises.
|
|
|
|
**Returns** Mode names, `default` first.
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/mode/mode/src/index.ts#L380)
|
|
|
|
### ctx.modes.get(agent)
|
|
|
|
```ts website-api
|
|
get(agent: Agent): { current: string; pending?: string }
|
|
```
|
|
|
|
The agent's mode state: the folded mode in force (a folded name the config no longer defines reads as DEFAULT_MODE) plus the pending user-selected intent awaiting its boundary flush, when one exists.
|
|
|
|
- `agent` — The agent to read.
|
|
|
|
**Returns** The current (effective) mode and the pending intent, if any.
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/mode/mode/src/index.ts#L392)
|
|
|
|
### ctx.modes.set(agent, mode)
|
|
|
|
```ts website-api
|
|
set(agent: Agent, mode: string): void
|
|
```
|
|
|
|
Select the agent's mode. Validates the name against list (loud on unknown; `default` is always a valid target), drops a no-op (target equals the pending intent, else the current fold), and otherwise records a pending intent flushed as a `mode/set` at the next turn boundary.
|
|
|
|
- `agent` — The agent to switch.
|
|
- `mode` — The target mode name.
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/mode/mode/src/index.ts#L407)
|