hive-runtime: compact ACP sessions through the agent's compact command
An ACP agent's session is now compacted like a claude one: proactively once a turn crosses the percent-of-window watermark, and on the operator's /compact or the agent's compact tool. Before, the ACP backend's compact returned Unsupported and no watermark applied to it. - AcpRuntime takes the same CompactionPolicy as ClaudeRuntime; make_session builds one PercentPolicy (with CHECKPOINT_PROMPT) and hands it to whichever backend runs. - The runtime keeps the commands each session advertises in available_commands_update. If `compact` is among them, compaction sends the prompt `/compact` on the same session, which is how the ACP spec runs an advertised command. A proactive compaction runs the checkpoint turn first, as InfiniteSession does. - With no compact command, the checkpoint turn runs, the session is archived, and the next turn starts a new one with the system prompt. - Error::Unsupported had no producer left, so it and drive_turn's "/compact skipped" arm are gone. Refs #4391
This commit is contained in:
parent
3bef1dfab6
commit
cec35bfbb1
6 changed files with 356 additions and 76 deletions
|
|
@ -40,6 +40,15 @@ with `AcpError::IdleTimeout` (`IdleKilled` if the agent was killed). This is
|
|||
the only way a provider error the agent retries without reporting it, such as
|
||||
an HTTP 429, ends the turn.
|
||||
|
||||
## ACP backend: not yet
|
||||
## ACP backend: compaction
|
||||
|
||||
`compact` returns `Error::Unsupported`.
|
||||
The same `CompactionPolicy` as the claude backend decides when: after a turn
|
||||
past the watermark, or on `compact` (the operator's `/compact`, the agent's
|
||||
`compact` tool).
|
||||
|
||||
- If the agent advertises a `compact` command (`available_commands_update`),
|
||||
it is sent as the prompt `/compact` on the same session, as the ACP spec
|
||||
runs any advertised command. A proactive compaction runs the policy's
|
||||
checkpoint turn first, as on claude.
|
||||
- Otherwise the policy's checkpoint turn runs, then the session is archived,
|
||||
and the next turn starts a new one, carrying the system prompt again.
|
||||
|
|
|
|||
Loading…
Reference in a new issue