-
Notifications
You must be signed in to change notification settings - Fork 95
Add ask_agent: agent-to-agent delegation via the embedded MCP server #893
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
Open
crspeller
wants to merge
33
commits into
master
Choose a base branch
from
cursor/agent-to-agent-delegation-b82c
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 23 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
65335c4
feat: plumb per-call tool-call ID into embedded MCP metadata; seed as…
cursoragent 50c2ee9
feat: ask_agent MCP tool, delegation service core, and delegated sub-…
cursoragent b5b6082
webapp: delegation card with live delegation_update progress and stat…
cursoragent 494c0f0
test: delegation service validation/state, ask_agent resolver, activi…
cursoragent e7adbb6
test: delegation sub-turn filtering, pending detection, and accepted-…
cursoragent f2a56b3
fix: nudge conversation refetch when async tool batches finish withou…
cursoragent 19ff605
webapp: reconcile terminal delegation cards for permalink and agent i…
cursoragent 20c10f3
e2e: agent delegation spec (DM, nested approval, channel share) + sha…
cursoragent 2974e68
eval: agent delegates via ask_agent when appropriate, answers directl…
cursoragent d46fc3a
docs: document ask_agent delegation in the admin guide
cursoragent 8139a34
style: gofmt and shadow fixes
cursoragent 34da370
fix: scope conversation refetch nudge to asynchronously executed batches
cursoragent e2492b5
webapp: delegation card unit tests and explicit i18n ids
cursoragent 50643de
test: initiator-only delegation status derivation
cursoragent 586d78e
fix: address review feedback on identity coupling, record durability,…
cursoragent 56f84ef
fix: claim tool approvals atomically with a content compare-and-set
cursoragent 9f5650d
test: cover the tool-approval content claim in fakes and postgres store
cursoragent 7556d5b
test: implement content claim in remaining conversation store fakes
cursoragent cc34b93
test: table-driven waiter registry; assert delegated task fidelity in…
cursoragent 40a869c
webapp: exclusive delegation card status, accessible task toggle, loc…
cursoragent d7a6c66
style: avoid identical-expression lint in waiter registry test
cursoragent 9bae590
fix: make delegation posts silent
cursoragent d2dd7ab
test: cover silent delegation posts
cursoragent 7ed66e7
fix: harden delegated approval continuations
cursoragent 8c3ef0f
test: make conversation CAS fakes faithful
cursoragent 64711fd
test: remove redundant raw message conversion
cursoragent 42e7fab
test: preserve raw message assertion types
cursoragent cbfae5f
feat: allow agents to delegate to themselves
cursoragent a09553f
fix: claim delegated approvals across UI surfaces
cursoragent 82f6c22
webapp: embed delegated approvals in parent cards
cursoragent 4bfee6c
test: satisfy inline approval lint
cursoragent 982a321
test: describe inline delegated approval flow
cursoragent 45367d7
Merge origin/master into agent delegation branch
cursoragent 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
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 |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| // Copyright (c) 2023-present Mattermost, Inc. All Rights Reserved. | ||
| // See LICENSE.txt for license information. | ||
|
|
||
| package api | ||
|
|
||
| import ( | ||
| "errors" | ||
| "net/http" | ||
|
|
||
| "github.com/gin-gonic/gin" | ||
| "github.com/mattermost/mattermost-plugin-agents/v2/delegation" | ||
| ) | ||
|
|
||
| // SetDelegationService sets the delegation service used by the delegation | ||
| // status endpoint. | ||
| func (a *API) SetDelegationService(svc *delegation.Service) { | ||
| a.delegationService = svc | ||
| } | ||
|
|
||
| // handleGetDelegationStatus returns the live status of a delegation keyed by | ||
| // the parent ask_agent tool call ID. Initiator-only: any other user (or an | ||
| // unknown ID) gets a 404 so existence is not leaked. | ||
| func (a *API) handleGetDelegationStatus(c *gin.Context) { | ||
| userID := c.GetHeader("Mattermost-User-Id") | ||
| parentToolCallID := c.Param("parenttoolcallid") | ||
|
|
||
| if a.delegationService == nil { | ||
| c.AbortWithStatus(http.StatusNotFound) | ||
| return | ||
| } | ||
|
|
||
| status, err := a.delegationService.StatusByParentToolCall(userID, parentToolCallID) | ||
| if err != nil { | ||
| if errors.Is(err, delegation.ErrNotConfigured) { | ||
| c.AbortWithStatus(http.StatusNotFound) | ||
| return | ||
| } | ||
| c.AbortWithError(http.StatusInternalServerError, err) | ||
| return | ||
| } | ||
| if status == nil { | ||
| // Expected for expired records, foreign users, and quick reconcile | ||
| // races — not an error worth logging. | ||
| c.AbortWithStatus(http.StatusNotFound) | ||
| return | ||
| } | ||
|
|
||
| c.JSON(http.StatusOK, status) | ||
| } |
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.