feat(appkit): add agent plugin core and ToolProvider implementations#284
Draft
MarioCadenas wants to merge 1 commit intoagent/2a-tool-types-mcpfrom
Draft
feat(appkit): add agent plugin core and ToolProvider implementations#284MarioCadenas wants to merge 1 commit intoagent/2a-tool-types-mcpfrom
MarioCadenas wants to merge 1 commit intoagent/2a-tool-types-mcpfrom
Conversation
This was referenced Apr 16, 2026
f738138 to
629d5c2
Compare
0faa33d to
f0362ab
Compare
629d5c2 to
aa77cbb
Compare
Add the agent plugin with all supporting infrastructure:
- AgentPlugin class: routes, tool collection, SSE streaming, thread mgmt
- AgentEventTranslator: converts AgentEvent to OpenAI Responses API format
- InMemoryThreadStore: per-user conversation persistence
- Config-driven agents: frontmatter markdown files in config/agents/
- Layered system prompts: auto-generated base (guidelines + app context)
prepended to per-agent user prompt
- AgentDefinition union type: agents accept { adapter, systemPrompt }
- Auto-discovery: config files merged with code-defined agents per-name
- reloadAgents() export for future hot-reload support
- ToolProvider implementations for analytics, files, genie, lakebase
- Server plugin addExtension() for plugin-to-plugin route registration
Also add a shared defineTool() helper for ToolProvider plugins and refactor
the four built-in ToolProviders to use it:
- defineTool(): Zod-powered factory that pairs a schema with a typed handler
and optional ToolAnnotations. Names are supplied by the enclosing registry
key, so dotted names like `uploads.list` or `myspace.sendMessage` work
without any special-case dispatch code.
- executeFromRegistry(): generic dispatcher that looks up an entry by name,
validates args via safeParse, and returns an LLM-friendly error string on
failure rather than throwing.
- toolsFromRegistry(): derives the AgentToolDefinition[] from a registry,
generating JSON Schema from each entry's Zod schema.
- analytics, files, genie, lakebase: getAgentTools() / executeAgentTool()
now delegate to the shared helpers. Static plugins (analytics, lakebase)
declare the registry as a class field; dynamic plugins (files, genie)
build per-volume / per-space entries in the constructor after runtime
config is known.
Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
f0362ab to
0726869
Compare
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
PR 3 of 5 (2b) in the agent plugin stack.
AgentPluginclass: HTTP routes (/chat, /cancel, /threads, /invocations), tool collection from ToolProvider plugins + FunctionTool + MCP, SSE streaming via executeStream, thread managementAgentEventTranslator: stateful converter from internalAgentEventto OpenAI Responses APIResponseStreamEventwith sequence numbers and output indicesInMemoryThreadStore: per-user conversation persistence with nested MapToolProviderimplementations added to analytics, files, genie, and lakebase pluginsaddExtension()method for internal plugin-to-plugin route registrationPR Stack
Test plan