MCPcopy Index your code
hub / github.com/docker/docker-agent / executeAfterCompactionHooks

Method executeAfterCompactionHooks

pkg/runtime/hooks.go:522–540  ·  view source on GitHub ↗

executeAfterCompactionHooks fires after a successful compaction has applied a summary to the session. Purely observational — the result is discarded. The Input carries the *pre-compaction* token counts (what was summarized), not the new ones, so handlers can naturally express "compacted from X to Y

(
	ctx context.Context,
	sess *session.Session,
	a *agent.Agent,
	reason string,
	contextLimit int64,
	preInputTokens, preOutputTokens int64,
	summary string,
	events EventSink,
)

Source from the content-addressed store, hash-verified

520// "compacted from X to Y". The post-compaction counts are reflected
521// in the next [NewTokenUsageEvent] the runtime emits.
522func (r *LocalRuntime) executeAfterCompactionHooks(
523 ctx context.Context,
524 sess *session.Session,
525 a *agent.Agent,
526 reason string,
527 contextLimit int64,
528 preInputTokens, preOutputTokens int64,
529 summary string,
530 events EventSink,
531) {
532 r.dispatchHook(ctx, a, hooks.EventAfterCompaction, &hooks.Input{
533 SessionID: sess.ID,
534 InputTokens: preInputTokens,
535 OutputTokens: preOutputTokens,
536 ContextLimit: contextLimit,
537 CompactionReason: reason,
538 Summary: summary,
539 }, events)
540}
541
542// executeUserPromptSubmitHooks fires user_prompt_submit once per user
543// message, after the prompt has been added to the session and before

Callers 1

doCompactMethod · 0.95

Calls 1

dispatchHookMethod · 0.95

Tested by

no test coverage detected