Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion crates/dim-app-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1689,7 +1689,6 @@ pub fn register_faces(builder: &mut dim_agent_runtime::AgentBuilder) {
("contextPreparation", "hot-path"),
("contextUsage", "hot-path"),
("fileReads", "hot-path"),
("execStop", "control"),
("fileStorage", "object"),
("grokOAuthService", "secret"),
("historyRenderer", "hot-path"),
Expand Down
15 changes: 6 additions & 9 deletions docs/architecture/rust-agent/plugins/ShellSession.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,22 @@
Owner: [shell_session.rs](../../../../crates/dim-agent-capabilities/src/shell_session.rs).
The branch's persistent shell: one PTY per branch, started on its first
command, with cwd, environment, shell variables and jobs kept across calls.
It provides the branch's `ShellSession` and its `dyn ExecStop`, so the
Session's `execute` tool and the stop route reach it per branch.
It provides the branch's `ShellSession`, so the Session's `execute` tool reaches
it per branch; `session.exec.stop` reaches the branch's `BackgroundExec`.

## ShellSession

The branch part is mounted by the profile's ShellSession feature. It owns the
PTY, the command queue and the background jobs; `execute` resolves the calling
branch's service, and `session.exec.stop` asks the same branch's `ExecStop`
before falling back to `BackgroundExec`.
PTY and the command queue and hands its background tasks to `BackgroundExec`;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 (optional): the rewritten sentence still says this part owns the PTY. After #2206 HostPlatform owns and reads the PTY, parses the markers and records every command's and job's terminal (crates/dim-agent-capabilities/src/shell_session.rs:5-7, crates/dim-agent-capabilities/src/host_platform.rs:4044-4045, docs/architecture/rust-agent/plugins/HostPlatform.md:56-59, docs/design/service-faces.md:160). A reader who follows this page will put marker parsing or the terminal write back in shell_session.rs, recreating the second terminal source #2206 removed. Fix: say the part owns the command queue and the foreground/background handoff, and that HostPlatform owns the PTY and serves the shell I/O.

`execute` resolves the calling branch's service, and `session.exec.stop` goes to
the same branch's `BackgroundExec`.

### Dependencies

| Service | Purpose |
| --- | --- |
| `B:BackgroundExec` | Recover a shell task whose facts were committed but whose owner is gone. |
| `B:Timeline` | Commit command starts, output and terminal ends. |
| `B:Dispatcher` | Deliver the completion notice and wake the Session. |
| `B:BackgroundExec` | Hand off background tasks and recover a shell task whose facts were committed but whose owner is gone. |
| `B:BranchLifecycle` | Wait for the branch to be published and stop the shell on closing. |
| `S:SessionLifecycle` | Wait for the Session to be published and stop the shell when it closes. |
| `P:HostPlatform` | The shell executable and platform dialect. |
| `S:SessionConfig` | The Session's cwd and execution preferences. |
| `B:TimelineIdentity` | Identify the branch in its facts and notices. |
Expand Down