executePreCompactHooks fires pre_compact just before compaction. The trigger reason ("manual", "auto", "overflow", "tool_overflow") is reported in [hooks.Input.Source]. A terminating verdict skips compaction entirely; AdditionalContext is appended to the compaction prompt so handlers can steer the s
(ctx context.Context, sess *session.Session, a *agent.Agent, source string, events EventSink)
| 610 | // compaction entirely; AdditionalContext is appended to the |
| 611 | // compaction prompt so handlers can steer the summary. |
| 612 | func (r *LocalRuntime) executePreCompactHooks(ctx context.Context, sess *session.Session, a *agent.Agent, source string, events EventSink) (skip bool, message, additionalPrompt string) { |
| 613 | result := r.dispatchHook(ctx, a, hooks.EventPreCompact, &hooks.Input{ |
| 614 | SessionID: sess.ID, |
| 615 | Source: source, |
| 616 | }, events) |
| 617 | if result == nil { |
| 618 | return false, "", "" |
| 619 | } |
| 620 | if !result.Allowed { |
| 621 | return true, result.Message, "" |
| 622 | } |
| 623 | return false, "", result.AdditionalContext |
| 624 | } |
| 625 | |
| 626 | // executeSubagentStopHooks fires subagent_stop when a sub-agent |
| 627 | // (transferred task, background agent, skill sub-session) finishes. |
no test coverage detected