feat(webui): add WebMCP task actions
This commit is contained in:
1 parent
32b73c3a28
commit
7cd62232ef
3 files changed
+68
-17
No files matched your search
+34
-11
@@ -3,9 +3,8 @@
|
||||
// The API client is a parameter rather than a module import, so this list is
|
||||
// host-agnostic and unit-testable; `archie-webmcp.ts` is the one place that
|
||||
// binds it to the dashboard's own client. Scope is deliberate: read-only
|
||||
// inspection, plus the three recovery actions (retry, stop, cancel). The human
|
||||
// review gate -- approve and reject -- is deliberately not exposed, because an
|
||||
// agent that can approve its own work defeats the design.
|
||||
// inspection and consequential task actions. The authenticated operator's
|
||||
// session authorizes every mutation.
|
||||
//
|
||||
// Security model: these tools run in the signed-in operator's own browser
|
||||
// session, so they inherit exactly what that operator can already do and can
|
||||
@@ -69,9 +68,9 @@ const taskIDSchema = {
|
||||
additionalProperties: false,
|
||||
} as const;
|
||||
|
||||
// A recovery tool's schema. `confirm` is required and must be true: a
|
||||
// A task action's schema. `confirm` is required and must be true: a
|
||||
// deliberate-action signal, not a security control (see the module header).
|
||||
const recoverySchema = {
|
||||
const taskActionSchema = {
|
||||
type: "object",
|
||||
properties: {
|
||||
task_id: {
|
||||
@@ -88,8 +87,8 @@ const recoverySchema = {
|
||||
additionalProperties: false,
|
||||
} as const;
|
||||
|
||||
/** One recovery action, published under its own name so the agent chooses by intent. */
|
||||
function recoveryTool(
|
||||
/** One task action, published under its own name so the agent chooses by intent. */
|
||||
function taskActionTool(
|
||||
client: DashboardApi,
|
||||
name: string,
|
||||
action: string,
|
||||
@@ -98,7 +97,7 @@ function recoveryTool(
|
||||
return {
|
||||
name,
|
||||
description,
|
||||
inputSchema: recoverySchema,
|
||||
inputSchema: taskActionSchema,
|
||||
annotations: { readOnlyHint: false, consequentialHint: true },
|
||||
execute: async (input) => {
|
||||
const id = taskID(input);
|
||||
@@ -170,23 +169,47 @@ export function archieWebMcpTools(client: DashboardApi): WebMcpTool[] {
|
||||
annotations: { readOnlyHint: true, untrustedContentHint: false },
|
||||
execute: async () => jsonEnvelope(await client.health()),
|
||||
},
|
||||
recoveryTool(
|
||||
taskActionTool(
|
||||
client,
|
||||
"retry_task",
|
||||
"retry",
|
||||
"Requeue a task that is stuck or parked so the workflow runs it again; keeps the task, its history, and its pull request. This recovers stalled work -- it is not how a review is approved.",
|
||||
),
|
||||
recoveryTool(
|
||||
taskActionTool(
|
||||
client,
|
||||
"stop_task",
|
||||
"stop",
|
||||
"Stop a running task recoverably: it moves to parked and can be retried later. Does not close the issue or discard the branch. Use this to pause work; use cancel_task to end it.",
|
||||
),
|
||||
recoveryTool(
|
||||
taskActionTool(
|
||||
client,
|
||||
"cancel_task",
|
||||
"cancel",
|
||||
"End a parked task archie should not continue; the forge issue stays open. stop_task parks a running task recoverably instead.",
|
||||
),
|
||||
taskActionTool(
|
||||
client,
|
||||
"approve_task",
|
||||
"approve",
|
||||
"Approve a task waiting for approval so its workflow can continue.",
|
||||
),
|
||||
taskActionTool(
|
||||
client,
|
||||
"reject_task",
|
||||
"reject",
|
||||
"Reject a task Archie should not continue. This ends the task and may close its forge issue or pull request.",
|
||||
),
|
||||
taskActionTool(
|
||||
client,
|
||||
"abandon_task",
|
||||
"abandon",
|
||||
"Abandon a parked task without closing its forge issue.",
|
||||
),
|
||||
taskActionTool(
|
||||
client,
|
||||
"archive_task",
|
||||
"archive",
|
||||
"Archive a terminal task, removing its local task record and worktree.",
|
||||
),
|
||||
];
|
||||
}
|
||||
Reference in new issue
Block a user