Expand description
会话状态的契约:引擎从设置推出来的 SessionEnv、写进会话日志的 DurableState、
工具与策略经 Arc<dyn Session> 看到的 Session trait,以及绑定任务生命周期的
TaskScope / TaskLease。实现在 session-state crate,是这个 trait 唯一的实现。
Structs§
- Durable
State - The part of a session’s state that outlives its engine: what the model set up for itself, which an engine brought back from the log must still hold. The rest is derived from settings again or ends with the engine.
- Live
Dirs - A list of directories shared by everything handed a clone and replaced in place, so a session’s tools see a change without the session being rebuilt.
- Plan
State - In plan mode, and where
ExitPlanModereturns to:NoneisDefault, for a session that started out in plan mode. - Read
Record - One
Readwhose result went to the model. - Session
Env - What the engine running a session derives from its settings and scene. Each engine brings its own, and attaching an engine replaces the session’s whole.
- Task
Lease - A task whose holder says how it ended: registered on creation, ended by
conclude. One dropped without concluding — its work panicked, was dropped from a queue, or its holder simply went away — ends as stopped, and the parent hears so when the lease was taken notifying it. No task held by a lease is left running. - Task
Scope - A task that lasts as long as this value: registered on creation, ended on drop — stopped if its token was cancelled, done otherwise. For work bounded by one call, like a shell command.
Enums§
- Held
Read - What the model holds of a file it read before.
Constants§
- SESSION_
STATE_ EVENT - SESSION_
STATE_ NS - Log namespace and event under which
DurableStateis recorded.
Traits§
- Session
- What tools and permission policies see of the session they run in. The
layering needs the trait, not an extension point:
session-stateholds the one implementation.
Functions§
- stop_
with_ notice - Stop
taskfrom outside its lease, postingnoticeas its end’s notice before it ends. Of this and the lease, whichever comes first ends the task and notifies; the other leaves both to it.