mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
docs: correct the turn-flow event order and dispatch modes
turn/start precedes the first claim and pre-step, a rejected or empty first claim closes a zero-step turn, llm/stream and tools/* are their own domains, and agent/turn-stopping is serial. Regenerates the lifecycle diagram from the same facts and names --patch overlays exactly.
This commit is contained in:
@@ -24,7 +24,7 @@ Each declares itself in its own `package.json` under a `dsh` field: `dsh.profile
|
||||
|
||||
[`dsh-base`](../packages/bundle/base/README.md) is the first layer of every profile: model adapters, tools, persistence, sandbox and approval policy, settings, credentials, telemetry. [`dsh-web-app`](../packages/bundle/web-app/README.md) adds the browser application; [`dsh-headless`](../packages/bundle/headless/README.md) adds a one-shot runner with no server at all.
|
||||
|
||||
Layers apply to an empty entry list in this order: each bundle in the profile's listed order, then the profile's `cordis.patch.yml`, then the home-level one, then any app overlay. A patch targets a row by id and replaces its whole config, or inserts new rows.
|
||||
Layers apply to an empty entry list in this order: each bundle in the profile's listed order, then the profile's `cordis.patch.yml`, then the home-level one, then any `--patch` overlay. A patch targets a row by id and replaces its whole config, or inserts new rows.
|
||||
|
||||
To see the tree your machine actually boots:
|
||||
|
||||
@@ -62,28 +62,30 @@ The [event map](event-producer-consumer.md) lists every event's producers and co
|
||||
|
||||
## Turn flow
|
||||
|
||||
A **step** is one model request plus the tools it calls. A **turn** is one or more steps, opened from queued input and closed once nothing is owed.
|
||||
A **step** is one model request plus the tools it calls. A **turn** is zero or more steps: it opens before its first input is claimed and closes once nothing is owed.
|
||||
|
||||
```text
|
||||
claim next-step input plus one queued message
|
||||
-> agent/pre-step reject | enter(messages)
|
||||
-> turn/start
|
||||
turn/start
|
||||
claim next-step input plus one queued message
|
||||
assemble prompt sections + tool schemas
|
||||
-> agent/pre-step reject | enter(messages)
|
||||
reject, or a first enter rewritten empty -> close the turn with no step
|
||||
step/start
|
||||
append entered messages as user/message
|
||||
assemble prompt sections + tool schemas, derive history from the log
|
||||
derive model history from the log
|
||||
agent/request -> llm/stream -> assistant/chunk* -> assistant/message
|
||||
tool/call* -> tools/pre-execute -> tools/execute -> tools/post-execute -> tool/result*
|
||||
step/end
|
||||
tools owe another request, or next-step input arrived -> claim -> next step
|
||||
-> agent/turn-stopping
|
||||
-> turn/end
|
||||
turn/end
|
||||
```
|
||||
|
||||
`turn/*`, `step/*`, `user/message`, `assistant/*`, and `tool/*` are durable session events; the rest are live `agent/*` waterfalls, whose listeners must call `next()` to delegate.
|
||||
`turn/*`, `step/*`, `user/message`, `assistant/*`, and `tool/*` are durable session events; the rest are live extension points across three domains. `agent/pre-step`, `agent/request`, `llm/stream`, and the three `tools/*` events are waterfalls, whose listeners must call `next()` to delegate; `agent/turn-stopping` is serial and has no `next()`.
|
||||
|
||||
Input reaches the driver through one inbox. Some messages wake it immediately; injected context waits in the inbox until another message does.
|
||||
|
||||
`agent/pre-step` decides what the model sees. Listeners may rewrite the claimed messages or reject them outright, and a rejected attempt still opens and closes a durable turn, so the log records it. Each step then assembles what the model reads from the prompt sections and tool schemas that plugins registered.
|
||||
`agent/pre-step` decides what the model sees. Listeners may rewrite the claimed messages or reject them outright; a rejected or empty first claim still closes a durable turn that spent no step, so the log records the attempt. Each step reads the prompt sections and tool schemas that plugins registered.
|
||||
|
||||
Details: the [sequence diagram](agent-lifecycle.md), the [tool pipeline](tool-execution-pipeline.md), and [cancellation and error recovery](subsystems/core.md#the-agent-handle).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user