feat: add integration tools abstraction and TrustFoundry legal research#169
Open
iamgroot2285 wants to merge 2 commits into
Open
feat: add integration tools abstraction and TrustFoundry legal research#169iamgroot2285 wants to merge 2 commits into
iamgroot2285 wants to merge 2 commits into
Conversation
Introduce a pluggable ToolIntegration interface that allows external legal research providers to register tools alongside Mike's built-in document and workflow tools. Each integration declares its own tool schemas, a user-facing display name, and a stateless run() handler — keeping provider-specific logic fully encapsulated outside of chatTools.ts. TrustFoundry is included as the first integration (disabled by default). When enabled via TRUSTFOUNDRY_API_KEY and TRUSTFOUNDRY_ENABLED, it exposes agentic and direct legal search across cases, statutes, and regulations, plus citation validation and authority summaries. Backend changes: - New backend/src/lib/integrations/ module with ToolIntegration type, registry, and TrustFoundry implementation - chatTools.ts: merge integration tools into the active tool list, dispatch unrecognized tool calls through the integration registry, and emit displayName on tool_call_start SSE events Frontend changes: - Add optional displayName field to tool_call_start in AssistantEvent type - Pass displayName through SSE parser in useAssistantChat - Use displayName in toolCallLabel() for friendly UI labels (e.g. "Running TrustFoundry Legal Research...") Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
23f2c10 to
f6e4a58
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
ToolIntegrationinterface for plugging external tool providers into assistant chat.The current design targets integrations backed by API keys; providers requiring OAuth or
per-user token management would need additional key-storage infrastructure.
tool_call_startevents so the frontendshows user-friendly labels (e.g. "Running TrustFoundry Legal Research...") — display
names are defined per-provider, keeping everything encapsulated in a single module
docs/integrations.mddocumenting optional third-party integration setupand usage tools
Why
Mike's chat tools were hardcoded — no way to add external tool providers without editing
chatTools.tsdirectly. TheToolIntegrationabstraction lets new providers be added asself-contained modules with their own tool definitions, display names, and execution logic.
Test
npm run build --prefix backendnpm run build --prefix frontendTRUSTFOUNDRY_ENABLED=trueandTRUSTFOUNDRY_API_KEYare set; hidden when disabled