57adf1449c
* feat(review): persist and publish native code-review findings Adds the backend core for reviewing a task's working diff before a PR exists: task-scoped review runs and anchored, advisory findings that the Changes/Review panel can render as inline comments. - task_review_runs / task_review_findings schema, models, and repository, with supersede-on-re-review and a restart sweep that cancels in-flight runs rather than leaving them looking alive. - ReviewService as the single write path, publishing bus events that the WS gateway forwards to the client. - internal/review: reviewer-identity resolution (agent profile > code-review utility agent > user default, failing closed on passthrough-only profiles), change-set collection, prompt batching, response parsing, anchor extraction, and run orchestration. - publish_review_findings_kandev MCP tool plus the task.review.* WS actions. - Go djb2 that matches apps/web/lib/utils/hash.ts, asserted from shared fixtures on both sides so stale detection agrees across the wire. Spec: docs/specs/native-code-review/spec.md Plan: docs/plans/native-code-review/plan.md Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(review): add run_code_review workflow step and wire the review runner Makes a review pass triggerable both ways and actually runnable end to end. - run_code_review on_enter action across models, engine compile, and an orchestrator callback that logs rather than propagates failures, so a task never gets stuck in a step because no reviewer was configured. - The step's optional agent_profile_id is what lets a step review with a different model than it implemented with; export/import swap it for a portable agent name/model/mode so it survives a cross-workspace round trip instead of carrying a dangling id. - Concrete adapters for reviewer identity, changed-file collection, prompt rendering from the code-review utility agent's editable prompt, and inference (session-bound agentctl, falling back to the host instance so a review works on a task whose agent is not running). - Boot sweep cancels review runs interrupted by a restart; the E2E reset clears review state before deleting the tasks that own it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(web): add review findings state, helpers, and live updates Frontend plumbing for native code review, ahead of the UI that renders it. - Review types, WS message map, and an API client that preserves the backend's machine-readable failure code so the surface can show an actionable message. - A review store slice that merges findings by id (a re-publish refreshes an issue rather than listing it twice) and keeps a bounded run history. - Findings helpers: composite file keys matching reviewFileKey, staleness via the same per-file diff hash that drives review marks, and best-effort re-anchoring from the stored anchor text so a moved finding follows the code it was written about instead of pointing at whatever now occupies its line. - Hooks for backfill, resolve/dismiss/reopen with optimistic rollback, and sending a finding to the agent as follow-up context without changing its status — handing a finding to an agent is not the human accepting it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(web): render review findings inline in the Changes diff Findings now appear where the code is, in the same annotation surface as anchored review comments, with the run control that produces them. - ReviewFindingCard: severity chip, category, Markdown body, and the three advisory actions. A suggestion is labelled "not applied automatically" because it is display-only in this iteration. Resolved and dismissed findings collapse to one muted line with an Undo, so a reviewed diff does not stay cluttered while the human can still change their mind. - A review-finding annotation type threaded through the diff viewer, anchored from the same per-file diff hash the backend stamped. A finding whose diff moved is re-anchored from its stored text when that text survives, and otherwise reported as unanchored rather than placed against unrelated code. - Review changes control with idle / running / cancel / failed states, and an inline Settings link for the one failure the user can actually fix. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(web): make the review control reachable from the Review toolbar Mounts the Review changes control next to the walkthrough action and lets an inline finding wire its own actions. The finding card container now reads the active task and session from the store instead of taking four callbacks threaded through FileDiffViewer and DiffViewer; an inline finding annotation only exists when the active task has findings, so the store is always present and every other diff consumer is spared the plumbing. Staleness likewise hashes the diff the viewer already holds, which is already normalized, so it matches the hash the backend stamped without passing it down. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(web): surface stale review findings above their file's diff A finding whose diff moved and whose anchor text is gone had nowhere to render, so it was silently dropped. It now appears in a collapsed per-file banner above the diff: the finding may still be valid, and placing it at its stored line would point at whatever code now occupies that line instead. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * docs(review): mark the landed native code-review plan tasks done Tasks 01-09 (backend persistence through inline diff rendering) are implemented, tested, and committed. Tasks 10-13 — findings overview and step editor, mobile parity, E2E, and public docs — remain pending. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * test(review): cover the on-demand review path end to end Adds the mock-agent review responder and a Playwright spec, so both the happy path and the no-reviewer path are verified against a real backend. The mock agent answers any prompt carrying the review sentinel with fenced JSON, deriving its anchors from the prompt's own diff rather than hardcoding them, so findings land on files and lines the fixture really changed. It includes one deliberately malformed entry to exercise the rejected-entry path. Writing it caught an off-by-one shared by three diff walkers: splitting on "\n" leaves an empty element after a trailing newline, which carries no diff marker and was being counted as a context line, pushing new-side numbering one past the end of a hunk. Interior blank lines still count, since a whitespace-stripped blank context line legitimately appears as "". Also adds a listInferenceAgents helper: default_utility_agent_id needs the registered agent-type id, and an agent row UUID is rejected as not inference-capable. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(review): close review-run races and stale client findings Addresses the three blockers and three suggestions from the PR #1957 automated reviews. Two independent reviewers found each blocker separately. - Launch claimed the task slot only after inserting the run row, so two concurrent launches both created a run and the loser returned a pending row with no goroutine behind it — a review that never finished until the next restart. The slot is now claimed before any DB write, and freed on every early return. - Cancelling only marked the row. The goroutine ran on the shared background context, finished inference, and its completion overwrote the cancelled status and published findings the user had declined. Runs now carry a cancel handle, the WS action routes through the runner so the live context is cancelled, CompleteRun/FailRun refuse to resurrect a terminal run, and a cancelled pass neither publishes nor re-reports itself as failed. - The backend deletes a superseded finding and inserts a replacement with a new id, but the publish event carried only the new one, so every open browser showed both at the same anchor until a reload. The event now names the superseded ids and the slice drops them. - Run() waited on the shared WaitGroup, blocking on every other task's review; it now waits on its own pass only. - createReviewSlice is typed over the `set` it actually uses, so call sites no longer pass superfluous arguments (CodeQL js/superfluous-trailing-arguments). - A GetAgentProfile fault no longer collapses into "profile not found", which would have told the user to configure an agent they already have. The cancel bug exposed a hole in the original tests: they asserted cancel could not override a terminal run, but never the reverse. Both directions are covered now, along with the concurrent-launch race, per-run waiting, and the supersede path on both sides of the wire. Test fakes now mirror the service's terminal guard rather than hiding it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Kandev Agent <agent@kandev.dev> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
605 lines
29 KiB
Go
605 lines
29 KiB
Go
package websocket
|
|
|
|
// Action constants for WebSocket messages
|
|
const (
|
|
// Health
|
|
ActionHealthCheck = "health.check"
|
|
|
|
// Workflow actions
|
|
ActionWorkflowList = "workflow.list"
|
|
ActionWorkflowCreate = "workflow.create"
|
|
ActionWorkflowGet = "workflow.get"
|
|
ActionWorkflowUpdate = "workflow.update"
|
|
ActionWorkflowDelete = "workflow.delete"
|
|
ActionWorkflowReorder = "workflow.reorder"
|
|
|
|
// Workspace actions
|
|
ActionWorkspaceList = "workspace.list"
|
|
ActionWorkspaceCreate = "workspace.create"
|
|
ActionWorkspaceGet = "workspace.get"
|
|
ActionWorkspaceUpdate = "workspace.update"
|
|
ActionWorkspaceDelete = "workspace.delete"
|
|
|
|
// Repository actions
|
|
ActionRepositoryList = "repository.list"
|
|
ActionRepositoryCreate = "repository.create"
|
|
ActionRepositoryGet = "repository.get"
|
|
ActionRepositoryUpdate = "repository.update"
|
|
ActionRepositoryDelete = "repository.delete"
|
|
|
|
// Repository Script actions
|
|
ActionRepositoryScriptList = "repository.script.list"
|
|
ActionRepositoryScriptCreate = "repository.script.create"
|
|
ActionRepositoryScriptGet = "repository.script.get"
|
|
ActionRepositoryScriptUpdate = "repository.script.update"
|
|
ActionRepositoryScriptDelete = "repository.script.delete"
|
|
|
|
// Executor actions
|
|
ActionExecutorList = "executor.list"
|
|
ActionExecutorCreate = "executor.create"
|
|
ActionExecutorGet = "executor.get"
|
|
ActionExecutorUpdate = "executor.update"
|
|
ActionExecutorDelete = "executor.delete"
|
|
|
|
// Executor profile actions
|
|
ActionExecutorProfileList = "executor.profile.list"
|
|
ActionExecutorProfileListAll = "executor.profile.list_all"
|
|
ActionExecutorProfileCreate = "executor.profile.create"
|
|
ActionExecutorProfileGet = "executor.profile.get"
|
|
ActionExecutorProfileUpdate = "executor.profile.update"
|
|
ActionExecutorProfileDelete = "executor.profile.delete"
|
|
|
|
// Environment actions
|
|
ActionEnvironmentList = "environment.list"
|
|
ActionEnvironmentCreate = "environment.create"
|
|
ActionEnvironmentGet = "environment.get"
|
|
ActionEnvironmentUpdate = "environment.update"
|
|
ActionEnvironmentDelete = "environment.delete"
|
|
|
|
// Task actions
|
|
ActionTaskList = "task.list"
|
|
ActionTaskCreate = "task.create"
|
|
ActionTaskGet = "task.get"
|
|
ActionTaskUpdate = "task.update"
|
|
ActionTaskRepoUpdate = "task.repository.update"
|
|
ActionTaskDelete = "task.delete"
|
|
ActionTaskMove = "task.move"
|
|
ActionTaskState = "task.state"
|
|
ActionTaskArchive = "task.archive"
|
|
ActionTaskPlanCreate = "task.plan.create"
|
|
ActionTaskPlanGet = "task.plan.get"
|
|
ActionTaskPlanUpdate = "task.plan.update"
|
|
ActionTaskPlanDelete = "task.plan.delete"
|
|
ActionTaskPlanRevisionsList = "task.plan.revisions.list"
|
|
ActionTaskPlanRevisionGet = "task.plan.revision.get"
|
|
ActionTaskPlanRevert = "task.plan.revert"
|
|
ActionTaskPlanImplement = "task.plan.implementation_started"
|
|
|
|
ActionTaskSessionList = "task.session.list"
|
|
ActionTaskSessionStatus = "task.session.status"
|
|
|
|
// Unified session launch
|
|
ActionSessionLaunch = "session.launch"
|
|
ActionSessionEnsure = "session.ensure"
|
|
ActionSessionRecover = "session.recover"
|
|
ActionSessionResetContext = "session.reset_context"
|
|
ActionSessionStop = "session.stop"
|
|
ActionSessionDelete = "session.delete"
|
|
ActionSessionSetPrimary = "session.set_primary"
|
|
ActionSessionSetPlanMode = "session.set_plan_mode"
|
|
ActionSessionRename = "session.rename"
|
|
|
|
// Agent actions
|
|
ActionAgentList = "agent.list"
|
|
ActionAgentLaunch = "agent.launch"
|
|
ActionAgentStatus = "agent.status"
|
|
ActionAgentLogs = "agent.logs"
|
|
ActionAgentStop = "agent.stop"
|
|
ActionAgentPrompt = "agent.prompt"
|
|
ActionAgentCancel = "agent.cancel"
|
|
ActionTaskSession = "task.session"
|
|
ActionAgentTypes = "agent.types"
|
|
|
|
// Agent passthrough actions
|
|
ActionAgentStdin = "agent.stdin" // Send input to agent process stdin (passthrough mode)
|
|
ActionAgentStdout = "agent.stdout" // Agent stdout notification (passthrough mode)
|
|
ActionAgentResize = "agent.resize" // Resize agent PTY (passthrough mode)
|
|
|
|
// Orchestrator actions
|
|
ActionOrchestratorStatus = "orchestrator.status"
|
|
ActionOrchestratorQueue = "orchestrator.queue"
|
|
ActionOrchestratorStop = "orchestrator.stop"
|
|
|
|
// Message Queue actions
|
|
ActionMessageQueueAdd = "message.queue.add"
|
|
ActionMessageQueueCancel = "message.queue.cancel" // Clears the entire queue for a session
|
|
ActionMessageQueueGet = "message.queue.get"
|
|
ActionMessageQueueUpdate = "message.queue.update"
|
|
ActionMessageQueueAppend = "message.queue.append"
|
|
ActionMessageQueueDrain = "message.queue.drain" // Dispatch one queued entry now when the session is promptable
|
|
ActionMessageQueueRemove = "message.queue.remove" // Delete a single entry by id
|
|
ActionMessageQueueStatusChanged = "message.queue.status_changed" // Notification: queue status changed
|
|
|
|
// Workflow template/step actions
|
|
ActionWorkflowTemplateList = "workflow.template.list"
|
|
ActionWorkflowTemplateGet = "workflow.template.get"
|
|
ActionWorkflowStepList = "workflow.step.list"
|
|
ActionWorkflowStepGet = "workflow.step.get"
|
|
ActionWorkflowStepCreate = "workflow.step.create"
|
|
ActionWorkflowHistoryList = "workflow.history.list"
|
|
|
|
// Subscription actions
|
|
ActionTaskSubscribe = "task.subscribe"
|
|
ActionTaskUnsubscribe = "task.unsubscribe"
|
|
ActionSessionSubscribe = "session.subscribe"
|
|
ActionSessionUnsubscribe = "session.unsubscribe"
|
|
// Focus signals are layered on top of subscriptions to indicate which
|
|
// session the user is actively viewing (task details page or task panel),
|
|
// vs merely subscribed (sidebar diff badges). Drives backend polling tier.
|
|
ActionSessionFocus = "session.focus"
|
|
ActionSessionUnfocus = "session.unfocus"
|
|
ActionUserSubscribe = "user.subscribe"
|
|
ActionUserUnsubscribe = "user.unsubscribe"
|
|
ActionRunSubscribe = "run.subscribe"
|
|
ActionRunUnsubscribe = "run.unsubscribe"
|
|
ActionSystemMetricsSubscribe = "system.metrics.subscribe"
|
|
ActionSystemMetricsUnsubscribe = "system.metrics.unsubscribe"
|
|
|
|
// Message actions
|
|
ActionMessageAdd = "message.add"
|
|
ActionMessageGet = "message.get"
|
|
ActionMessageList = "message.list"
|
|
ActionMessageSearch = "message.search"
|
|
|
|
// Notification actions (server -> client)
|
|
ActionACPProgress = "acp.progress"
|
|
ActionACPLog = "acp.log"
|
|
ActionACPResult = "acp.result"
|
|
ActionACPError = "acp.error"
|
|
ActionACPStatus = "acp.status"
|
|
ActionACPHeartbeat = "acp.heartbeat"
|
|
ActionTaskCreated = "task.created"
|
|
ActionTaskUpdated = "task.updated"
|
|
ActionTaskDeleted = "task.deleted"
|
|
ActionTaskStateChanged = "task.state_changed"
|
|
ActionSessionWorkspaceSourcesUpdated = "session.workspace_sources.updated"
|
|
ActionTaskPlanCreated = "task.plan.created"
|
|
ActionTaskPlanUpdated = "task.plan.updated"
|
|
ActionTaskPlanDeleted = "task.plan.deleted"
|
|
ActionTaskPlanRevisionCreated = "task.plan.revision.created"
|
|
ActionTaskPlanReverted = "task.plan.reverted"
|
|
ActionTaskWalkthroughGet = "task.walkthrough.get"
|
|
ActionTaskWalkthroughDelete = "task.walkthrough.delete"
|
|
ActionTaskWalkthroughCreated = "task.walkthrough.created"
|
|
ActionTaskWalkthroughUpdated = "task.walkthrough.updated"
|
|
ActionTaskWalkthroughDeleted = "task.walkthrough.deleted"
|
|
|
|
// Native code review. The *.run / *.cancel / *.get / *.finding.update /
|
|
// *.clear actions are client requests; the rest are server notifications.
|
|
ActionTaskReviewRun = "task.review.run"
|
|
ActionTaskReviewCancel = "task.review.cancel"
|
|
ActionTaskReviewGet = "task.review.get"
|
|
ActionTaskReviewFindingUpdate = "task.review.finding.update"
|
|
ActionTaskReviewClear = "task.review.clear"
|
|
ActionTaskReviewRunUpdated = "task.review.run_updated"
|
|
ActionTaskReviewFindingsPublished = "task.review.findings_published"
|
|
ActionTaskReviewFindingUpdated = "task.review.finding_updated"
|
|
ActionTaskReviewCleared = "task.review.cleared"
|
|
ActionAgentUpdated = "agent.updated"
|
|
ActionAgentAvailableUpdated = "agent.available.updated"
|
|
ActionAgentInstallStarted = "agent.install.started"
|
|
ActionAgentInstallOutput = "agent.install.output"
|
|
ActionAgentInstallFinished = "agent.install.finished"
|
|
ActionWorkspaceCreated = "workspace.created"
|
|
ActionWorkspaceUpdated = "workspace.updated"
|
|
ActionWorkspaceDeleted = "workspace.deleted"
|
|
ActionWorkflowCreated = "workflow.created"
|
|
ActionWorkflowUpdated = "workflow.updated"
|
|
ActionWorkflowDeleted = "workflow.deleted"
|
|
ActionWorkflowStepCreated = "workflow.step.created"
|
|
ActionWorkflowStepUpdated = "workflow.step.updated"
|
|
ActionWorkflowStepDeleted = "workflow.step.deleted"
|
|
ActionSessionMessageAdded = "session.message.added"
|
|
ActionSessionMessageUpdated = "session.message.updated"
|
|
ActionSessionMessageDeleted = "session.message.deleted"
|
|
ActionSessionStateChanged = "session.state_changed"
|
|
ActionSessionActivityChanged = "session.activity_changed"
|
|
ActionSessionAgentctlStarting = "session.agentctl_starting"
|
|
ActionSessionAgentctlReady = "session.agentctl_ready"
|
|
ActionSessionAgentctlError = "session.agentctl_error"
|
|
ActionSessionTurnStarted = "session.turn.started"
|
|
ActionSessionTurnCompleted = "session.turn.completed"
|
|
ActionSessionAvailableCommands = "session.available_commands"
|
|
ActionSessionModeChanged = "session.mode_changed"
|
|
ActionSessionAgentCapabilities = "session.agent_capabilities"
|
|
ActionSessionModelsUpdated = "session.models_updated"
|
|
ActionSessionInfoUpdated = "session.info_updated"
|
|
ActionSessionSetMode = "session.set_mode"
|
|
ActionSessionTodosUpdated = "session.todos_updated"
|
|
ActionSessionPromptUsage = "session.prompt_usage"
|
|
ActionSessionPollModeChanged = "session.poll_mode_changed"
|
|
ActionInputRequested = "input.requested"
|
|
ActionRepositoryCreated = "repository.created"
|
|
ActionRepositoryUpdated = "repository.updated"
|
|
ActionRepositoryDeleted = "repository.deleted"
|
|
ActionRepositoryScriptCreated = "repository.script.created"
|
|
ActionRepositoryScriptUpdated = "repository.script.updated"
|
|
ActionRepositoryScriptDeleted = "repository.script.deleted"
|
|
ActionExecutorCreated = "executor.created"
|
|
ActionExecutorUpdated = "executor.updated"
|
|
ActionExecutorDeleted = "executor.deleted"
|
|
ActionEnvironmentCreated = "environment.created"
|
|
ActionEnvironmentUpdated = "environment.updated"
|
|
ActionEnvironmentDeleted = "environment.deleted"
|
|
ActionExecutorProfileCreated = "executor.profile.created"
|
|
ActionExecutorProfileUpdated = "executor.profile.updated"
|
|
ActionExecutorProfileDeleted = "executor.profile.deleted"
|
|
ActionExecutorPrepareProgress = "executor.prepare.progress"
|
|
ActionExecutorPrepareCompleted = "executor.prepare.completed"
|
|
ActionSystemMetricsUpdated = "system.metrics.updated"
|
|
ActionUpdateAvailable = "system.update_available"
|
|
|
|
ActionAgentProfileDeleted = "agent.profile.deleted"
|
|
ActionAgentProfileCreated = "agent.profile.created"
|
|
ActionAgentProfileUpdated = "agent.profile.updated"
|
|
|
|
// Permission request actions (agent -> user -> agent)
|
|
ActionPermissionRequested = "permission.requested" // Agent requesting permission
|
|
ActionPermissionRespond = "permission.respond" // User responding to permission request
|
|
|
|
// Workspace file operations
|
|
ActionWorkspaceFileTreeGet = "workspace.tree.get"
|
|
ActionWorkspaceFileContentGet = "workspace.file.get"
|
|
ActionWorkspaceFileContentGetRef = "workspace.file.get_at_ref"
|
|
ActionWorkspaceFileContentUpdate = "workspace.file.update"
|
|
ActionWorkspaceFileCreate = "workspace.file.create"
|
|
ActionWorkspaceFileDelete = "workspace.file.delete"
|
|
ActionWorkspaceFileRename = "workspace.file.rename"
|
|
ActionWorkspaceFilesSearch = "workspace.files.search"
|
|
ActionWorkspaceFileChanges = "session.workspace.file.changes" // Notification
|
|
|
|
// Shell actions
|
|
ActionShellStatus = "session.shell.status" // Get shell status
|
|
ActionShellSubscribe = "shell.subscribe" // Subscribe to shell output
|
|
ActionShellInput = "shell.input" // Send input to shell
|
|
ActionSessionShellOutput = "session.shell.output" // Shell output notification (also used for exit with type: "exit")
|
|
|
|
// User shell actions (independent terminal tabs)
|
|
ActionUserShellList = "user_shell.list" // List user shells for a task (DB rows + agentctl probes)
|
|
ActionUserShellCreate = "user_shell.create" // Create a new user shell terminal (assigns ID + seq)
|
|
ActionUserShellStop = "user_shell.stop" // Legacy alias of destroy; kept for one release
|
|
ActionUserShellRename = "user_shell.rename" // Rename an ordinary user shell (set/clear custom_name)
|
|
ActionUserShellPark = "user_shell.park" // Hide tab; PTY continues running
|
|
ActionUserShellResume = "user_shell.resume" // Unhide a parked tab
|
|
ActionUserShellDestroy = "user_shell.destroy" // Stop the PTY and delete the row
|
|
|
|
// Session file review actions
|
|
ActionSessionFileReviewGet = "session.file_review.get" // Get all file reviews for a session
|
|
ActionSessionFileReviewUpdate = "session.file_review.update" // Upsert a single file review
|
|
ActionSessionFileReviewReset = "session.file_review.reset" // Delete all reviews for a session
|
|
|
|
// Session git actions (requests)
|
|
ActionSessionGitSnapshots = "session.git.snapshots" // Get git snapshots for a session
|
|
ActionSessionGitCommits = "session.git.commits" // Get commits for a session
|
|
ActionSessionCumulativeDiff = "session.cumulative_diff" // Get cumulative diff from base branch
|
|
ActionSessionCommitDiff = "session.commit_diff" // Get diff for a specific commit
|
|
|
|
// Session git event (unified notification)
|
|
ActionSessionGitEvent = "session.git.event" // Notification: unified git event
|
|
|
|
// Process runner actions
|
|
ActionSessionProcessOutput = "session.process.output"
|
|
ActionSessionProcessStatus = "session.process.status"
|
|
|
|
// Git worktree actions
|
|
ActionWorktreePull = "worktree.pull" // Pull from remote
|
|
ActionWorktreePush = "worktree.push" // Push to remote
|
|
ActionWorktreeRebase = "worktree.rebase" // Rebase onto base branch
|
|
ActionWorktreeMerge = "worktree.merge" // Merge base branch into worktree
|
|
ActionWorktreeAbort = "worktree.abort" // Abort in-progress merge or rebase
|
|
ActionWorktreeCommit = "worktree.commit" // Commit changes
|
|
ActionWorktreeStage = "worktree.stage" // Stage files for commit
|
|
ActionWorktreeUnstage = "worktree.unstage" // Unstage files from index
|
|
ActionWorktreeDiscard = "worktree.discard" // Discard changes to files
|
|
ActionWorktreeCreatePR = "worktree.create_pr" // Create a pull request
|
|
ActionWorktreeRevertCommit = "worktree.revert_commit" // Revert a commit (staged, no new commit)
|
|
ActionWorktreeRenameBranch = "worktree.rename_branch" // Rename the current branch
|
|
ActionWorktreeReset = "worktree.reset" // Reset HEAD to a commit (soft/hard)
|
|
|
|
// User actions
|
|
ActionUserGet = "user.get"
|
|
ActionUserSettingsUpdate = "user.settings.update"
|
|
ActionUserSettingsUpdated = "user.settings.updated"
|
|
|
|
// System maintenance jobs (VACUUM, factory reset, snapshot create/restore,
|
|
// disk walk). Broadcast to all connected clients so the System pages can
|
|
// render progress.
|
|
ActionSystemJobUpdate = "system.job.update"
|
|
|
|
// VS Code server actions
|
|
ActionVscodeStart = "vscode.start" // Start code-server for a session
|
|
ActionVscodeStop = "vscode.stop" // Stop code-server for a session
|
|
ActionVscodeStatus = "vscode.status" // Get code-server status for a session
|
|
ActionVscodeOpenFile = "vscode.openFile" // Open a file in code-server for a session
|
|
|
|
// Port actions
|
|
ActionPortList = "port.list" // List listening ports on a remote executor
|
|
ActionPortTunnelStart = "port.tunnel.start" // Start a port tunnel
|
|
ActionPortTunnelStop = "port.tunnel.stop" // Stop a port tunnel
|
|
ActionPortTunnelList = "port.tunnel.list" // List active port tunnels
|
|
|
|
// Secret actions
|
|
ActionSecretList = "secrets.list"
|
|
ActionSecretCreate = "secrets.create"
|
|
ActionSecretUpdate = "secrets.update"
|
|
ActionSecretDelete = "secrets.delete"
|
|
ActionSecretReveal = "secrets.reveal"
|
|
|
|
// Sprites actions
|
|
ActionSpritesStatus = "sprites.status"
|
|
ActionSpritesInstancesList = "sprites.instances.list"
|
|
ActionSpritesInstancesDestroy = "sprites.instances.destroy"
|
|
ActionSpritesTest = "sprites.test"
|
|
ActionSpritesNetworkPolicyGet = "sprites.network_policy.get"
|
|
ActionSpritesNetworkPolicyUpdate = "sprites.network_policy.update"
|
|
|
|
// MCP tool actions (agentctl -> backend via WS tunnel)
|
|
ActionMCPListWorkspaces = "mcp.list_workspaces"
|
|
ActionMCPListWorkflows = "mcp.list_workflows"
|
|
ActionMCPListWorkflowSteps = "mcp.list_workflow_steps"
|
|
ActionMCPListRepositories = "mcp.list_repositories"
|
|
ActionMCPListTasks = "mcp.list_tasks"
|
|
ActionMCPCreateTask = "mcp.create_task"
|
|
ActionMCPUpdateTask = "mcp.update_task"
|
|
ActionMCPAddBranchToTask = "mcp.add_branch_to_task"
|
|
ActionMCPAddWorkspaceSources = "mcp.add_workspace_sources"
|
|
ActionMCPUpdateRepositoryBaseBranch = "mcp.update_repository_base_branch"
|
|
ActionMCPStepComplete = "mcp.step_complete" // ADR 0015: agent-emitted explicit completion signal
|
|
ActionMCPAskUserQuestion = "mcp.ask_user_question"
|
|
ActionMCPCreateTaskPlan = "mcp.create_task_plan"
|
|
ActionMCPGetTaskPlan = "mcp.get_task_plan"
|
|
ActionMCPUpdateTaskPlan = "mcp.update_task_plan"
|
|
ActionMCPDeleteTaskPlan = "mcp.delete_task_plan"
|
|
ActionMCPShowWalkthrough = "mcp.show_walkthrough"
|
|
ActionMCPGetWalkthrough = "mcp.get_walkthrough"
|
|
ActionMCPDeleteWalkthrough = "mcp.delete_walkthrough"
|
|
ActionMCPPublishReviewFindings = "mcp.publish_review_findings"
|
|
ActionMCPClarificationTimeout = "mcp.clarification_timeout"
|
|
|
|
// Office task handoffs (cross-task context).
|
|
ActionMCPListRelatedTasks = "mcp.list_related_tasks"
|
|
ActionMCPListTaskDocuments = "mcp.list_task_documents"
|
|
ActionMCPGetTaskDocument = "mcp.get_task_document"
|
|
ActionMCPWriteTaskDocument = "mcp.write_task_document"
|
|
|
|
// Config-mode MCP actions (agent-native configuration)
|
|
ActionMCPCreateWorkflow = "mcp.create_workflow"
|
|
ActionMCPUpdateWorkflow = "mcp.update_workflow"
|
|
ActionMCPDeleteWorkflow = "mcp.delete_workflow"
|
|
ActionMCPImportWorkflow = "mcp.import_workflow"
|
|
|
|
ActionMCPCreateWorkflowStep = "mcp.create_workflow_step"
|
|
ActionMCPUpdateWorkflowStep = "mcp.update_workflow_step"
|
|
ActionMCPDeleteWorkflowStep = "mcp.delete_workflow_step"
|
|
ActionMCPReorderWorkflowStep = "mcp.reorder_workflow_steps"
|
|
|
|
ActionMCPListAgents = "mcp.list_agents"
|
|
ActionMCPUpdateAgent = "mcp.update_agent"
|
|
|
|
ActionMCPListAgentProfiles = "mcp.list_agent_profiles"
|
|
ActionMCPCreateAgentProfile = "mcp.create_agent_profile"
|
|
ActionMCPUpdateAgentProfile = "mcp.update_agent_profile"
|
|
ActionMCPDeleteAgentProfile = "mcp.delete_agent_profile"
|
|
ActionMCPGetMcpConfig = "mcp.get_mcp_config"
|
|
ActionMCPUpdateMcpConfig = "mcp.update_mcp_config"
|
|
|
|
ActionMCPListExecutors = "mcp.list_executors"
|
|
ActionMCPListExecutorProfiles = "mcp.list_executor_profiles"
|
|
ActionMCPCreateExecutorProfile = "mcp.create_executor_profile"
|
|
ActionMCPUpdateExecutorProfile = "mcp.update_executor_profile"
|
|
ActionMCPDeleteExecutorProfile = "mcp.delete_executor_profile"
|
|
|
|
ActionMCPMoveTask = "mcp.move_task"
|
|
ActionMCPDeleteTask = "mcp.delete_task"
|
|
ActionMCPArchiveTask = "mcp.archive_task"
|
|
ActionMCPUpdateTaskState = "mcp.update_task_state"
|
|
ActionMCPMessageTask = "mcp.message_task"
|
|
ActionMCPStopTask = "mcp.stop_task"
|
|
ActionMCPSpawnSession = "mcp.spawn_session"
|
|
ActionMCPGetTaskConversation = "mcp.get_task_conversation"
|
|
)
|
|
|
|
const (
|
|
ActionSessionTurnFinished = "session.turn_finished"
|
|
ActionSessionClarificationRequested = "session.clarification_requested"
|
|
ActionOfficeInboxItem = "office.inbox_item"
|
|
)
|
|
|
|
// GitHub integration actions
|
|
const (
|
|
ActionGitHubStatus = "github.status"
|
|
ActionGitHubTaskPRsList = "github.task_prs.list"
|
|
ActionGitHubTaskPRGet = "github.task_pr.get"
|
|
ActionGitHubPRFeedbackGet = "github.pr_feedback.get"
|
|
ActionGitHubReviewWatchesList = "github.review_watches.list"
|
|
ActionGitHubReviewWatchCreate = "github.review_watches.create"
|
|
ActionGitHubReviewWatchUpdate = "github.review_watches.update"
|
|
ActionGitHubReviewWatchDelete = "github.review_watches.delete"
|
|
ActionGitHubReviewTrigger = "github.review_watches.trigger"
|
|
ActionGitHubReviewTriggerAll = "github.review_watches.trigger_all"
|
|
ActionGitHubPRWatchesList = "github.pr_watches.list"
|
|
ActionGitHubPRWatchDelete = "github.pr_watches.delete"
|
|
ActionGitHubPRFilesGet = "github.pr_files.get"
|
|
ActionGitHubPRCommitsGet = "github.pr_commits.get"
|
|
ActionGitHubTaskPRUpdated = "github.task_pr.updated" // Notification
|
|
ActionGitHubTaskCIOptionsUpdated = "github.task_ci_options.updated" // Notification
|
|
ActionGitHubRateLimitUpdated = "github.rate_limit.updated" // Notification
|
|
ActionGitHubPRFeedbackNotify = "github.pr_feedback.notify" // Notification
|
|
ActionGitHubNewReviewPRNotify = "github.new_review_pr.notify" // Notification
|
|
ActionGitHubTaskPRSync = "github.task_pr.sync"
|
|
ActionGitHubStats = "github.stats"
|
|
ActionGitHubCheckSessionPR = "github.check_session_pr"
|
|
|
|
// Issue watch actions
|
|
ActionGitHubIssueWatchesList = "github.issue_watches.list"
|
|
ActionGitHubIssueWatchCreate = "github.issue_watches.create"
|
|
ActionGitHubIssueWatchUpdate = "github.issue_watches.update"
|
|
ActionGitHubIssueWatchDelete = "github.issue_watches.delete"
|
|
ActionGitHubIssueTrigger = "github.issue_watches.trigger"
|
|
ActionGitHubIssueTriggerAll = "github.issue_watches.trigger_all"
|
|
ActionGitHubNewIssueNotify = "github.new_issue.notify" // Notification
|
|
|
|
// Action preset actions for the /github page quick-launch prompts.
|
|
ActionGitHubActionPresetsList = "github.action_presets.list"
|
|
ActionGitHubActionPresetsUpdate = "github.action_presets.update"
|
|
ActionGitHubActionPresetsReset = "github.action_presets.reset"
|
|
|
|
// Manual cleanup sweeps over all dedup rows (review/issue). Used by the
|
|
// settings-page button so users can drain piled-up tasks on demand.
|
|
ActionGitHubCleanupReviewTasks = "github.cleanup.review_tasks"
|
|
ActionGitHubCleanupIssueTasks = "github.cleanup.issue_tasks"
|
|
)
|
|
|
|
// GitLab integration actions
|
|
const (
|
|
ActionGitLabStatus = "gitlab.status"
|
|
ActionGitLabTaskMRsList = "gitlab.task_mrs.list"
|
|
ActionGitLabTaskMRGet = "gitlab.task_mr.get"
|
|
ActionGitLabMRFeedbackGet = "gitlab.mr_feedback.get"
|
|
ActionGitLabReviewWatchesList = "gitlab.review_watches.list"
|
|
ActionGitLabReviewWatchCreate = "gitlab.review_watches.create"
|
|
ActionGitLabReviewWatchUpdate = "gitlab.review_watches.update"
|
|
ActionGitLabReviewWatchDelete = "gitlab.review_watches.delete"
|
|
ActionGitLabReviewTrigger = "gitlab.review_watches.trigger"
|
|
ActionGitLabReviewTriggerAll = "gitlab.review_watches.trigger_all"
|
|
ActionGitLabMRWatchesList = "gitlab.mr_watches.list"
|
|
ActionGitLabMRWatchDelete = "gitlab.mr_watches.delete"
|
|
ActionGitLabMRFilesGet = "gitlab.mr_files.get"
|
|
ActionGitLabMRCommitsGet = "gitlab.mr_commits.get"
|
|
ActionGitLabTaskMRUpdated = "gitlab.task_mr.updated" // Notification
|
|
ActionGitLabMRFeedbackNotify = "gitlab.mr_feedback.notify" // Notification
|
|
ActionGitLabNewReviewMRNotify = "gitlab.new_review_mr.notify" // Notification
|
|
ActionGitLabTaskMRSync = "gitlab.task_mr.sync"
|
|
ActionGitLabStats = "gitlab.stats"
|
|
|
|
ActionGitLabMRMerge = "gitlab.mr.merge"
|
|
ActionGitLabMRApprove = "gitlab.mr.approve"
|
|
ActionGitLabMRUnapprove = "gitlab.mr.unapprove"
|
|
ActionGitLabMRSetLabels = "gitlab.mr.set_labels"
|
|
ActionGitLabMRSetAssignees = "gitlab.mr.set_assignees"
|
|
ActionGitLabMRDiscussionNew = "gitlab.mr.discussion.new"
|
|
ActionGitLabMRDiscussionResolve = "gitlab.mr.discussion.resolve"
|
|
ActionGitLabProjectMergeMethodsGet = "gitlab.project.merge_methods.get"
|
|
|
|
// Issue watch actions
|
|
ActionGitLabIssueWatchesList = "gitlab.issue_watches.list"
|
|
ActionGitLabIssueWatchCreate = "gitlab.issue_watches.create"
|
|
ActionGitLabIssueWatchUpdate = "gitlab.issue_watches.update"
|
|
ActionGitLabIssueWatchDelete = "gitlab.issue_watches.delete"
|
|
ActionGitLabIssueTrigger = "gitlab.issue_watches.trigger"
|
|
ActionGitLabIssueTriggerAll = "gitlab.issue_watches.trigger_all"
|
|
ActionGitLabNewIssueNotify = "gitlab.new_issue.notify" // Notification
|
|
|
|
// Action preset actions for the /gitlab page quick-launch prompts.
|
|
ActionGitLabActionPresetsList = "gitlab.action_presets.list"
|
|
ActionGitLabActionPresetsUpdate = "gitlab.action_presets.update"
|
|
ActionGitLabActionPresetsReset = "gitlab.action_presets.reset"
|
|
|
|
// Project discovery / autocomplete.
|
|
ActionGitLabListUserProjects = "gitlab.projects.list"
|
|
ActionGitLabSearchProjects = "gitlab.projects.search"
|
|
ActionGitLabProjectBranches = "gitlab.project.branches"
|
|
|
|
// Manual cleanup sweeps.
|
|
ActionGitLabCleanupReviewTasks = "gitlab.cleanup.review_tasks"
|
|
ActionGitLabCleanupIssueTasks = "gitlab.cleanup.issue_tasks"
|
|
)
|
|
|
|
// Jira integration actions
|
|
const (
|
|
ActionJiraConfigGet = "jira.config.get"
|
|
ActionJiraConfigSet = "jira.config.set"
|
|
ActionJiraConfigDelete = "jira.config.delete"
|
|
ActionJiraConfigTest = "jira.config.test"
|
|
ActionJiraTicketGet = "jira.ticket.get"
|
|
ActionJiraTicketTransition = "jira.ticket.transition"
|
|
ActionJiraProjectsList = "jira.projects.list"
|
|
)
|
|
|
|
// Linear integration actions
|
|
const (
|
|
ActionLinearConfigGet = "linear.config.get"
|
|
ActionLinearConfigSet = "linear.config.set"
|
|
ActionLinearConfigDelete = "linear.config.delete"
|
|
ActionLinearConfigTest = "linear.config.test"
|
|
ActionLinearIssueGet = "linear.issue.get"
|
|
ActionLinearIssueTransition = "linear.issue.transition"
|
|
ActionLinearTeamsList = "linear.teams.list"
|
|
)
|
|
|
|
// Slack integration actions
|
|
const (
|
|
ActionSlackConfigGet = "slack.config.get"
|
|
ActionSlackConfigSet = "slack.config.set"
|
|
ActionSlackConfigDelete = "slack.config.delete"
|
|
ActionSlackConfigTest = "slack.config.test"
|
|
)
|
|
|
|
// Office notification actions (server -> client)
|
|
const (
|
|
ActionOfficeTaskUpdated = "office.task.updated"
|
|
ActionOfficeTaskCreated = "office.task.created"
|
|
ActionOfficeTaskMoved = "office.task.moved"
|
|
ActionOfficeTaskStatus = "office.task.status_changed"
|
|
ActionOfficeTaskDecision = "office.task.decision_recorded"
|
|
ActionOfficeTaskReview = "office.task.review_requested"
|
|
ActionOfficeCommentCreated = "office.comment.created"
|
|
ActionOfficeAgentCompleted = "office.agent.completed"
|
|
ActionOfficeAgentFailed = "office.agent.failed"
|
|
ActionOfficeAgentUpdated = "office.agent.updated"
|
|
ActionOfficeApprovalCreated = "office.approval.created"
|
|
ActionOfficeApprovalResolved = "office.approval.resolved"
|
|
ActionOfficeCostRecorded = "office.cost.recorded"
|
|
ActionOfficeRunQueued = "office.run.queued"
|
|
ActionOfficeRunProcessed = "office.run.processed"
|
|
ActionOfficeRoutineTriggered = "office.routine.triggered"
|
|
ActionOfficeActivityCreated = "office.activity.created"
|
|
ActionRunEventAppended = "run.event.appended"
|
|
// Office provider-routing events.
|
|
ActionOfficeProviderHealthChanged = "office.provider.health_changed"
|
|
ActionOfficeRouteAttemptAppended = "office.route_attempt.appended"
|
|
ActionOfficeRoutingSettingsUpdated = "office.routing.settings_updated"
|
|
)
|
|
|
|
// Automation actions
|
|
const (
|
|
ActionAutomationList = "automation.list"
|
|
ActionAutomationGet = "automation.get"
|
|
ActionAutomationCreate = "automation.create"
|
|
ActionAutomationUpdate = "automation.update"
|
|
ActionAutomationDelete = "automation.delete"
|
|
ActionAutomationEnable = "automation.enable"
|
|
ActionAutomationDisable = "automation.disable"
|
|
ActionAutomationTrigger = "automation.trigger"
|
|
ActionAutomationRunsList = "automation.runs.list"
|
|
ActionAutomationTriggerAdd = "automation.trigger.add"
|
|
ActionAutomationTriggerUpdate = "automation.trigger.update"
|
|
ActionAutomationTriggerDelete = "automation.trigger.delete"
|
|
ActionAutomationTriggerTypes = "automation.trigger_types"
|
|
ActionAutomationWebhookRevealSecret = "automation.webhook.reveal_secret"
|
|
ActionAutomationRunDelete = "automation.run.delete"
|
|
ActionAutomationRunsDeleteAll = "automation.runs.delete_all"
|
|
)
|
|
|
|
// Error codes
|
|
const (
|
|
ErrorCodeBadRequest = "BAD_REQUEST"
|
|
ErrorCodeNotFound = "NOT_FOUND"
|
|
ErrorCodeInternalError = "INTERNAL_ERROR"
|
|
ErrorCodeUnauthorized = "UNAUTHORIZED"
|
|
ErrorCodeForbidden = "FORBIDDEN"
|
|
ErrorCodeValidation = "VALIDATION_ERROR"
|
|
ErrorCodeConflict = "CONFLICT"
|
|
ErrorCodeUnknownAction = "UNKNOWN_ACTION"
|
|
)
|