Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4cc70e7f35 | ||
|
|
e83e1e4951 |
@@ -190,7 +190,7 @@ A bot shows a concept as a visual with `create_graphic` (plus `update_graphic`/`
|
||||
|
||||
### Browsers (`browsers`, `browser_access`)
|
||||
|
||||
A user's own running browser, reached over a browser MCP server they run beside it (Settings > Browsers). **It serves only its owner's runs**, since it holds their logins: every helper takes the session's `user_id`, and nobody sees anyone else's, super admins included. A row in `browser_access` makes a browser available in a scope (a bot, a workspace, or both null for all the user's bots) and at most one row per scope is the default; `browser_id` null there means the computer's browser, winning over a wider scope. Adding a browser gives it to no bot. Default order (`pickDefaultBrowser`): workspace > bot > all bots > computer. The computer's browser stays as the fallback. `BrowserDefaultPicker` is the one control, on Settings > Browsers, bot and workspace settings and under the composer. Runs get tools through `openBotBrowsers` (`<slug>__<tool>`, from `tools_cache`, connecting on the first call) and `composeBrowsersNote`, in replies too, so a bot can browse from the chat. `browserRunAllowed`: routines only with `allow_routines`, hook calls and chatroom runs never. **Never use `openMcpServer` or `fillTemplate` for a browser:** its URL and headers are a member's own text, and `{{env.KEY}}` would send install secrets to their server. The URL goes through `assertBrowserUrl` on save, test and each connection (refuses the computers' docker network, link-local, and loopback in production; the docker gateway stays allowed, it's the host), and redirects are refused (`no_redirects`). Headers are encrypted and never reach a page. Playwright MCP needs `--allowed-hosts` naming exactly the URL's host and port; `install.sh` adds `host.docker.internal`. A Flatpak browser takes the same flags through `flatpak run <app id>`, Playwright MCP staying on the host; it needs the host network and home (Flathub Chromium has both; its `/tmp` is private). New browsers start without `BrowserDefaultExcludedTools`. No cron lists tools: a sleeping laptop isn't a fault.
|
||||
A user's own running browser, reached over a browser MCP server they run beside it (Settings > Browsers). **It serves only its owner's runs**, since it holds their logins: every helper takes the session's `user_id`, and nobody sees anyone else's, super admins included. A row in `browser_access` makes a browser available in a scope (a bot, a workspace, or both null for all the user's bots) and at most one row per scope is the default; `browser_id` null there means the computer's browser, winning over a wider scope. Adding a browser gives it to no bot. Default order (`pickDefaultBrowser`): workspace > bot > all bots > computer. The computer's browser stays as the fallback. `BrowserDefaultPicker` is the one control, on Settings > Browsers, bot and workspace settings and under the composer (only once the user has a browser, `has_browsers`). Runs get tools through `openBotBrowsers` (`<slug>__<tool>`, from `tools_cache`, connecting on the first call) and `composeBrowsersNote`, in replies too, so a bot can browse from the chat. `browserRunAllowed`: routines only with `allow_routines`, hook calls and chatroom runs never. **Never use `openMcpServer` or `fillTemplate` for a browser:** its URL and headers are a member's own text, and `{{env.KEY}}` would send install secrets to their server. The URL goes through `assertBrowserUrl` on save, test and each connection (refuses the computers' docker network, link-local, and loopback in production; the docker gateway stays allowed, it's the host), and redirects are refused (`no_redirects`). Headers are encrypted and never reach a page. Playwright MCP needs `--allowed-hosts` naming exactly the URL's host and port; `install.sh` adds `host.docker.internal`. A Flatpak browser takes the same flags through `flatpak run <app id>`, Playwright MCP staying on the host; it needs the host network and home (Flathub Chromium has both; its `/tmp` is private). New browsers start without `BrowserDefaultExcludedTools`. No cron lists tools: a sleeping laptop isn't a fault.
|
||||
|
||||
### Knowledgebases
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cobble",
|
||||
"version": "0.13.0",
|
||||
"version": "0.13.1",
|
||||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
|
||||
@@ -6,6 +6,7 @@ import grabBots from "../bots/grab-bots";
|
||||
import grabBotExtensionsOverview from "../extensions/grab-bot-extensions-overview";
|
||||
import grabConversationFiles from "../bot-files/grab-conversation-files";
|
||||
import grabBotComputers from "../computers/grab-bot-computers";
|
||||
import userHasBrowsers from "../browsers/user-has-browsers";
|
||||
import resolveHarnessCandidates from "@/src/harness/resolve/resolve-harness-candidates";
|
||||
import grabUserWorkspaces from "../workspaces/grab-user-workspaces";
|
||||
import grabUserConversation from "./grab-user-conversation";
|
||||
@@ -24,8 +25,9 @@ type Params = {
|
||||
* `/admin/workspaces/<id>/bots/<id>`): the rail's crew (the workspace's
|
||||
* in a workspace) and workspaces, the bot, the text model it runs on, its
|
||||
* computers, tools, MCP servers and files there, and whether its mic and
|
||||
* read-aloud have a model to run on. The history (its session, messages
|
||||
* and active task) is left to the client (`grabConversationHistory`,
|
||||
* read-aloud have a model to run on, and whether the user has a browser
|
||||
* of their own (the composer's Browser button). The history (its session,
|
||||
* messages and active task) is left to the client (`grabConversationHistory`,
|
||||
* `api/admin/bots/conversation-history`), so a page the back button
|
||||
* restores never shows an old thread. The full model settings are left to
|
||||
* the models modal: the install-wide catalog (`api/admin/harness/catalog`)
|
||||
@@ -59,13 +61,14 @@ export default async function grabConversationProps({
|
||||
/** Loading its history marks the open session read. */
|
||||
bot.unread = 0;
|
||||
|
||||
const [bot_text_model, bot_computers, bot_extensions, bot_files, transcription, speech] = await Promise.all([
|
||||
const [bot_text_model, bot_computers, bot_extensions, bot_files, transcription, speech, has_browsers] = await Promise.all([
|
||||
grabTextModel({ bot_id: bot.id, workspace_id: scope }),
|
||||
grabBotComputers({ bot_id: bot.id, workspace_id: scope }),
|
||||
grabBotExtensionsOverview({ user_id, bot_id: bot.id, workspace_id: scope }),
|
||||
grabConversationFiles({ bot_id: bot.id, workspace_id: scope }),
|
||||
hasHarnessModel({ harness: "transcription", bot_id: bot.id, workspace_id: scope }),
|
||||
hasHarnessModel({ harness: "speech", bot_id: bot.id, workspace_id: scope }),
|
||||
userHasBrowsers({ user_id }).catch(() => false),
|
||||
]);
|
||||
|
||||
return {
|
||||
@@ -78,6 +81,7 @@ export default async function grabConversationProps({
|
||||
bot_extensions,
|
||||
bot_files,
|
||||
bot_voice: { transcription, speech },
|
||||
has_browsers,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import BunSQLite from "@moduletrace/bun-sqlite";
|
||||
|
||||
type Params = {
|
||||
user_id: number | string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Whether the user has added any browser of their own, so the composer
|
||||
* shows its Browser button only when there is one to pick.
|
||||
*/
|
||||
export default async function userHasBrowsers({ user_id }: Params) {
|
||||
const res = await BunSQLite.sql<{ id: number }>({
|
||||
sql: `SELECT id FROM browsers WHERE user_id = ? LIMIT 1`,
|
||||
values: [Number(user_id)],
|
||||
});
|
||||
|
||||
return Boolean(res.payload?.length);
|
||||
}
|
||||
@@ -14,16 +14,21 @@ type Props = {
|
||||
bot: BotWithLastMessage;
|
||||
workspace_id?: number | null;
|
||||
initial?: BotExtensionsPayload | null;
|
||||
/**
|
||||
* Whether the user has a browser of their own; without one there is
|
||||
* nothing to pick, so the Browser button stays away.
|
||||
*/
|
||||
has_browsers?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Under the composer: one button counting the MCP servers, tools and
|
||||
* skills the bot can use here, one beside it counting the knowledgebases it
|
||||
* searches (each opens in a modal, so ten of them don't fill the
|
||||
* composer), then the user's browsers here and the computer it's on,
|
||||
* opening it in the viewer.
|
||||
* composer), then the user's browsers here (only once they've added one)
|
||||
* and the computer it's on, opening it in the viewer.
|
||||
*/
|
||||
export default function ComposerTools({ bot, workspace_id, initial }: Props) {
|
||||
export default function ComposerTools({ bot, workspace_id, initial, has_browsers }: Props) {
|
||||
const bot_name = bot.name || "this bot";
|
||||
const extensions = useExtensions({
|
||||
owner: { bot_id: bot.id || 0, workspace_id },
|
||||
@@ -74,13 +79,15 @@ export default function ComposerTools({ bot, workspace_id, initial }: Props) {
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{(has_tools || has_knowledge) && computers.length ? (
|
||||
{(has_tools || has_knowledge) && (has_browsers || computers.length) ? (
|
||||
<Span className="-mr-2 opacity-40">
|
||||
<Dot size={20} />
|
||||
</Span>
|
||||
) : null}
|
||||
|
||||
<ComposerBrowserButton bot_id={bot.id || 0} bot_name={bot_name} workspace_id={workspace_id} />
|
||||
{has_browsers ? (
|
||||
<ComposerBrowserButton bot_id={bot.id || 0} bot_name={bot_name} workspace_id={workspace_id} />
|
||||
) : null}
|
||||
|
||||
<ComposerComputerButton />
|
||||
|
||||
|
||||
@@ -58,6 +58,10 @@ type Props = {
|
||||
* The dictation mic is disabled while transcription has no model.
|
||||
*/
|
||||
voice?: BotVoicePayload | null;
|
||||
/**
|
||||
* The Browser button shows only when the user has a browser of their own.
|
||||
*/
|
||||
has_browsers?: boolean;
|
||||
/**
|
||||
* The message the next one quotes, if the user picked one.
|
||||
*/
|
||||
@@ -96,6 +100,7 @@ export default function Composer({
|
||||
workspace_id,
|
||||
extensions,
|
||||
voice,
|
||||
has_browsers,
|
||||
reply_to,
|
||||
onCancelReply,
|
||||
onSendStart,
|
||||
@@ -361,6 +366,7 @@ export default function Composer({
|
||||
bot={bot}
|
||||
workspace_id={workspace_id}
|
||||
initial={extensions}
|
||||
has_browsers={has_browsers}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
@@ -452,6 +452,7 @@ export default function Conversation() {
|
||||
workspace_id={workspace_id}
|
||||
extensions={pageProps?.bot_extensions}
|
||||
voice={pageProps?.bot_voice}
|
||||
has_browsers={Boolean(pageProps?.has_browsers)}
|
||||
reply_to={reply_to}
|
||||
onCancelReply={() => setReplyTo(null)}
|
||||
onSendStart={({ message }) =>
|
||||
|
||||
@@ -2078,6 +2078,11 @@ export type PagePropsType = {
|
||||
* (speech) are turned on for the bot there.
|
||||
*/
|
||||
bot_voice?: BotVoicePayload | null;
|
||||
/**
|
||||
* Whether the user has added a browser of their own; the composer's
|
||||
* Browser button shows only then.
|
||||
*/
|
||||
has_browsers?: boolean | null;
|
||||
/**
|
||||
* The open conversation's text model (its header). The full model
|
||||
* settings load when the models modal opens.
|
||||
|
||||
Reference in New Issue
Block a user