Files
goclaw/pkg/protocol/methods.go
T
1a42dc93a6 feat(teams): team system v2 with bug fixes, workspace scope, versioning, and prompt optimization (#183)
* feat(workspace): add team shared workspace for file collaboration

- Add workspace_write and workspace_read tools for agents to share files across team members
- Create team_workspaces DB table with migration 000017 (file metadata, pinning, tags)
- Implement PostgreSQL store layer for workspace CRUD operations
- Add RPC handlers for workspace list/read/delete from web UI
- Build React workspace tab with file listing, content preview, and delete
- Propagate workspace channel/chatID scope through delegation chain
- Auto-allow workspace tools in agent tool policy when agent belongs to a team
- Inject team workspace guidance into system prompt for team agents
- Add /reset command handler for clearing session history
- Harden MCP bridge context middleware to reject headers when no gateway token
- Add i18n strings for workspace UI in en/vi/zh locales

* feat(teams): add comprehensive task management with followup reminders and recovery

- Add task followup/reminder system with auto-set on lead agent reply and auto-clear when user responds on channel
- Add task recovery ticker to re-dispatch stale/pending tasks periodically
- Add task scopes, filtering by status/channel/chatID, and task events
- Add WS RPC handlers for task CRUD, assignments, comments, events, and bulk operations (teams_tasks.go)
- Add task detail dialog, settings UI for followup config, and scope filtering in web dashboard
- Add migrations 000018 (team_tasks_v2) and 000019 (task_followup)
- Extend team_tasks_tool with await_reply, clear_followup actions
- Auto-complete/fail team tasks when delegate agent finishes
- Add workspace file listing and team tool manager enhancements

* docs(teams): add team system architecture and playbook ideas documentation

- Add TEAM_SYSTEM.md with full architecture design covering task management, shared workspace, and delegation engine subsystems
- Add TEAM_PLAYBOOK_IDEAS.md outlining future team coordination layers (playbook, member capabilities, auto-learned patterns)
- Document data models, status flows, tool actions, followup reminder system, task ticker, execution locking, and workspace scope model

* fix(teams): resolve 6 critical bugs in team task system

- Fix unblock SQL: check array_length after array_remove (not before)
- Enforce single-team leadership in team creation
- Add requireLead() for approve/reject tool actions
- Validate cross-team dependency references in blocked_by
- Add team_id to handoff route for multi-team isolation
- Set blocked_by DEFAULT '{}' to prevent NULL array issues

* refactor(workspace): use stable userID as scope key instead of connection UUID

Workspace scope changed from (team_id, channel, chat_id) to (team_id, userID).
Fixes workspace fragmentation across WS tab refreshes and reconnections.

* feat(teams): add V1/V2 versioning with feature gating and optimized prompts

- IsTeamV2() helper gates advanced features (locking, followup, review, audit)
- V2 tool actions rejected for V1 teams with clear error message
- Ticker, gateway consumer, delegation hooks respect version flag
- TEAM.md renders v1/v2 sections conditionally
- Tool descriptions and params optimized (~38% token reduction)
- UI: version toggle in settings, V2 Beta badge, conditional rendering
- i18n: version modal keys for en/vi/zh

* fix(migration): use VARCHAR(255) for user ID columns and add metadata JSONB

- assignee_user_id, user_id, actor_id: TEXT → VARCHAR(255)
- Add metadata JSONB to team_task_comments and team_task_attachments

---------

Co-authored-by: Nam Nguyen Ngoc <namnn.0911@gmail.com>
2026-03-13 22:41:32 +07:00

157 lines
4.5 KiB
Go

package protocol
// RPC method name constants.
// Organized by priority: CRITICAL (Phase 1) → NEEDED (Phase 2) → NICE TO HAVE (Phase 3+).
// Phase 1 - CRITICAL methods
const (
// Agent
MethodAgent = "agent"
MethodAgentWait = "agent.wait"
MethodAgentIdentityGet = "agent.identity.get"
// Chat
MethodChatSend = "chat.send"
MethodChatHistory = "chat.history"
MethodChatAbort = "chat.abort"
MethodChatInject = "chat.inject"
// Agents management
MethodAgentsList = "agents.list"
MethodAgentsCreate = "agents.create"
MethodAgentsUpdate = "agents.update"
MethodAgentsDelete = "agents.delete"
MethodAgentsFileList = "agents.files.list"
MethodAgentsFileGet = "agents.files.get"
MethodAgentsFileSet = "agents.files.set"
// Config
MethodConfigGet = "config.get"
MethodConfigApply = "config.apply"
MethodConfigPatch = "config.patch"
MethodConfigSchema = "config.schema"
// Sessions
MethodSessionsList = "sessions.list"
MethodSessionsPreview = "sessions.preview"
MethodSessionsPatch = "sessions.patch"
MethodSessionsDelete = "sessions.delete"
MethodSessionsReset = "sessions.reset"
// System
MethodConnect = "connect"
MethodHealth = "health"
MethodStatus = "status"
)
// Phase 2 - NEEDED methods
const (
MethodSkillsList = "skills.list"
MethodSkillsGet = "skills.get"
MethodSkillsUpdate = "skills.update"
MethodCronList = "cron.list"
MethodCronCreate = "cron.create"
MethodCronUpdate = "cron.update"
MethodCronDelete = "cron.delete"
MethodCronToggle = "cron.toggle"
MethodCronStatus = "cron.status"
MethodCronRun = "cron.run"
MethodCronRuns = "cron.runs"
MethodChannelsList = "channels.list"
MethodChannelsStatus = "channels.status"
MethodChannelsToggle = "channels.toggle"
MethodPairingRequest = "device.pair.request"
MethodPairingApprove = "device.pair.approve"
MethodPairingDeny = "device.pair.deny"
MethodPairingList = "device.pair.list"
MethodPairingRevoke = "device.pair.revoke"
MethodBrowserPairingStatus = "browser.pairing.status"
MethodApprovalsList = "exec.approval.list"
MethodApprovalsApprove = "exec.approval.approve"
MethodApprovalsDeny = "exec.approval.deny"
MethodUsageGet = "usage.get"
MethodUsageSummary = "usage.summary"
MethodQuotaUsage = "quota.usage"
MethodSend = "send"
)
// Channel instances management
const (
MethodChannelInstancesList = "channels.instances.list"
MethodChannelInstancesGet = "channels.instances.get"
MethodChannelInstancesCreate = "channels.instances.create"
MethodChannelInstancesUpdate = "channels.instances.update"
MethodChannelInstancesDelete = "channels.instances.delete"
)
// Agent links (inter-agent delegation)
const (
MethodAgentsLinksList = "agents.links.list"
MethodAgentsLinksCreate = "agents.links.create"
MethodAgentsLinksUpdate = "agents.links.update"
MethodAgentsLinksDelete = "agents.links.delete"
)
// Agent teams
const (
MethodTeamsList = "teams.list"
MethodTeamsCreate = "teams.create"
MethodTeamsGet = "teams.get"
MethodTeamsDelete = "teams.delete"
MethodTeamsTaskList = "teams.tasks.list"
MethodTeamsTaskGet = "teams.tasks.get"
MethodTeamsTaskApprove = "teams.tasks.approve"
MethodTeamsTaskReject = "teams.tasks.reject"
MethodTeamsTaskComment = "teams.tasks.comment"
MethodTeamsTaskComments = "teams.tasks.comments"
MethodTeamsTaskEvents = "teams.tasks.events"
MethodTeamsTaskCreate = "teams.tasks.create"
MethodTeamsTaskAssign = "teams.tasks.assign"
MethodTeamsMembersAdd = "teams.members.add"
MethodTeamsMembersRemove = "teams.members.remove"
MethodTeamsUpdate = "teams.update"
MethodTeamsKnownUsers = "teams.known_users"
MethodTeamsScopes = "teams.scopes"
)
// Team workspace
const (
MethodTeamsWorkspaceList = "teams.workspace.list"
MethodTeamsWorkspaceRead = "teams.workspace.read"
MethodTeamsWorkspaceDelete = "teams.workspace.delete"
)
// Delegation history
const (
MethodDelegationsList = "delegations.list"
MethodDelegationsGet = "delegations.get"
)
// Phase 3+ - NICE TO HAVE methods
const (
MethodLogsTail = "logs.tail"
MethodTTSStatus = "tts.status"
MethodTTSEnable = "tts.enable"
MethodTTSDisable = "tts.disable"
MethodTTSConvert = "tts.convert"
MethodTTSSetProvider = "tts.setProvider"
MethodTTSProviders = "tts.providers"
MethodBrowserAct = "browser.act"
MethodBrowserSnapshot = "browser.snapshot"
MethodBrowserScreenshot = "browser.screenshot"
// Zalo Personal
MethodZaloPersonalQRStart = "zalo.personal.qr.start"
MethodZaloPersonalContacts = "zalo.personal.contacts"
)