Let bots manage their hooks, with the user confirming what widens them

Bots get list_hooks, pause_hook and delete_hook, which act directly since
they only take away. A new hook, or a new name, brief or filter, or
switching a paused one back on, goes through propose_hook: it stores a
hook_proposals row and puts a [hook-proposal:ID] card in the reply, which
the user it was proposed to confirms or rejects. The card is read from
what Confirm saves, with the bot's reason labelled as its own; confirming
checks everything again and saves through the Hooks modal's helpers. A
new hook's URL is shown on the card once, to the user only, never in the
outcome the bot is told. What calls a hook, its computers and its signing
are never proposed. Only chat replies propose, and a hook call's own run
gets no hook tools, so a caller's payload can't reach them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-25 15:18:54 +01:00
co-authored by Claude Opus 5.5
parent 045167715d
commit 380d3ebb2f
54 changed files with 1983 additions and 55 deletions
+46
View File
@@ -37,6 +37,7 @@ import type { BotFace, BotMessageReactionEmoji } from "../dict/bot-dict";
import type { HarnessCallSettings, TokenUsageSummary } from "../harness/usage/types";
import type { McpServerStatus, McpTransport } from "../dict/mcp-dict";
import type { ExtensionProposalKind, ExtensionProposalStatus } from "../dict/extension-proposal-dict";
import type { HookProposalAction } from "../dict/bot-hook-dict";
import type { PwaInstallIcon } from "../data/pwa-data";
import type {
CustomToolHttpMethod,
@@ -783,6 +784,51 @@ export type ExtensionProposalView = {
sources: string[];
};
/**
* A hook a bot proposed making or changing (`hook_proposals`), as its chip
* and confirm card show it to the user it was proposed to: every detail
* read by the app from what Confirm would save, the bot's reason beside
* them, labelled as its own.
*/
export type HookProposalView = {
id: number;
action: HookProposalAction;
/**
* The hook it changes, null for a new one.
*/
hook_id: number | null;
title: string;
bot_id: number;
bot_name: string;
status: ExtensionProposalStatus;
/**
* Still pending, but past `expires_at`: it can't be confirmed.
*/
expired: boolean;
expires_at: number;
outcome: string;
result_id: number | null;
/**
* Confirming makes a URL an outside service calls, shown then, once.
*/
makes_url: boolean;
details: ExtensionProposalDetail[];
/**
* Why the bot proposes it, in its own words.
*/
reason: string;
};
/**
* A hook proposal just decided: as it now stands, and for a new hook
* called at a URL its token, shown this once to the user who confirmed it
* (never stored, never told to the bot).
*/
export type HookProposalDecision = {
view: HookProposalView;
token?: string;
};
/**
* A skill as the Skills settings page shows it: nothing secret in one, so
* it's the row with who gets it instead of `all_bots`.