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.
28 lines
1010 B
TypeScript
28 lines
1010 B
TypeScript
import "./legacy-hash-redirect";
|
|
|
|
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";
|
|
// One stylesheet: the design tokens, and the element defaults that have no
|
|
// component to live in (the canvas, the focus floor, the motion preference).
|
|
// Everything else is Tailwind on the component that owns it.
|
|
import "./style.css";
|
|
|
|
const app = createApp(App);
|
|
const pinia = createPinia();
|
|
|
|
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();
|