feat: emit session_ready & tools_resolve event with session object#110
Closed
NovusEdge wants to merge 4 commits into
Closed
feat: emit session_ready & tools_resolve event with session object#110NovusEdge wants to merge 4 commits into
session_ready & tools_resolve event with session object#110NovusEdge wants to merge 4 commits into
Conversation
Add a new lifecycle event that fires when an agent's session is created and ready for use. This enables extensions that need to attach state to subagent sessions (memory systems, context managers, telemetry) to do so cleanly without relying on internal APIs. Event payload: - id: agent ID - type: subagent type (Explore, Plan, etc.) - session: the AgentSession object - record: the full AgentRecord for metadata Use case: Memory/context systems like Veil that fork parent context for subagents and merge findings back on completion.
Author
|
PS: heya! @tintinweb working on a fork of |
Allows extensions to inject additional tools into subagent sessions before they are created. Two mechanisms: 1. SpawnOptions.onToolsResolve callback - per-spawn tool injection 2. subagents:tools_resolve event - global hook for all spawns The event payload includes a mutable `tools` array that extensions can modify to add their own tools (e.g., memory/context tools). Use case: Veil injects veil_recall, veil_remember, etc. into subagents so they can use the parent's context system. Event fires after built-in tool filtering but before session creation.
session_ready & tools_resolve event with session object
NovusEdge
marked this pull request as draft
June 21, 2026 21:21
NovusEdge
marked this pull request as ready for review
June 21, 2026 22:03
Owner
|
happy to add lifecycle events with a minimal proposal attached. for security reasons I cannot accept PRs with package changes or github workflows. |
Author
|
Superseded by #113 - clean version without package.json/workflow changes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add two new lifecycle events that enable extensions to integrate properly with subagent sessions:
subagents:session_ready- Fires when an agent's session is created and readysubagents:tools_resolve- Fires before session creation to allow tool injectionMotivation
Extensions like memory/context systems need to:
Currently, the existing events (
subagents:started,subagents:completed) don't expose the session object or allow tool injection, making this impossible without relying on internal APIs.Changes
subagents:session_readyevent inagent-manager.tsright afteronSessionCreatedfiressubagents:tools_resolveevent inagent-runner.tsbefore session creationonToolsResolvecallback option toSpawnOptionsandRunOptionsEvent Payloads
session_ready
tools_resolve
Use Cases
Context propagation (session_ready)
Tool injection (tools_resolve)
Backward Compatibility
This is purely additive - existing code is unaffected. Extensions can opt-in to the new events.