feat(webui): publish WebMCP tools for the dashboard
Register the dashboard's own tools with document.modelContext so an in-page agent can read tasks, events, and daemon health, and recover a stuck task: list_tasks, get_task, recent_events and daemon_health (read-only), plus retry_task, stop_task and cancel_task (consequential). The human review gate (approve/reject) and the destructive verbs (abandon/archive) are deliberately not exposed. Every tool calls the same ui/src/lib/api.ts client the interface calls, so the agent and the UI exercise one set of endpoints, one CSRF header and one error shape. Registration is framework-agnostic (lib/webmcp.ts machinery, lib/webmcp-tools.ts list, lib/archie-webmcp.ts the api binding) and no-ops when document.modelContext is absent, which it is outside the WebMCP origin trial. Tools returning agent, operator or inbound content carry untrustedContentHint; only the recovery actions carry consequentialHint. Verified in system Chrome 152 with --enable-features=WebMCP: seven tools listed with schemas and annotations, all four read-only tools executed against the live dashboard, and the flagless run mounts the dashboard with no exception.
This commit is contained in:
1 parent
1257e08e78
commit
d55dedab86
6 files changed
+414
-9
No files matched your search
@@ -4,6 +4,7 @@ import { createPinia } from "pinia";
|
||||
import { createApp } from "vue";
|
||||
|
||||
import App from "./App.vue";
|
||||
import { registerArchieWebMcpTools } from "./lib/archie-webmcp";
|
||||
import router from "./router";
|
||||
import { useAppearanceStore } from "./stores/appearance";
|
||||
import { useLiveUpdatesStore } from "./stores/live-updates";
|
||||
@@ -19,3 +20,8 @@ app.use(pinia).use(router);
|
||||
useAppearanceStore(pinia).initialize();
|
||||
useLiveUpdatesStore(pinia).initialize();
|
||||
app.mount("#app");
|
||||
|
||||
// Published after the shell paints: an in-page agent's tools are not worth
|
||||
// delaying the dashboard for, and the browser no-ops when modelContext is
|
||||
// absent (which it is outside the origin trial).
|
||||
void registerArchieWebMcpTools();
|
||||
Reference in new issue
Block a user