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
+33
-5
@@ -116,7 +116,7 @@ test("registration passes each tool's schema and annotations, and disposes via t
|
||||
}
|
||||
});
|
||||
|
||||
test("read-only tools are read-only; recovery tools are consequential", () => {
|
||||
test("read-only tools are read-only; task actions are consequential", () => {
|
||||
const annotations = new Map(
|
||||
archieWebMcpTools(fakeClient().client).map((tool) => [
|
||||
tool.name,
|
||||
@@ -141,7 +141,15 @@ test("read-only tools are read-only; recovery tools are consequential", () => {
|
||||
`${name} must not be consequential`,
|
||||
);
|
||||
}
|
||||
for (const name of ["retry_task", "stop_task", "cancel_task"]) {
|
||||
for (const name of [
|
||||
"retry_task",
|
||||
"stop_task",
|
||||
"cancel_task",
|
||||
"approve_task",
|
||||
"reject_task",
|
||||
"abandon_task",
|
||||
"archive_task",
|
||||
]) {
|
||||
assert.equal(
|
||||
annotations.get(name)?.consequentialHint,
|
||||
true,
|
||||
@@ -173,7 +181,7 @@ test("tools returning agent, operator or inbound content carry untrustedContentH
|
||||
assert.equal(annotations.get("list_tasks")?.consequentialHint, undefined);
|
||||
});
|
||||
|
||||
test("recovery tools post the dashboard's own action verbs", async () => {
|
||||
test("task action tools post the dashboard's own action verbs", async () => {
|
||||
const { calls, client } = fakeClient();
|
||||
await toolNamed(client, "retry_task").execute({
|
||||
task_id: "9",
|
||||
@@ -184,15 +192,35 @@ test("recovery tools post the dashboard's own action verbs", async () => {
|
||||
task_id: "9",
|
||||
confirm: true,
|
||||
});
|
||||
await toolNamed(client, "approve_task").execute({
|
||||
task_id: "9",
|
||||
confirm: true,
|
||||
});
|
||||
await toolNamed(client, "reject_task").execute({
|
||||
task_id: "9",
|
||||
confirm: true,
|
||||
});
|
||||
await toolNamed(client, "abandon_task").execute({
|
||||
task_id: "9",
|
||||
confirm: true,
|
||||
});
|
||||
await toolNamed(client, "archive_task").execute({
|
||||
task_id: "9",
|
||||
confirm: true,
|
||||
});
|
||||
|
||||
assert.deepEqual(calls, [
|
||||
{ method: "taskAction", args: ["9", "retry"] },
|
||||
{ method: "taskAction", args: ["9", "stop"] },
|
||||
{ method: "taskAction", args: ["9", "cancel"] },
|
||||
{ method: "taskAction", args: ["9", "approve"] },
|
||||
{ method: "taskAction", args: ["9", "reject"] },
|
||||
{ method: "taskAction", args: ["9", "abandon"] },
|
||||
{ method: "taskAction", args: ["9", "archive"] },
|
||||
]);
|
||||
});
|
||||
|
||||
test("recovery tools require an explicit confirm flag before touching the API", async () => {
|
||||
test("task action tools require an explicit confirm flag before touching the API", async () => {
|
||||
const { calls, client } = fakeClient();
|
||||
const retry = toolNamed(client, "retry_task");
|
||||
|
||||
@@ -210,7 +238,7 @@ test("recovery tools require an explicit confirm flag before touching the API",
|
||||
assert.deepEqual(calls, [{ method: "taskAction", args: ["9", "retry"] }]);
|
||||
});
|
||||
|
||||
test("the recovery schema requires both task_id and confirm", () => {
|
||||
test("the task action schema requires both task_id and confirm", () => {
|
||||
const schema = archieWebMcpTools(fakeClient().client).find(
|
||||
(tool) => tool.name === "stop_task",
|
||||
)!.inputSchema as {
|
||||
|
||||
Reference in new issue
Block a user