-
Notifications
You must be signed in to change notification settings - Fork 43
feat(monitoring): add Threads tab with filters and search #2905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
770599f
feat(monitoring): add Threads tab with agent, model, user, usage and …
guitavano d5be093
feat(monitoring): add time range filter to Threads tab
guitavano a7bb6c6
feat(monitoring): add search and model/user/status filters to Threads…
guitavano f5bbc46
feat(monitoring): add search, filters (status/agent/user/model) and c…
guitavano 57046d0
fix(monitoring): threads tab quality fixes
guitavano 3555eeb
fix file
guitavano fa32c28
fix(thread): revert run_config schema to record type for storage comp…
guitavano 491733b
fix monitoring error
guitavano 26f0ee2
fix(types): add agent_ids column to ThreadTable and Thread interfaces
guitavano fc9ed8b
fix(monitoring): resolve useChatStream error in threads view
guitavano 895d6c2
fix(threads): remove stale agent_ids references, use virtual_mcp_id
guitavano abe9718
fix(docs): remove duplicate typescript devDependency
guitavano 21e8c0d
fix agent name
guitavano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,7 +67,16 @@ export class OrgScopedThreadStorage { | |
|
|
||
| list( | ||
| createdBy?: string, | ||
| options?: { limit?: number; offset?: number; virtualMcpId?: string }, | ||
| options?: { | ||
| limit?: number; | ||
| offset?: number; | ||
| virtualMcpId?: string; | ||
| startDate?: string; | ||
| endDate?: string; | ||
| search?: string; | ||
| status?: string; | ||
| agentId?: string; | ||
| }, | ||
| ): Promise<{ threads: Thread[]; total: number }> { | ||
| return this.inner.list(this.requireOrg(), createdBy, options); | ||
| } | ||
|
|
@@ -237,7 +246,16 @@ export class SqlThreadStorage implements ThreadStoragePort { | |
| async list( | ||
| organizationId: string, | ||
| createdBy?: string, | ||
| options?: { limit?: number; offset?: number; virtualMcpId?: string }, | ||
| options?: { | ||
| limit?: number; | ||
| offset?: number; | ||
| virtualMcpId?: string; | ||
| startDate?: string; | ||
| endDate?: string; | ||
| search?: string; | ||
| status?: string; | ||
| agentId?: string; | ||
| }, | ||
| ): Promise<{ threads: Thread[]; total: number }> { | ||
| let query = this.db | ||
| .selectFrom("threads") | ||
|
|
@@ -252,6 +270,30 @@ export class SqlThreadStorage implements ThreadStoragePort { | |
| if (options?.virtualMcpId) { | ||
| query = query.where("virtual_mcp_id", "=", options.virtualMcpId); | ||
| } | ||
| if (options?.startDate) { | ||
| // updated_at is stored as ISO text — string comparison is correct for ISO dates | ||
| query = query.where( | ||
| "updated_at", | ||
| ">=", | ||
| options.startDate as unknown as Date, | ||
| ); | ||
| } | ||
| if (options?.endDate) { | ||
| query = query.where( | ||
| "updated_at", | ||
| "<=", | ||
| options.endDate as unknown as Date, | ||
| ); | ||
| } | ||
| if (options?.search) { | ||
| query = query.where("title", "ilike", `%${options.search}%`); | ||
| } | ||
| if (options?.status) { | ||
| query = query.where("status", "=", options.status as ThreadStatus); | ||
| } | ||
| if (options?.agentId) { | ||
| query = query.where("virtual_mcp_id", "=", options.agentId); | ||
| } | ||
|
|
||
| let countQuery = this.db | ||
| .selectFrom("threads") | ||
|
|
@@ -269,6 +311,33 @@ export class SqlThreadStorage implements ThreadStoragePort { | |
| options.virtualMcpId, | ||
| ); | ||
| } | ||
| if (options?.startDate) { | ||
| countQuery = countQuery.where( | ||
| "updated_at", | ||
| ">=", | ||
| options.startDate as unknown as Date, | ||
| ); | ||
| } | ||
| if (options?.endDate) { | ||
| countQuery = countQuery.where( | ||
| "updated_at", | ||
| "<=", | ||
| options.endDate as unknown as Date, | ||
| ); | ||
| } | ||
| if (options?.search) { | ||
| countQuery = countQuery.where("title", "ilike", `%${options.search}%`); | ||
| } | ||
| if (options?.status) { | ||
| countQuery = countQuery.where( | ||
| "status", | ||
| "=", | ||
| options.status as ThreadStatus, | ||
| ); | ||
| } | ||
| if (options?.agentId) { | ||
| countQuery = countQuery.where("virtual_mcp_id", "=", options.agentId); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: Count query applies Prompt for AI agents |
||
| } | ||
|
|
||
| if (options?.limit) { | ||
| query = query.limit(options.limit); | ||
|
|
||
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Agent filtering is applied to
virtual_mcp_idinstead ofagent_ids, so theagentIdfilter can return incorrect/no thread results.Prompt for AI agents