Open-source AI coworkers that each get a computer of their own: a browser, files and tools, with every action decided before it happens and recorded after. Bring any AG-UI agent.
Stop a grant promising what the deployment cannot honour (#131)
David McKay3ab43a09c5c9
diff --git a/app/src/lib/plugins/queries.ts b/app/src/lib/plugins/queries.tsindex 525dd7a7..9c7241f5 100644--- a/app/src/lib/plugins/queries.ts+++ b/app/src/lib/plugins/queries.ts@@ -65,6 +65,15 @@ export type PluginsPage = {catalogue: CatalogueItem[];servers: PluginServer[];skills: PluginSkill[];+ /**+ * Whether a Bot holding no credential of its own can still call a tool back.+ *+ * True when the deployment has a shared secret configured for it. A grant decides whether a tool+ * is offered to a model at all; this decides whether the call it makes can be authenticated. With+ * neither this nor a credential issued to the Bot, every call is refused before it reaches the+ * grant, the boundary or the audit trail, which is not something a grant switch can show.+ */+ botsMayCallBack: boolean;/*** The redirect URI to register with a `user-oauth` vendor, exactly as this deployment will send it.*diff --git a/app/src/routes/_authed/admin/plugins/$key_.tools.$tool.tsx b/app/src/routes/_authed/admin/plugins/$key_.tools.$tool.tsxindex d0149446..01500038 100644--- a/app/src/routes/_authed/admin/plugins/$key_.tools.$tool.tsx+++ b/app/src/routes/_authed/admin/plugins/$key_.tools.$tool.tsx@@ -44,6 +44,18 @@ function RouteComponent() {const queryClient = useQueryClient();const plugins = useQuery(pluginsPageQueryOptions());const { data: agents } = useQuery(agentListQueryOptions());+ /*+ * Whether a call from this Bot could be authenticated at all.+ *+ * Its own issued credential, or the deployment's shared one. Separate from the grant: the switch+ * decides whether the tool is offered to the model, this decides whether the call it makes gets+ * past the front door. A Bot with the grant and neither credential produced "May call this tool"+ * beside a tool that refused every call, with no audit row, because the call never arrived.+ */+ const sharedCallback = plugins.data?.botsMayCallBack === true;+ const canCallBack = (bot: { id: string }) =>+ sharedCallback ||+ agents?.find((one) => one.id === bot.id)?.hasCallbackToken === true;const nameFor = useBotNames();const [error, setError] = useState<string | null>(null);@@ -162,7 +174,9 @@ function RouteComponent() {<ItemTitle>{bot.name}</ItemTitle><ItemDescription>{held- ? "May call this tool. Every call is still checked against the boundaries and written to the audit trail."+ ? canCallBack(bot)+ ? "May call this tool. Every call is still checked against the boundaries and written to the audit trail."+ : "Granted, but this Bot has no credential for calling tools back, so every call is refused before it reaches the boundary. Issue one on its own page, or set AGENT_TOOL_TOKEN for the deployment.": "Cannot call this tool. It is not offered to the model at all, so it has nothing to refuse."}</ItemDescription></ItemContent>diff --git a/server/src/app.ts b/server/src/app.tsindex b2e017a0..2301d633 100644--- a/server/src/app.ts+++ b/server/src/app.ts@@ -683,6 +683,10 @@ export function createApp("/api/plugins",createPluginRoutes(pluginStore, requireUser, canUseBot, {encryptionKey: config.keyEncryptionKey,+ // The deployment-wide fallback a Bot may present, as a yes or no. The secret itself stays+ // in config and is checked in `/api/agent-tools/call`; the surface only needs to know+ // whether a Bot without its own credential has any way to call back.+ botsMayCallBack: Boolean(config.agentToolToken),publicUrl: config.publicUrl,appUrl: config.appUrl,}),diff --git a/server/src/plugins/routes.ts b/server/src/plugins/routes.tsindex eb4ab759..91194d5f 100644--- a/server/src/plugins/routes.ts+++ b/server/src/plugins/routes.ts@@ -60,6 +60,15 @@ export function createPluginRoutes(*/connect?: {encryptionKey: string;+ /**+ * Whether this deployment holds a shared secret a Bot may present when calling a tool back.+ *+ * A boolean about configuration, never the secret. Without it, a Bot can only call back if it+ * holds a credential issued to it alone, and a Bot with neither is refused before the call ever+ * reaches the grant, the boundary or the trail. The Bots screen needs this to stop promising a+ * grant the deployment cannot honour.+ */+ botsMayCallBack?: boolean;publicUrl: string | undefined;/*** Where the app is, which is not where this API is.@@ -119,6 +128,15 @@ export function createPluginRoutes(auth: entry.auth.kind,perInstance: entry.host === null,})),+ /*+ * Whether a Bot with no credential of its own can still call a tool back.+ *+ * The grant switch decides whether a tool is offered to a model; this decides whether any+ * call it makes can be authenticated at all. They are different questions and the screen used+ * to answer only the first, so a grant could read "May call this tool" on a deployment where+ * every call was refused before it reached the boundary.+ */+ botsMayCallBack: connect?.botsMayCallBack === true,servers: await store.listServers(),// Scoped: the deployment's skills plus this person's own. An administrator sees them all.skills: await store.listSkills(skillActor(context)),