Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

feat(cyclops): add browser bash chat tools (#6808)

r33drichards5a77587d69bd
diff --git a/libs/fleet/agent.test.ts b/libs/fleet/agent.test.ts
index b13872dbe2..ddd464e04f 100644
--- a/libs/fleet/agent.test.ts
+++ b/libs/fleet/agent.test.ts
@@ -1,5 +1,6 @@
import assert from "node:assert/strict"
import test from "node:test"
+import { Bash } from "just-bash/browser"
import {
BrowserBashAgent,
normalizeBashArguments,
@@ -8,8 +9,181 @@ import {
type AgentEvent,
type TurnClient,
} from "./src/browser-agent.ts"
+import { createBrowserMcpCommands, createBrowserMcpToolCaller, type McpClient } from "./src/browser-mcp-commands.ts"
+import { createBrowserSdkCommands, type BrowserSdk } from "./src/browser-sdk-commands.ts"
import { gzipSync, gunzipSync } from "./src/node-zlib-browser.ts"
+
+const inertSdk: BrowserSdk = {
+ listNamespaces: async () => [],
+ listPools: async () => [],
+ getPool: async () => ({}),
+ createPool: async () => ({}),
+ updatePoolServices: async () => undefined,
+ deletePool: async () => undefined,
+ listClaims: async () => [],
+ createClaim: async () => ({}),
+ getClaim: async () => ({}),
+ deleteClaim: async () => undefined,
+ listUserKeys: async () => [],
+ createUserKey: async () => ({}),
+ deleteUserKey: async () => undefined,
+}
+
+function sdkShell(overrides: Partial<BrowserSdk> = {}): Bash {
+ const sdk: BrowserSdk = { ...inertSdk, ...overrides }
+ return new Bash({ customCommands: createBrowserSdkCommands(sdk) })
+}
+
+test("exposes SDK methods as composable bash commands", async () => {
+ const shell = sdkShell({
+ listPools: async () => [
+ { name: "beta", namespace: "team", phase: "Ready" },
+ { name: "alpha", namespace: "team", phase: "Pending" },
+ ],
+ })
+
+ const result = await shell.exec("listPools | jq -r '.[].name' | sort")
+
+ assert.equal(result.exitCode, 0)
+ assert.equal(result.stdout, "alpha\nbeta\n")
+ assert.equal(result.stderr, "")
+})
+
+test("passes a JSON argument array to SDK methods", async () => {
+ const calls: unknown[][] = []
+ const shell = sdkShell({
+ getPool: async (...args) => {
+ calls.push(args)
+ return { namespace: args[0], name: args[1] }
+ },
+ })
+
+ const result = await shell.exec(`getPool '["team","alpha"]'`)
+
+ assert.deepEqual(calls, [["team", "alpha"]])
+ assert.equal(result.stdout, '{"namespace":"team","name":"alpha"}\n')
+})
+
+test("reads SDK argument arrays from stdin", async () => {
+ const calls: unknown[][] = []
+ const shell = sdkShell({
+ listClaims: async (...args) => {
+ calls.push(args)
+ return [{ namespace: args[0], name: "claim-one" }]
+ },
+ })
+
+ const result = await shell.exec(`printf '["team"]' | listClaims`)
+
+ assert.deepEqual(calls, [["team"]])
+ assert.equal(result.stdout, '[{"namespace":"team","name":"claim-one"}]\n')
+})
+
+test("emits no stdout for void SDK methods", async () => {
+ const calls: unknown[][] = []
+ const shell = sdkShell({
+ deleteClaim: async (...args) => {
+ calls.push(args)
+ },
+ })
+
+ const result = await shell.exec(`deleteClaim '["team","claim-one"]'`)
+
+ assert.deepEqual(calls, [["team", "claim-one"]])
+ assert.equal(result.exitCode, 0)
+ assert.equal(result.stdout, "")
+})
+
+test("returns argument and SDK failures as shell errors", async () => {
+ const shell = sdkShell({
+ getPool: async () => {
+ throw new Error("pool unavailable")
+ },
+ })
+
+ const malformed = await shell.exec("getPool not-json")
+ assert.notEqual(malformed.exitCode, 0)
+ assert.match(malformed.stderr, /JSON array/)
+
+ const rejected = await shell.exec(`getPool '["team","alpha"]'`)
+ assert.notEqual(rejected.exitCode, 0)
+ assert.equal(rejected.stderr, "pool unavailable\n")
+})
+
+test("exposes exact MCP tool names as composable bash commands", async () => {
+ const calls: Array<{ name: string; arguments: Record<string, unknown> }> = []
+ const shell = new Bash({
+ customCommands: createBrowserMcpCommands(async (name, arguments_) => {
+ calls.push({ name, arguments: arguments_ })
+ return { content: [{ type: "text", text: "docs result" }] }
+ }),
+ })
+
+ const result = await shell.exec(`query_docs_vectors '{"query":"agent loop","limit":3}' | jq -r '.content[0].text'`)
+
+ assert.deepEqual(calls, [{ name: "query_docs_vectors", arguments: { query: "agent loop", limit: 3 } }])
+ assert.equal(result.exitCode, 0)
+ assert.equal(result.stdout, "docs result\n")
+ assert.equal(result.stderr, "")
+})
+
+test("reads MCP tool arguments from stdin", async () => {
+ const calls: Array<{ name: string; arguments: Record<string, unknown> }> = []
+ const shell = new Bash({
+ customCommands: createBrowserMcpCommands(async (name, arguments_) => {
+ calls.push({ name, arguments: arguments_ })
+ return { structuredContent: { rows: [{ component: "agent" }] } }
+ }),
+ })
+
+ const result = await shell.exec(`printf '{"sql":"SELECT component FROM code_files LIMIT 1"}' | query_code_db`)
+
+ assert.deepEqual(calls, [{ name: "query_code_db", arguments: { sql: "SELECT component FROM code_files LIMIT 1" } }])
+ assert.equal(result.stdout, '{"structuredContent":{"rows":[{"component":"agent"}]}}\n')
+})
+
+test("returns MCP argument and tool failures as shell errors", async () => {
+ const shell = new Bash({
+ customCommands: createBrowserMcpCommands(async () => ({
+ isError: true,
+ content: [{ type: "text", text: "read-only query rejected" }],
+ })),
+ })
+
+ const malformed = await shell.exec("query_docs_db not-json")
+ assert.notEqual(malformed.exitCode, 0)
+ assert.match(malformed.stderr, /JSON object/)
+
+ const rejected = await shell.exec(`query_docs_db '{"sql":"DELETE FROM pages"}'`)
+ assert.notEqual(rejected.exitCode, 0)
+ assert.equal(rejected.stderr, "read-only query rejected\n")
+})
+
+test("shares one lazy MCP connection and retries failed connections", async () => {
+ let attempts = 0
+ const client: McpClient = {
+ callTool: async ({ name }) => ({ content: [{ type: "text", text: name }] }),
+ }
+ const callTool = createBrowserMcpToolCaller(async () => {
+ attempts += 1
+ if (attempts === 1) throw new Error("temporary connection failure")
+ return client
+ })
+
+ await assert.rejects(callTool("query_docs_db", { sql: "SELECT 1" }), /temporary connection failure/)
+ const results = await Promise.all([
+ callTool("query_docs_db", { sql: "SELECT 1" }),
+ callTool("query_code_vectors", { query: "screenshots" }),
+ ])
+
+ assert.equal(attempts, 2)
+ assert.deepEqual(results, [
+ { content: [{ type: "text", text: "query_docs_db" }] },
+ { content: [{ type: "text", text: "query_code_vectors" }] },
+ ])
+})
+
test("clamps model-selected bash limits", () => {
assert.deepEqual(
normalizeBashArguments({ command: "echo ok", timeout_ms: 1, max_output_chars: 9_999_999 }),
@@ -24,14 +198,14 @@ test("sanitizes control characters in bash execution errors", () => {
test("keeps one virtual filesystem per conversation", async () => {
const unused: TurnClient = async () => ({ role: "assistant", content: "done", tool_calls: [] })
- const agent = new BrowserBashAgent(unused)
+ const agent = new BrowserBashAgent(unused, createBrowserSdkCommands(inertSdk))
await agent.executeBash("one", { command: "echo alpha > note.txt" })
assert.equal((await agent.executeBash("one", { command: "cat note.txt" })).stdout, "alpha\n")
assert.notEqual((await agent.executeBash("two", { command: "cat note.txt" })).exit_code, 0)
})
test("browser zlib shim fails only when gzip-backed commands execute", async () => {
- const agent = new BrowserBashAgent(async () => ({ role: "assistant", content: "", tool_calls: [] }))
+ const agent = new BrowserBashAgent(async () => ({ role: "assistant", content: "", tool_calls: [] }), createBrowserSdkCommands(inertSdk))
assert.equal((await agent.executeBash("zlib-shim", { command: "printf normal" })).stdout, "normal")
assert.throws(() => gzipSync(new Uint8Array()), /gzip commands are unsupported in the browser/)
@@ -54,7 +228,7 @@ test("runs tool calls until the assistant finishes", async () => {
return responses.shift()!
}
const events: AgentEvent[] = []
- const agent = new BrowserBashAgent(client)
+ const agent = new BrowserBashAgent(client, createBrowserSdkCommands(inertSdk))
await agent.run("conversation-1", [{ role: "user", content: "Run it" }], event => events.push(event))
assert.deepEqual(requests, [
@@ -76,7 +250,7 @@ test("runs tool calls until the assistant finishes", async () => {
})
test("normalizes timeout and truncation results", async () => {
- const agent = new BrowserBashAgent(async () => ({ role: "assistant", content: "", tool_calls: [] }))
+ const agent = new BrowserBashAgent(async () => ({ role: "assistant", content: "", tool_calls: [] }), createBrowserSdkCommands(inertSdk))
const truncated = await agent.executeBash("one", { command: "printf 123456", max_output_chars: 4 })
assert.deepEqual(truncated, { stdout: "1234", stderr: "", exit_code: 0, timed_out: false, truncated: true })
@@ -105,7 +279,7 @@ test("caller cancellation aborts bash execution and stops the tool loop", async
{ id: "call-cancel", type: "function", function: { name: "bash", arguments: '{"command":"sleep 2"}' } },
],
}
- })
+ }, createBrowserSdkCommands(inertSdk))
const run = agent.run(
"conversation-cancel",
@@ -142,7 +316,7 @@ test("batches multiple bash tool results into one follow-up turn", async () => {
return responses.shift()!
}
const events: AgentEvent[] = []
- const agent = new BrowserBashAgent(client)
+ const agent = new BrowserBashAgent(client, createBrowserSdkCommands(inertSdk))
await agent.run("conversation-batch", [{ role: "user", content: "Run both commands" }], event => events.push(event))
@@ -194,7 +368,7 @@ test("rejects mixed tool batches before bash side effects", async () => {
},
{ id: "call-unsupported", type: "function", function: { name: "other", arguments: "{}" } },
],
- }))
+ }), createBrowserSdkCommands(inertSdk))
await assert.rejects(
agent.run("conversation-mixed", [{ role: "user", content: "Run the tools" }], event => events.push(event)),
diff --git a/libs/fleet/backend/auth/authz.rego b/libs/fleet/backend/auth/authz.rego
index f3ba83ba87..66c89c4121 100644
--- a/libs/fleet/backend/auth/authz.rego
+++ b/libs/fleet/backend/auth/authz.rego
@@ -33,6 +33,17 @@ is_admin {
input.flags.admin_subs[_] == input.user.sub
}
+# chat_enabled is the restricted-mode decision. Global all/disabled mode is
+# configuration state and remains outside policy; this rule only decides whether
+# an authenticated user belongs to the administrator-or-chat rollout set.
+chat_enabled {
+ is_admin
+}
+
+chat_enabled {
+ input.flags.chat_subs[_] == input.user.sub
+}
+
# ── Token families ──────────────────────────────────────────────────────────
#
# Three families reach the policy, distinguished by `azp`. A fourth kind of
diff --git a/libs/fleet/backend/auth/flags_test.go b/libs/fleet/backend/auth/flags_test.go
index 405afafea4..1c7a2aeffb 100644
--- a/libs/fleet/backend/auth/flags_test.go
+++ b/libs/fleet/backend/auth/flags_test.go
@@ -23,6 +23,7 @@ func resetFlagsCache() {
// pure-policy tests in policy_test.go don't touch.
func TestExportedEvalsEndToEnd(t *testing.T) {
t.Setenv("CYCLOPS_CS_ADMIN_SUBS", `["admin-sub"]`)
+ t.Setenv("CYCLOPS_CS_CHAT_SUBS", `["chat-sub"]`)
if err := featureflags.SetupProvider(context.Background(), "development", featureflags.AWSCredentials{}); err != nil {
t.Fatalf("setup dev provider: %v", err)
@@ -47,6 +48,26 @@ func TestExportedEvalsEndToEnd(t *testing.T) {
}
})
+ t.Run("EvalChatEnabled", func(t *testing.T) {
+ for _, test := range []struct {
+ name string
+ user *User
+ want bool
+ }{
+ {name: "admin", user: &User{ID: "admin-sub", AZP: "cyclops-cs-spa"}, want: true},
+ {name: "allowlisted", user: &User{ID: "chat-sub", AZP: "cyclops-cs-spa"}, want: true},
+ {name: "unlisted", user: &User{ID: "someone-else", AZP: "cyclops-cs-spa"}, want: false},
+ {name: "nil", user: nil, want: false},
+ } {
+ t.Run(test.name, func(t *testing.T) {
+ ok, err := EvalChatEnabled(ctx, test.user)
+ if err != nil || ok != test.want {
+ t.Fatalf("EvalChatEnabled(%v) = %v, %v; want %v, nil", test.user, ok, err, test.want)
+ }
+ })
+ }
+ })
+
}
// TestFlagsDataCachedAndRefreshes confirms the TTL cache serves a stable
@@ -126,3 +147,18 @@ func TestEvalBillingEnabledDefaultsFalseAndReadsBooleanFlag(t *testing.T) {
t.Fatalf("EvalBillingEnabled(true) = %v, %v; want true, nil", enabled, err)
}
}
+
+func TestEvalChatEnabledFailsClosedForMalformedAllowlist(t *testing.T) {
+ t.Setenv("CYCLOPS_CS_ADMIN_SUBS", `[]`)
+ t.Setenv("CYCLOPS_CS_CHAT_SUBS", `not-json`)
+ if err := featureflags.SetupProvider(context.Background(), "development", featureflags.AWSCredentials{}); err != nil {
+ t.Fatalf("setup dev provider: %v", err)
+ }
+ LoadOpa()
+ resetFlagsCache()
+
+ enabled, err := EvalChatEnabled(context.Background(), &User{ID: "not-json", AZP: "cyclops-cs-spa"})
+ if err != nil || enabled {
+ t.Fatalf("EvalChatEnabled(malformed allowlist) = %v, %v; want false, nil", enabled, err)
+ }
+}
diff --git a/libs/fleet/backend/auth/middlewares.go b/libs/fleet/backend/auth/middlewares.go
index e6692ec805..804311c75c 100644
--- a/libs/fleet/backend/auth/middlewares.go
+++ b/libs/fleet/backend/auth/middlewares.go
@@ -24,7 +24,10 @@ type ctxKey int
const UserKey ctxKey = 1
-var opaAdminQuery *rego.PreparedEvalQuery
+var (
+ opaAdminQuery *rego.PreparedEvalQuery
+ opaChatQuery *rego.PreparedEvalQuery
+)
// authzPolicy is the shared principal vocabulary every surface module imports.
// It holds no allow rule of its own; see authz.rego.
@@ -293,6 +296,7 @@ func LoadOpa() {
}
opaAdminQuery = prepareAuthzQuery("data.authz.is_admin")
+ opaChatQuery = prepareAuthzQuery("data.authz.chat_enabled")
// Warm the flag cache once so the first request isn't slowed by the
// initial resolve and any SSM/provider misconfiguration surfaces in the
@@ -304,6 +308,16 @@ func LoadOpa() {
// (data.authz.is_admin). is_admin only reads input.user and input.flags, so
// no route/method/path is needed.
func EvalIsAdmin(ctx context.Context, user *User) (bool, error) {
+ return evalUserDecision(ctx, user, opaAdminQuery)
+}
+
+// EvalChatEnabled returns the restricted-mode chat decision: administrators
+// and users listed in input.flags.chat_subs are enabled.
+func EvalChatEnabled(ctx context.Context, user *User) (bool, error) {
+ return evalUserDecision(ctx, user, opaChatQuery)
+}
+
+func evalUserDecision(ctx context.Context, user *User, query *rego.PreparedEvalQuery) (bool, error) {
if user == nil {
return false, nil
}
@@ -311,7 +325,7 @@ func EvalIsAdmin(ctx context.Context, user *User) (bool, error) {
"user": buildUserInput(user),
"flags": flagsData(),
}
- res, err := opaAdminQuery.Eval(ctx, rego.EvalInput(input))
+ res, err := query.Eval(ctx, rego.EvalInput(input))
if err != nil {
return false, err
}
diff --git a/libs/fleet/backend/auth/policy_test.go b/libs/fleet/backend/auth/policy_test.go
index 257e3db7ca..e141aeb997 100644
--- a/libs/fleet/backend/auth/policy_test.go
+++ b/libs/fleet/backend/auth/policy_test.go
@@ -148,6 +148,37 @@ func evalIsAdmin(t *testing.T, input map[string]any) bool {
return rs.Allowed()
}
+func evalChatEnabled(t *testing.T, input map[string]any) bool {
+ t.Helper()
+ pq := prepareQuery(t, "data.authz.chat_enabled", map[string]string{"authz.rego": authzPolicy})
+ rs, err := pq.Eval(context.Background(), rego.EvalInput(input))
+ if err != nil {
+ t.Fatalf("eval chat_enabled: %v", err)
+ }
+ return rs.Allowed()
+}
+
+func TestChatEnabled(t *testing.T) {
+ tests := []struct {
+ name string
+ input map[string]any
+ want bool
+ }{
+ {name: "admin", input: map[string]any{"user": spaUser("admin"), "flags": map[string]any{"admin_subs": []any{"admin"}, "chat_subs": []any{}}}, want: true},
+ {name: "allowlisted", input: map[string]any{"user": spaUser("listed"), "flags": map[string]any{"admin_subs": []any{}, "chat_subs": []any{"listed"}}}, want: true},
+ {name: "unlisted", input: map[string]any{"user": spaUser("other"), "flags": map[string]any{"admin_subs": []any{}, "chat_subs": []any{"listed"}}}, want: false},
+ {name: "missing allowlist", input: map[string]any{"user": spaUser("other"), "flags": map[string]any{"admin_subs": []any{}}}, want: false},
+ {name: "malformed allowlist", input: map[string]any{"user": spaUser("other"), "flags": map[string]any{"admin_subs": []any{}, "chat_subs": "other"}}, want: false},
+ }
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ if got := evalChatEnabled(t, test.input); got != test.want {
+ t.Fatalf("chat_enabled = %v, want %v", got, test.want)
+ }
+ })
+ }
+}
+
func evalPoolAdmission(t *testing.T, input map[string]any) bool {
t.Helper()
pq := prepareQuery(t, "data.pool_admission.allow", map[string]string{
diff --git a/libs/fleet/backend/chat/litellm.go b/libs/fleet/backend/chat/litellm.go
index 1c86a652d5..f33f50c87e 100644
--- a/libs/fleet/backend/chat/litellm.go
+++ b/libs/fleet/backend/chat/litellm.go
@@ -16,6 +16,30 @@ import (
const (
bashToolDescription = "Execute a command in a temporary, isolated in-browser virtual filesystem. Network and host filesystem access are unavailable."
liteLLMResponseMaxBytes = 128 << 10
+ cyclopsSystemPrompt = `You are the Cyclops CS assistant. Treat unqualified product terms as Cyclops concepts: pools are Cyclops sandbox warm pools, claims are allocated sandboxes, and namespaces scope those resources.
+
+Use browser Bash when it helps. Ordinary Bash has an isolated in-memory filesystem with no network access and no host filesystem access. These authenticated Cyclops SDK methods are available as first-class Bash commands:
+listNamespaces []
+listPools []
+getPool [namespace, name]
+createPool [name, poolTemplateConfig]
+updatePoolServices [namespace, name, services]
+deletePool [namespace, name]
+listClaims [namespace]
+createClaim [namespace, poolName]
+getClaim [namespace, name]
+deleteClaim [namespace, name]
+listUserKeys []
+createUserKey [name, scopes?]
+deleteUserKey [id]
+
+These read-only CUA documentation and versioned code MCP tools are also available as first-class Bash commands:
+query_docs_db {"sql": string}
+query_docs_vectors {"query": string, "limit"?: number, "where"?: string, "select"?: string[]}
+query_code_db {"sql": string}
+query_code_vectors {"query": string, "limit"?: number, "where"?: string, "select"?: string[], "component"?: string}
+
+Pass Cyclops SDK method arguments as one JSON array argument. Pass MCP tool arguments as one JSON object argument. Either form can instead be piped to the command through stdin. Commands write JSON results to stdout, write errors to stderr, and compose with jq, pipes, redirects, files, conditionals, and loops. Use the SDK commands for live Cyclops state instead of guessing. Use the MCP commands for CUA documentation and versioned source questions, and cite returned documentation URLs or code sources as component@version:path. Do not claim that ordinary Bash can reach APIs; only the registered commands bridge to their services. Before a mutating command, state the intended change and use the exact arguments supplied by the user; ask only for missing required values. Be concise and action-oriented; ask a clarifying question only when the Cyclops interpretation is genuinely ambiguous.`
)
// ModelClient produces one assistant response while streaming content deltas.
@@ -235,7 +259,8 @@ func toolCallsSize(toolCalls map[int]ToolCall) int {
}
func liteLLMMessages(messages []Message) []liteLLMMessage {
- mapped := make([]liteLLMMessage, 0, len(messages))
+ mapped := make([]liteLLMMessage, 0, len(messages)+1)
+ mapped = append(mapped, liteLLMMessage{Role: Role("system"), Content: cyclopsSystemPrompt})
for _, message := range messages {
switch message.Role {
case RoleUser, RoleAssistant, RoleTool:
diff --git a/libs/fleet/backend/chat/litellm_test.go b/libs/fleet/backend/chat/litellm_test.go
index 0a074d87a8..adeba604d3 100644
--- a/libs/fleet/backend/chat/litellm_test.go
+++ b/libs/fleet/backend/chat/litellm_test.go
@@ -28,7 +28,8 @@ func TestLiteLLMCompleteStreamsContentAndRequest(t *testing.T) {
Model string `json:"model"`
Stream bool `json:"stream"`
Messages []struct {
- Role string `json:"role"`
+ Role string `json:"role"`
+ Content string `json:"content"`
} `json:"messages"`
Tools []struct {
Type string `json:"type"`
@@ -54,11 +55,20 @@ func TestLiteLLMCompleteStreamsContentAndRequest(t *testing.T) {
if body.Model != "test-model" || !body.Stream {
t.Errorf("model/stream = %q/%t, want test-model/true", body.Model, body.Stream)
}
- for _, message := range body.Messages {
- if message.Role == "system" {
- t.Fatal("request included a system-role message")
+ if len(body.Messages) != 2 {
+ t.Fatalf("message count = %d, want system and user", len(body.Messages))
+ }
+ if body.Messages[0].Role != "system" {
+ t.Fatalf("first message role = %q, want system", body.Messages[0].Role)
+ }
+ for _, fragment := range []string{"Cyclops CS", "listPools", "getPool", "listClaims", "JSON array", "query_docs_db", "query_docs_vectors", "query_code_db", "query_code_vectors", "JSON object", "component@version:path", "no network access"} {
+ if !strings.Contains(body.Messages[0].Content, fragment) {
+ t.Errorf("system prompt missing %q", fragment)
}
}
+ if body.Messages[1].Role != "user" || body.Messages[1].Content != "Say hello" {
+ t.Errorf("user message = %#v", body.Messages[1])
+ }
if len(body.Tools) != 1 {
t.Fatalf("tool count = %d, want 1", len(body.Tools))
}
diff --git a/libs/fleet/backend/config/config.go b/libs/fleet/backend/config/config.go
index a1b4d325b8..b8c94dfd3b 100644
--- a/libs/fleet/backend/config/config.go
+++ b/libs/fleet/backend/config/config.go
@@ -98,8 +98,20 @@ type DatabaseConfiguration struct {
StateQueryTenantPassword string // STATE_QUERY_TENANT_PASSWORD — shared tenant query login password
}
+type ChatAccessMode string
+
+const (
+ ChatAccessDisabled ChatAccessMode = "disabled"
+ ChatAccessRestricted ChatAccessMode = "restricted"
+ ChatAccessAll ChatAccessMode = "all"
+)
+
+func (mode ChatAccessMode) Enabled() bool {
+ return mode == ChatAccessRestricted || mode == ChatAccessAll
+}
+
type ChatConfiguration struct {
- Enabled bool
+ Access ChatAccessMode
BaseURL string
APIKey string
Model string
@@ -154,7 +166,8 @@ var specs = []flagSpec{
{"stripe.checkout-success-url", "stripe-checkout-success-url", "STRIPE_CHECKOUT_SUCCESS_URL", "", "Stripe Checkout success redirect URL"},
{"stripe.checkout-cancel-url", "stripe-checkout-cancel-url", "STRIPE_CHECKOUT_CANCEL_URL", "", "Stripe Checkout cancel redirect URL"},
{"stripe.portal-return-url", "stripe-portal-return-url", "STRIPE_PORTAL_RETURN_URL", "", "Stripe Billing Portal return URL"},
- {"chat.enabled", "chat-enabled", "CYCLOPS_CS_CHAT_ENABLED", "false", "enable browser bash chat"},
+ {"chat.access", "chat-access", "CYCLOPS_CS_CHAT_ACCESS", "", "chat access mode: disabled, restricted, or all"},
+ {"chat.enabled", "chat-enabled", "CYCLOPS_CS_CHAT_ENABLED", "false", "legacy browser bash chat toggle"},
{"chat.base-url", "litellm-base-url", "LITELLM_BASE_URL", "", "LiteLLM OpenAI-compatible base URL"},
{"chat.api-key", "litellm-api-key", "LITELLM_API_KEY", "", "LiteLLM virtual key"},
{"chat.model", "litellm-model", "LITELLM_MODEL", "large", "LiteLLM model alias"},
@@ -251,7 +264,7 @@ func LoadConfig() (*Configuration, error) {
PortalReturnURL: viper.GetString("stripe.portal-return-url"),
},
Chat: ChatConfiguration{
- Enabled: viper.GetBool("chat.enabled"),
+ Access: chatAccessMode(viper.GetString("chat.access"), viper.GetBool("chat.enabled")),
BaseURL: viper.GetString("chat.base-url"),
APIKey: viper.GetString("chat.api-key"),
Model: viper.GetString("chat.model"),
@@ -269,8 +282,24 @@ func LoadConfig() (*Configuration, error) {
if cfg.Keycloak.AdminClientSecret == "" {
return nil, fmt.Errorf("KC_ADMIN_CLIENT_SECRET is required")
}
- if cfg.Chat.Enabled && (cfg.Chat.BaseURL == "" || cfg.Chat.APIKey == "") {
- return nil, fmt.Errorf("chat.enabled requires LITELLM_BASE_URL and LITELLM_API_KEY")
+ if cfg.Chat.Access.Enabled() && (cfg.Chat.BaseURL == "" || cfg.Chat.APIKey == "") {
+ return nil, fmt.Errorf("enabled chat access requires LITELLM_BASE_URL and LITELLM_API_KEY")
}
return cfg, nil
}
+
+func chatAccessMode(access string, legacyEnabled bool) ChatAccessMode {
+ switch ChatAccessMode(strings.ToLower(strings.TrimSpace(access))) {
+ case ChatAccessDisabled:
+ return ChatAccessDisabled
+ case ChatAccessRestricted:
+ return ChatAccessRestricted
+ case ChatAccessAll:
+ return ChatAccessAll
+ case "":
+ if legacyEnabled {
+ return ChatAccessAll
+ }
+ }
+ return ChatAccessDisabled
+}
diff --git a/libs/fleet/backend/config/config_test.go b/libs/fleet/backend/config/config_test.go
index bc833bc909..8bdec3e066 100644
--- a/libs/fleet/backend/config/config_test.go
+++ b/libs/fleet/backend/config/config_test.go
@@ -183,7 +183,6 @@ func TestLoadConfig_StateDatabaseURLs(t *testing.T) {
}
}
-
func loadChatTestConfig(t *testing.T) (*Configuration, error) {
t.Helper()
viper.Reset()
@@ -193,18 +192,49 @@ func loadChatTestConfig(t *testing.T) (*Configuration, error) {
return LoadConfig()
}
-func TestLoadConfig_ChatDisabledDefaults(t *testing.T) {
- cfg, err := loadChatTestConfig(t)
- if err != nil {
- t.Fatalf("LoadConfig() error = %v", err)
+func TestLoadConfig_ChatAccessModes(t *testing.T) {
+ tests := []struct {
+ name string
+ access string
+ legacy string
+ wantAccess ChatAccessMode
+ }{
+ {name: "default disabled", wantAccess: ChatAccessDisabled},
+ {name: "disabled", access: "disabled", wantAccess: ChatAccessDisabled},
+ {name: "restricted", access: "restricted", wantAccess: ChatAccessRestricted},
+ {name: "all", access: "all", wantAccess: ChatAccessAll},
+ {name: "invalid fails closed", access: "unexpected", legacy: "true", wantAccess: ChatAccessDisabled},
+ {name: "new mode overrides legacy", access: "restricted", legacy: "false", wantAccess: ChatAccessRestricted},
+ {name: "legacy true maps to all", legacy: "true", wantAccess: ChatAccessAll},
+ {name: "legacy false maps to disabled", legacy: "false", wantAccess: ChatAccessDisabled},
}
- if cfg.Chat.Enabled || cfg.Chat.BaseURL != "" || cfg.Chat.APIKey != "" || cfg.Chat.Model != "large" {
- t.Fatalf("Chat = %#v, want disabled defaults", cfg.Chat)
+
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ if test.access != "" {
+ t.Setenv("CYCLOPS_CS_CHAT_ACCESS", test.access)
+ }
+ if test.legacy != "" {
+ t.Setenv("CYCLOPS_CS_CHAT_ENABLED", test.legacy)
+ }
+ if test.wantAccess.Enabled() {
+ t.Setenv("LITELLM_BASE_URL", "https://litellm.example/v1")
+ t.Setenv("LITELLM_API_KEY", "secret")
+ }
+
+ cfg, err := loadChatTestConfig(t)
+ if err != nil {
+ t.Fatalf("LoadConfig() error = %v", err)
+ }
+ if cfg.Chat.Access != test.wantAccess {
+ t.Fatalf("Chat.Access = %q, want %q", cfg.Chat.Access, test.wantAccess)
+ }
+ })
}
}
-func TestLoadConfig_ChatEnabledWithCredentials(t *testing.T) {
- t.Setenv("CYCLOPS_CS_CHAT_ENABLED", "true")
+func TestLoadConfig_ChatAccessWithCredentials(t *testing.T) {
+ t.Setenv("CYCLOPS_CS_CHAT_ACCESS", "all")
t.Setenv("LITELLM_BASE_URL", "https://litellm.example/v1")
t.Setenv("LITELLM_API_KEY", "secret")
t.Setenv("LITELLM_MODEL", "browser-bash")
@@ -212,15 +242,18 @@ func TestLoadConfig_ChatEnabledWithCredentials(t *testing.T) {
if err != nil {
t.Fatalf("LoadConfig() error = %v", err)
}
- if !cfg.Chat.Enabled || cfg.Chat.BaseURL != "https://litellm.example/v1" || cfg.Chat.APIKey != "secret" || cfg.Chat.Model != "browser-bash" {
- t.Fatalf("Chat = %#v, want enabled configuration", cfg.Chat)
+ if cfg.Chat.Access != ChatAccessAll || cfg.Chat.BaseURL != "https://litellm.example/v1" || cfg.Chat.APIKey != "secret" || cfg.Chat.Model != "browser-bash" {
+ t.Fatalf("Chat = %#v, want all-users configuration", cfg.Chat)
}
}
-func TestLoadConfig_ChatEnabledRequiresCredentials(t *testing.T) {
+func TestLoadConfig_ChatAccessRequiresCredentials(t *testing.T) {
for name, env := range map[string]map[string]string{
- "missing base URL": {"CYCLOPS_CS_CHAT_ENABLED": "true", "LITELLM_API_KEY": "secret"},
- "missing API key": {"CYCLOPS_CS_CHAT_ENABLED": "true", "LITELLM_BASE_URL": "https://litellm.example/v1"},
+ "restricted missing base URL": {"CYCLOPS_CS_CHAT_ACCESS": "restricted", "LITELLM_API_KEY": "secret"},
+ "restricted missing API key": {"CYCLOPS_CS_CHAT_ACCESS": "restricted", "LITELLM_BASE_URL": "https://litellm.example/v1"},
+ "all missing base URL": {"CYCLOPS_CS_CHAT_ACCESS": "all", "LITELLM_API_KEY": "secret"},
+ "all missing API key": {"CYCLOPS_CS_CHAT_ACCESS": "all", "LITELLM_BASE_URL": "https://litellm.example/v1"},
+ "legacy missing base URL": {"CYCLOPS_CS_CHAT_ENABLED": "true", "LITELLM_API_KEY": "secret"},
} {
t.Run(name, func(t *testing.T) {
for key, value := range env {
@@ -233,3 +266,10 @@ func TestLoadConfig_ChatEnabledRequiresCredentials(t *testing.T) {
})
}
}
+
+func TestLoadConfig_ChatDisabledDoesNotRequireCredentials(t *testing.T) {
+ t.Setenv("CYCLOPS_CS_CHAT_ACCESS", "disabled")
+ if _, err := loadChatTestConfig(t); err != nil {
+ t.Fatalf("LoadConfig() error = %v, want disabled mode without credentials", err)
+ }
+}
diff --git a/libs/fleet/backend/handlers/chat.go b/libs/fleet/backend/handlers/chat.go
index ca77a4606a..13c12ca800 100644
--- a/libs/fleet/backend/handlers/chat.go
+++ b/libs/fleet/backend/handlers/chat.go
@@ -34,7 +34,7 @@ type turnEvent struct {
}
func (h Handlers) chatUser(w http.ResponseWriter, r *http.Request) *auth.User {
- if !h.ChatEnabled {
+ if !h.ChatAccess.Enabled() {
writeErr(w, http.StatusNotFound, "chat is disabled")
return nil
}
@@ -43,6 +43,14 @@ func (h Handlers) chatUser(w http.ResponseWriter, r *http.Request) *auth.User {
writeErr(w, http.StatusUnauthorized, "missing user")
return nil
}
+ enabled, err := h.chatEnabled(r.Context(), user)
+ if err != nil {
+ slog.WarnContext(r.Context(), "chat access eval failed; defaulting off", "err", err, "user", user.ID)
+ }
+ if err != nil || !enabled {
+ writeErr(w, http.StatusNotFound, "chat is disabled")
+ return nil
+ }
if h.Conversations == nil {
writeErr(w, http.StatusServiceUnavailable, "chat is not configured")
return nil
diff --git a/libs/fleet/backend/handlers/chat_test.go b/libs/fleet/backend/handlers/chat_test.go
index 8fb0a58134..dc8f9f4316 100644
--- a/libs/fleet/backend/handlers/chat_test.go
+++ b/libs/fleet/backend/handlers/chat_test.go
@@ -13,6 +13,7 @@ import (
"cyclops-cs-backend/auth"
"cyclops-cs-backend/chat"
+ "cyclops-cs-backend/config"
)
type fakeModel struct {
@@ -47,7 +48,7 @@ func (f *fakeModel) Complete(_ context.Context, messages []chat.Message, onDelta
func newChatHandlers(responses ...chat.Message) (Handlers, *chat.MemoryConversationStore, *fakeModel) {
store := chat.NewMemoryConversationStore()
model := &fakeModel{responses: responses}
- return Handlers{ChatEnabled: true, Conversations: store, Model: model, chatLocks: newConversationLockRegistry()}, store, model
+ return Handlers{ChatAccess: config.ChatAccessAll, Conversations: store, Model: model, chatLocks: newConversationLockRegistry()}, store, model
}
func createChatConversation(t *testing.T, h Handlers, user *auth.User) *chat.Conversation {
@@ -362,7 +363,7 @@ func TestChatTurnSerializesConcurrentTurnsPerConversation(t *testing.T) {
secondStarted: make(chan struct{}),
releaseFirst: make(chan struct{}),
}
- h := Handlers{ChatEnabled: true, Conversations: store, Model: model}
+ h := Handlers{ChatAccess: config.ChatAccessAll, Conversations: store, Model: model}
conversation := createChatConversation(t, h, alice)
statuses := make(chan int, 2)
@@ -504,7 +505,7 @@ func TestConversationLockRegistryEvictsReleasedLocks(t *testing.T) {
func TestCreateConversationReportsStoreLimit(t *testing.T) {
store := chat.NewMemoryConversationStore()
- h := Handlers{ChatEnabled: true, Conversations: store, Model: &fakeModel{}}
+ h := Handlers{ChatAccess: config.ChatAccessAll, Conversations: store, Model: &fakeModel{}}
for index := 0; index < 100; index++ {
w := httptest.NewRecorder()
h.CreateConversation(w, newReq(http.MethodPost, "/api/chat/conversations", "", alice))
@@ -518,3 +519,37 @@ func TestCreateConversationReportsStoreLimit(t *testing.T) {
t.Fatalf("status = %d, want 429; body = %s", w.Code, w.Body.String())
}
}
+
+func TestChatEndpointsEnforceEffectiveAccess(t *testing.T) {
+ store := chat.NewMemoryConversationStore()
+ user := &auth.User{ID: "restricted-user", AZP: "cyclops-cs-spa"}
+ tests := []struct {
+ name string
+ access config.ChatAccessMode
+ restricted bool
+ wantStatus int
+ }{
+ {name: "disabled", access: config.ChatAccessDisabled, restricted: true, wantStatus: http.StatusNotFound},
+ {name: "all", access: config.ChatAccessAll, restricted: false, wantStatus: http.StatusCreated},
+ {name: "restricted allowed", access: config.ChatAccessRestricted, restricted: true, wantStatus: http.StatusCreated},
+ {name: "restricted denied", access: config.ChatAccessRestricted, restricted: false, wantStatus: http.StatusNotFound},
+ }
+
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ h := Handlers{
+ ChatAccess: test.access,
+ Conversations: store,
+ Model: &fakeModel{},
+ chatAccessEvaluator: func(context.Context, *auth.User) (bool, error) {
+ return test.restricted, nil
+ },
+ }
+ w := httptest.NewRecorder()
+ h.CreateConversation(w, newReq(http.MethodPost, "/api/chat/conversations", "", user))
+ if w.Code != test.wantStatus {
+ t.Fatalf("status = %d, want %d; body = %s", w.Code, test.wantStatus, w.Body.String())
+ }
+ })
+ }
+}
diff --git a/libs/fleet/backend/handlers/config.go b/libs/fleet/backend/handlers/config.go
index 2b8234234f..187e0b3826 100644
--- a/libs/fleet/backend/handlers/config.go
+++ b/libs/fleet/backend/handlers/config.go
@@ -47,5 +47,11 @@ func (h Handlers) GetConfig(w http.ResponseWriter, r *http.Request) {
billingEnabled = false
}
- writeJSON(w, http.StatusOK, ConfigResponse{Admin: isAdmin, Billing: billingEnabled, Chat: h.ChatEnabled})
+ chatEnabled, err := h.chatEnabled(ctx, user)
+ if err != nil {
+ slog.WarnContext(ctx, "chat access eval failed; defaulting off", "err", err)
+ chatEnabled = false
+ }
+
+ writeJSON(w, http.StatusOK, ConfigResponse{Admin: isAdmin, Billing: billingEnabled, Chat: chatEnabled})
}
diff --git a/libs/fleet/backend/handlers/config_test.go b/libs/fleet/backend/handlers/config_test.go
new file mode 100644
index 0000000000..62041f9515
--- /dev/null
+++ b/libs/fleet/backend/handlers/config_test.go
@@ -0,0 +1,52 @@
+package handlers
+
+import (
+ "context"
+ "encoding/json"
+ "net/http"
+ "net/http/httptest"
+ "testing"
+
+ "cyclops-cs-backend/auth"
+ "cyclops-cs-backend/config"
+)
+
+func TestGetConfigReturnsEffectiveChatAccess(t *testing.T) {
+ auth.LoadOpa()
+ user := &auth.User{ID: "user-1", AZP: "cyclops-cs-spa"}
+ tests := []struct {
+ name string
+ access config.ChatAccessMode
+ restricted bool
+ want bool
+ }{
+ {name: "disabled", access: config.ChatAccessDisabled, restricted: true, want: false},
+ {name: "all", access: config.ChatAccessAll, restricted: false, want: true},
+ {name: "restricted allowed", access: config.ChatAccessRestricted, restricted: true, want: true},
+ {name: "restricted denied", access: config.ChatAccessRestricted, restricted: false, want: false},
+ }
+
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ h := Handlers{
+ ChatAccess: test.access,
+ chatAccessEvaluator: func(context.Context, *auth.User) (bool, error) {
+ return test.restricted, nil
+ },
+ }
+ w := httptest.NewRecorder()
+ h.GetConfig(w, withUser(httptest.NewRequest(http.MethodGet, "/api/config", nil), user))
+
+ if w.Code != http.StatusOK {
+ t.Fatalf("status = %d, want 200; body = %s", w.Code, w.Body.String())
+ }
+ var response ConfigResponse
+ if err := json.Unmarshal(w.Body.Bytes(), &response); err != nil {
+ t.Fatalf("decode response: %v", err)
+ }
+ if response.Chat != test.want {
+ t.Fatalf("chat = %v, want %v", response.Chat, test.want)
+ }
+ })
+ }
+}
diff --git a/libs/fleet/backend/handlers/handlers.go b/libs/fleet/backend/handlers/handlers.go
index 08f5f75542..cb875d8566 100644
--- a/libs/fleet/backend/handlers/handlers.go
+++ b/libs/fleet/backend/handlers/handlers.go
@@ -4,6 +4,7 @@ package handlers
import (
"bufio"
+ "context"
"encoding/json"
"fmt"
"net"
@@ -32,10 +33,11 @@ type Handlers struct {
StateQueryExecutor StateQueryExecutor
- ChatEnabled bool
- Conversations chat.ConversationStore
- Model chat.ModelClient
- chatLocks *conversationLockRegistry
+ ChatAccess config.ChatAccessMode
+ Conversations chat.ConversationStore
+ Model chat.ModelClient
+ chatAccessEvaluator func(context.Context, *auth.User) (bool, error)
+ chatLocks *conversationLockRegistry
// WorkloadAdmin manages per-tenant clients in the workloads realm so
// OSGym pool VMs can obtain a tenant-scoped OIDC token. nil disables
@@ -49,13 +51,31 @@ type Handlers struct {
func New(admin *keycloak.Admin, cfg *config.Configuration) Handlers {
return Handlers{
- Admin: admin,
- GatewayCfg: cfg.Gateway,
- AuthCfg: cfg.Auth,
- KC: cfg.Keycloak,
- Stripe: cfg.Stripe,
- ChatEnabled: cfg.Chat.Enabled,
- chatLocks: newConversationLockRegistry(),
+ Admin: admin,
+ GatewayCfg: cfg.Gateway,
+ AuthCfg: cfg.Auth,
+ KC: cfg.Keycloak,
+ Stripe: cfg.Stripe,
+ ChatAccess: cfg.Chat.Access,
+ chatLocks: newConversationLockRegistry(),
+ }
+}
+
+func (h Handlers) chatEnabled(ctx context.Context, user *auth.User) (bool, error) {
+ if user == nil || user.ID == "" {
+ return false, nil
+ }
+ switch h.ChatAccess {
+ case config.ChatAccessAll:
+ return true, nil
+ case config.ChatAccessRestricted:
+ evaluator := h.chatAccessEvaluator
+ if evaluator == nil {
+ evaluator = auth.EvalChatEnabled
+ }
+ return evaluator(ctx, user)
+ default:
+ return false, nil
}
}
diff --git a/libs/fleet/backend/main.go b/libs/fleet/backend/main.go
index 4683283d31..8518a19579 100644
--- a/libs/fleet/backend/main.go
+++ b/libs/fleet/backend/main.go
@@ -336,10 +336,10 @@ func run() error {
h.WorkloadTokenURL = cfg.Keycloak.WorkloadTokenURL
initializeDatabaseFeatures(ctx, cfg.Database, &h, defaultDatabaseFeatureDependencies())
- if cfg.Chat.Enabled {
+ if cfg.Chat.Access.Enabled() {
h.Conversations = chat.NewMemoryConversationStore()
h.Model = chat.NewLiteLLMClient(cfg.Chat.BaseURL, cfg.Chat.APIKey, cfg.Chat.Model)
- slog.Info("chat: enabled", "base_url", cfg.Chat.BaseURL, "model", cfg.Chat.Model)
+ slog.Info("chat: enabled", "access", cfg.Chat.Access, "base_url", cfg.Chat.BaseURL, "model", cfg.Chat.Model)
}
router := setupRouter(h)
diff --git a/libs/fleet/docs/browser-agent.md b/libs/fleet/docs/browser-agent.md
index e106b57980..9751a02057 100644
--- a/libs/fleet/docs/browser-agent.md
+++ b/libs/fleet/docs/browser-agent.md
@@ -44,7 +44,7 @@ Run the Go backend with chat enabled in a separate terminal:
```bash
cd cyclops-cs/backend
-CYCLOPS_CS_CHAT_ENABLED=true \
+CYCLOPS_CS_CHAT_ACCESS=all \
LITELLM_BASE_URL=http://localhost:4000/v1 \
LITELLM_MODEL=large \
LITELLM_API_KEY='<virtual-key>' \
@@ -57,13 +57,15 @@ storage.
## Backend configuration
-- `CYCLOPS_CS_CHAT_ENABLED` enables the Chat navigation item and API handlers.
+- `CYCLOPS_CS_CHAT_ACCESS` selects `disabled`, `restricted`, or `all`.
+- `CYCLOPS_CS_CHAT_SUBS` is a JSON array of non-admin Keycloak `sub` values used in `restricted` mode; admins are enabled automatically.
- `LITELLM_BASE_URL` is the OpenAI-compatible API base URL, including `/v1`.
- `LITELLM_MODEL` selects the model alias and defaults to `large`.
- `LITELLM_API_KEY` is the backend-only LiteLLM virtual key.
-When chat is enabled, both `LITELLM_BASE_URL` and `LITELLM_API_KEY` are
-required.
+In `restricted` and `all` modes, both `LITELLM_BASE_URL` and
+`LITELLM_API_KEY` are required. `CYCLOPS_CS_CHAT_ENABLED=true` remains a
+legacy fallback for `all` only when `CYCLOPS_CS_CHAT_ACCESS` is unset.
## API routes
@@ -115,7 +117,7 @@ a general-purpose or unrestricted gateway key for previews.
Before adding preview wiring, the source-tree assertion was:
```bash
-rg -n "CYCLOPS_CS_CHAT_ENABLED|LITELLM_BASE_URL|LITELLM_API_KEY|litellm-credentials.yaml" \
+rg -n "CYCLOPS_CS_CHAT_ACCESS|CYCLOPS_CS_CHAT_SUBS|LITELLM_BASE_URL|LITELLM_API_KEY|litellm-credentials.yaml" \
clusters/kopf-k3s/cyclops-cs-previews-base
```
@@ -144,7 +146,7 @@ Render and inspect the preview manifests:
kubectl kustomize clusters/kopf-k3s/cyclops-cs-previews-base \
> /tmp/cyclops-chat-preview.yaml
rg -n \
- "kind: ExternalSecret|CYCLOPS_CS_CHAT_ENABLED|LITELLM_BASE_URL|LITELLM_MODEL|LITELLM_API_KEY" \
+ "kind: ExternalSecret|CYCLOPS_CS_CHAT_ACCESS|CYCLOPS_CS_CHAT_SUBS|LITELLM_BASE_URL|LITELLM_MODEL|LITELLM_API_KEY" \
/tmp/cyclops-chat-preview.yaml
```
diff --git a/libs/fleet/e2e/agent-chat.spec.ts b/libs/fleet/e2e/agent-chat.spec.ts
index 338ce54c0d..272afc7a5a 100644
--- a/libs/fleet/e2e/agent-chat.spec.ts
+++ b/libs/fleet/e2e/agent-chat.spec.ts
@@ -22,6 +22,34 @@ test("shows chat history, transcript region, prompt shell, and authenticated his
)
})
+test("renders a full-width multiline composer with hidden announcements", async ({ page }) => {
+ await mockAuth(page, { admin: false, chat: true })
+ await mockChatApi(page)
+
+ await page.goto("/agent")
+
+ const composer = page.locator(".agent-chat-composer")
+ const prompt = page.locator(".agent-chat-prompt")
+ const textarea = page.getByPlaceholder("Ask a question")
+ const composerBox = await composer.boundingBox()
+ const promptBox = await prompt.boundingBox()
+ const initialHeight = (await textarea.boundingBox())?.height ?? 0
+
+ expect(composerBox).not.toBeNull()
+ expect(promptBox).not.toBeNull()
+ expect((promptBox?.width ?? 0) / (composerBox?.width ?? 1)).toBeGreaterThan(0.9)
+ expect(initialHeight).toBeGreaterThan(44)
+
+ await textarea.fill("First line\nSecond line\nThird line")
+ await expect.poll(async () => (await textarea.boundingBox())?.height ?? 0).toBeGreaterThan(initialHeight)
+
+ const announcement = page.locator('[aria-live="polite"]').filter({ hasText: "No conversation selected" })
+ const announcements = page.locator(".agent-chat-announcements")
+ await expect(announcement).toBeAttached()
+ await expect(announcements).toHaveCSS("overflow", "hidden")
+ await expect.poll(async () => announcements.evaluate(element => ({ width: element.clientWidth, height: element.clientHeight }))).toEqual({ width: 1, height: 1 })
+})
+
test("keeps the prompt visible while conversation history loads", async ({ page }) => {
await mockAuth(page, { admin: false, chat: true })
const chat = await mockChatApi(page, { holdList: true })
@@ -50,6 +78,67 @@ test("loads a selected conversation with message skeletons and accessible author
await expect(page.getByLabel(/^Assistant at /)).toBeVisible()
})
+test("renders and sanitizes Markdown in user and assistant messages", async ({ page }) => {
+ const now = new Date().toISOString()
+ await mockAuth(page, { admin: false, chat: true })
+ await mockChatApi(page, {
+ conversations: [{
+ id: "markdown-chat",
+ title: "Markdown chat",
+ created_at: now,
+ updated_at: now,
+ messages: [
+ {
+ id: "markdown-user",
+ role: "user",
+ content: [
+ "| Request | Value |",
+ "| --- | --- |",
+ "| Format | **Markdown** |",
+ "",
+ "[Safe link](https://example.com) [Unsafe link](javascript:alert(1))",
+ "",
+ '<script>window.__markdownXss = true</script><img src="https://example.com/tracker.png"><span id="location" style="color:red" onclick="window.__markdownXss = true">Sanitized text</span>',
+ ].join("\n"),
+ created_at: now,
+ },
+ {
+ id: "markdown-assistant",
+ role: "assistant",
+ content: [
+ "| Pool | Phase |",
+ "| --- | --- |",
+ "| demo | Ready |",
+ "",
+ "```ts",
+ "const ready = true",
+ "```",
+ ].join("\n"),
+ created_at: now,
+ },
+ ],
+ }],
+ })
+
+ await page.goto("/agent")
+ await page.getByRole("button", { name: "Markdown chat" }).click()
+
+ const userBubble = page.getByLabel(/^You at /)
+ const assistantBubble = page.getByLabel(/^Assistant at /)
+ await expect(userBubble.getByRole("table")).toBeVisible()
+ await expect(userBubble.getByRole("link", { name: "Safe link" })).toHaveAttribute("href", "https://example.com")
+ await expect(userBubble.getByText("Unsafe link")).not.toHaveAttribute("href", /.+/)
+ await expect(assistantBubble.getByRole("table")).toBeVisible()
+ await expect(assistantBubble.locator("pre code")).toContainText("const ready = true")
+
+ await expect(userBubble.locator("script, img")).toHaveCount(0)
+ const sanitizedSpan = userBubble.getByText("Sanitized text")
+ await expect(sanitizedSpan).not.toHaveAttribute("style")
+ await expect(sanitizedSpan).not.toHaveAttribute("onclick")
+ await expect(sanitizedSpan).not.toHaveAttribute("id")
+ expect(await page.evaluate(() => (window as Window & { __markdownXss?: boolean }).__markdownXss)).toBeUndefined()
+})
+
test("does not redirect while chat feature configuration is pending", async ({ page }) => {
const auth = await mockAuth(page, { admin: false, chat: true }, { holdConfig: true })
await mockChatApi(page)
@@ -217,6 +306,28 @@ test("scrolls the newest message into view while keeping the composer fixed", as
expect(composerAfter?.y).toBeCloseTo(composerBefore?.y ?? 0, 0)
})
+test("contains long chat history without inflating document scroll", async ({ page }) => {
+ await page.setViewportSize({ width: 1920, height: 1080 })
+ const now = new Date().toISOString()
+ const messages = Array.from({ length: 20 }, (_, index) => ({
+ id: `windows-history-${index}`,
+ role: index % 2 === 0 ? "user" as const : "assistant" as const,
+ content: `| Column | Value |\n| --- | --- |\n| Row ${index} | ${"windows-image-value ".repeat(8)} |`,
+ created_at: now,
+ }))
+ await mockAuth(page, { admin: false, chat: true })
+ await mockChatApi(page, {
+ conversations: [{ id: "windows-history", title: "Windows history", created_at: now, updated_at: now, messages }],
+ })
+
+ await page.goto("/agent")
+ await page.getByRole("button", { name: "Windows history" }).click()
+
+ const transcript = page.getByRole("region", { name: "Chat" })
+ await expect.poll(() => transcript.evaluate(element => element.scrollHeight - element.clientHeight)).toBeGreaterThan(1000)
+ await expect.poll(() => page.evaluate(() => document.documentElement.scrollHeight - window.innerHeight)).toBeLessThan(100)
+})
+
test("parses fragmented unterminated NDJSON and rejects malformed final events", async ({ page }) => {
await mockAuth(page)
await page.goto("/pools")
@@ -386,18 +497,21 @@ test("shows an API error and retries without duplicating the user bubble", async
])
})
-test("keeps streamed content in one assistant bubble", async ({ page }) => {
+test("keeps streamed Markdown in one assistant bubble", async ({ page }) => {
+ const markdown = "| State | Value |\n| --- | --- |\n| Stream | Ready |"
await mockAuth(page, { admin: false, chat: true })
await mockChatApi(page, {
conversations: [],
- turns: [{ events: [{ type: "content_delta", delta: "One " }, { type: "content_delta", delta: "bubble" }, assistant("One bubble")] }],
+ turns: [{ events: [{ type: "content_delta", delta: markdown.slice(0, 24) }, { type: "content_delta", delta: markdown.slice(24) }, assistant(markdown)] }],
})
await page.goto("/agent")
await page.getByPlaceholder("Ask a question").fill("Stream")
await page.getByRole("button", { name: "Send message" }).click()
- await expect(page.getByText("One bubble")).toBeVisible()
- await expect(page.getByLabel(/^Assistant at /)).toHaveCount(1)
+ const assistantBubble = page.getByLabel(/^Assistant at /)
+ await expect(assistantBubble.getByRole("table")).toBeVisible()
+ await expect(assistantBubble.getByRole("cell", { name: "Ready" })).toBeVisible()
+ await expect(assistantBubble).toHaveCount(1)
})
test("reconstructs stored bash command steps from tool history", async ({ page }) => {
@@ -498,11 +612,11 @@ test("announces conversation loading, loaded, and no selected conversation", asy
await mockAuth(page, { admin: false, chat: true })
const chat = await mockChatApi(page, { holdConversation: true })
await page.goto("/agent")
- await expect(page.locator('[aria-live]').filter({ hasText: "No conversation selected" })).toBeVisible()
+ await expect(page.locator('[aria-live]').filter({ hasText: "No conversation selected" })).toBeAttached()
await page.getByRole("button", { name: "Example browser task" }).click()
- await expect(page.locator('[aria-live]').filter({ hasText: "Loading conversation" })).toBeVisible()
+ await expect(page.locator('[aria-live]').filter({ hasText: "Loading conversation" })).toBeAttached()
chat.releaseConversation()
- await expect(page.locator('[aria-live]').filter({ hasText: "Conversation loaded" })).toBeVisible()
+ await expect(page.locator('[aria-live]').filter({ hasText: "Conversation loaded" })).toBeAttached()
})
diff --git a/libs/fleet/package.json b/libs/fleet/package.json
index e3292ce1ad..49b3e73900 100644
--- a/libs/fleet/package.json
+++ b/libs/fleet/package.json
@@ -30,7 +30,10 @@
"react-dom": "^18.3.1",
"react-router-dom": "^6.28.0",
"@cloudscape-design/chat-components": "^1.0.157",
- "just-bash": "^3.2.0"
+ "just-bash": "^3.2.0",
+ "@modelcontextprotocol/sdk": "1.29.0",
+ "dompurify": "^3.4.13",
+ "marked": "^18.0.9"
},
"devDependencies": {
"@biomejs/biome": "^2.4.15",
diff --git a/libs/fleet/pnpm-lock.yaml b/libs/fleet/pnpm-lock.yaml
index ebfd1fb98c..e884fb6839 100644
--- a/libs/fleet/pnpm-lock.yaml
+++ b/libs/fleet/pnpm-lock.yaml
@@ -25,6 +25,9 @@ importers:
'@cloudscape-design/global-styles':
specifier: ^1.0.36
version: 1.0.58
+ '@modelcontextprotocol/sdk':
+ specifier: 1.29.0
+ version: 1.29.0([email protected])
'@novnc/novnc':
specifier: ^1.7.0
version: 1.7.0(patch_hash=c119c00d14c51f940f1ebed4fe41ad2fe1358c63e1095baa39d11d696b66dbff)
@@ -34,12 +37,18 @@ importers:
ansi-to-html:
specifier: ^0.7.2
version: 0.7.2
+ dompurify:
+ specifier: ^3.4.13
+ version: 3.4.13
just-bash:
specifier: ^3.2.0
version: 3.2.0
keycloak-js:
specifier: ^25.0.6
version: 25.0.6
+ marked:
+ specifier: ^18.0.9
+ version: 18.0.9
react:
specifier: ^18.3.1
version: 18.3.1
@@ -425,6 +434,12 @@ packages:
'@formatjs/[email protected]':
resolution: {integrity: sha512-XOMO2Hupl0wdd172Y06h6kLpBz6Dv+J4okPLl4LPtzbr8f66WbIoy4ev98EBuZ6ZK4h5ydTN6XneT4QVpD7cdA==}
+ resolution: {integrity: sha512-dSneS5qhiauZWGDCeK4o695Xd9nUNjviSZCMQrj10eetr8Uln1ucn6bbphOM6UynAMMtNIzZNSpL9vnASJwrPQ==}
+ engines: {node: '>=18.14.1'}
+ peerDependencies:
+ hono: ^4
+
resolution: {integrity: sha512-v9T+GQpmk43VDJ7d72sf0Nexhk+ArvtUihW27dy7lqAl0zBObFKtSBBIm5RBjwIhE8VwsPPm9PNuvPvNqLWUEg==}
@@ -462,6 +477,16 @@ packages:
'@mixmark-io/[email protected]':
resolution: {integrity: sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw==}
+ '@modelcontextprotocol/[email protected]':
+ resolution: {integrity: sha512-zo37mZA9hJWpULgkRpowewez1y6ML5GsXJPY8FI0tBBCd77HEvza4jDqRKOXgHNn867PVGCyTdzqpz0izu5ZjQ==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ '@cfworker/json-schema': ^4.1.1
+ zod: ^3.25 || ^4.0
+ peerDependenciesMeta:
+ '@cfworker/json-schema':
+ optional: true
+
'@mongodb-js/[email protected]':
resolution: {integrity: sha512-mQ2s0pYYiav+tzCDR05Zptem8Ey2v8s11lri5RKGhTtL4COVCvVCk5vtyRYNT+9L8qSfyOqqefF9UtnW8mC5jA==}
engines: {node: '>= 20.19.0'}
@@ -645,6 +670,9 @@ packages:
resolution: {integrity: sha512-z9VXpC7MWrhfWipitjNdgCauoMLRdIILQsAEV+ZesIzBq/oUlxk0m3ApZuMFCXdnS4U7KrI+l3WRUEGQ8K1QKw==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==}
+
resolution: {integrity: sha512-39XrJgUZ2VVb561sSnkXPhczNoeBsNiSRArecsV0JE7CJq69ajFkcn9/tBAUS2NpgHkLIDU+z6Ks2+1wXnboxg==}
@@ -654,9 +682,24 @@ packages:
peerDependencies:
vite: ^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0
+ resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==}
+ engines: {node: '>= 0.6'}
+
resolution: {integrity: sha512-L1ddibQ7F3vyXR2k2fg+I8TQTPWVA6CKeDQr/h2+8CeyTp3W6EQL8xNFZRTztuP8xNOAqL3IYPqdzs31GCjDvg==}
+ resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==}
+ peerDependencies:
+ ajv: ^8.0.0
+ peerDependenciesMeta:
+ ajv:
+ optional: true
+
+ resolution: {integrity: sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==}
+
resolution: {integrity: sha512-v6MqmEpNlxF+POuyhKkidusCHWWkaLcGRURzivcU3I9tv7k4JVhFcnukrM5Rlk2rUywdZuzYAZ+kbZqWCnfN3g==}
engines: {node: '>=8.0.0'}
@@ -680,6 +723,10 @@ packages:
resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==}
+ resolution: {integrity: sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==}
engines: {node: 20 || >=22}
@@ -692,6 +739,18 @@ packages:
resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==}
+ resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==}
+ engines: {node: '>= 0.4'}
+
resolution: {integrity: sha512-hVLMUZFgR4JJ6ACt1uEESvQN1/dBVqPAKY0hgrV70eN3391K6juAfTjKZLKvOMsx8PxA7gsY1/tLMMTcfFLLpw==}
@@ -706,9 +765,37 @@ packages:
resolution: {integrity: sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==}
engines: {node: '>= 6'}
+ resolution: {integrity: sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==}
+ resolution: {integrity: sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==}
+ engines: {node: '>=6.6.0'}
+
+ resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==}
+ engines: {node: '>= 0.10'}
+
+ resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
+ engines: {node: '>= 8'}
+
resolution: {integrity: sha512-Jd6Ig3/pe62/qe5SBPTN8h8LeUg/pT4lLgtavPf7updwwHpvFzxvOQBHYj2LZDMjUnBzgvIUSjRcf6oT5HzHFg==}
@@ -753,6 +840,10 @@ packages:
resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==}
engines: {node: '>=4.0.0'}
+ resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}
+ engines: {node: '>= 0.8'}
+
resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
engines: {node: '>=8'}
@@ -764,15 +855,41 @@ packages:
resolution: {integrity: sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==}
+ resolution: {integrity: sha512-2vmYIoqjze2d+kakP8S/nS5shfsl587kzwEjcGlTdiksUVgFHnFCsLYDVj/JNqJVOQZGSYBTmuycv0PodwmnMQ==}
+
+ resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==}
+
resolution: {integrity: sha512-kOrWphBi8TOZyiJZqsgqIle0lw+tzmnQK83pV9dZUd01Nm2POECSyFQMAuarzZdYqQW7FH9RaYOuaRo3h+bQ3w==}
+ resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==}
+ engines: {node: '>= 0.8'}
+
resolution: {integrity: sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==}
resolution: {integrity: sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==}
+ resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==}
+ engines: {node: '>= 0.4'}
+
resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==}
engines: {node: '>=12'}
@@ -782,10 +899,41 @@ packages:
resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}
engines: {node: '>=6'}
+ resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==}
+
+ resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ==}
+ engines: {node: '>=18.0.0'}
+
+ resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==}
+ engines: {node: '>=18.0.0'}
+
resolution: {integrity: sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==}
engines: {node: '>=6'}
+ resolution: {integrity: sha512-YH4ru+eOJxQABscKFfRCy9R7x9QFGdezclVMwwgFFndzS2Xnm0uo6B0ABZsLhcpeptGv2qvuJVWlQr9gQZoC3A==}
+ engines: {node: '>= 16'}
+ peerDependencies:
+ express: '>= 4.11'
+
+ resolution: {integrity: sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==}
+ engines: {node: '>= 18'}
+
+ resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
+
+ resolution: {integrity: sha512-gHwA1O9LDIcKunMKhObS/HimwtehO1nPUECKAu5TpKgaO19fcWEl4bliWe1jWxVFvIXztJjjQ4L8XQ1EU9f7Jw==}
+
resolution: {integrity: sha512-F74cZEdCvuw9P41GAC3rod4X04jjWGM1JPEv/GWSqFTWLsdyMSBMBMlm9Hk3GLBgLBbdBNY8yee0pQh2RBVESQ==}
@@ -800,6 +948,18 @@ packages:
resolution: {integrity: sha512-Ievi/yy8DS3ygGvT47PjSfdFoX+2isQueoYP1cntFW1JLYAuS4GD7NUPGg4zv2iZfV52uDyk5w5Z0TdpRS6Q1g==}
engines: {node: '>=20'}
+ resolution: {integrity: sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==}
+ engines: {node: '>= 18.0.0'}
+
+ resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==}
+ engines: {node: '>= 0.8'}
+
resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}
@@ -813,13 +973,48 @@ packages:
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
os: [darwin]
+ resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
+
resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}
engines: {node: '>=6.9.0'}
+ resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==}
+ engines: {node: '>= 0.4'}
+
resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==}
+ resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-kdJoFVv2xmayw6cY09H7AbMJMt8Jn5jdlEdXsP7AGBdF2DIptVlKlOLKXP41yPip4/a3yQPv9gVcJYI8YY04dw==}
+ engines: {node: '>=16.9.0'}
+
+ resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==}
+ engines: {node: '>=0.10.0'}
+
resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==}
@@ -836,9 +1031,26 @@ packages:
resolution: {integrity: sha512-m3Ofv/X/tV8Y3tHXLohcuVuhWKo7BBq62cqY15etqmLxg2DZ34AGGgQDeR+SCta2+zICb1NX83af0GJmbQ1++g==}
+ resolution: {integrity: sha512-R5SnVLJmgYYvf2F2ZgwSBnelz5G4q5AxIC277GDfUaNbrZKNANcBC7RHqYYePlszf4kBolVkJauG0ZjHHFh55g==}
+ engines: {node: '>= 12'}
+
+ resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==}
+ engines: {node: '>= 0.10'}
+
+ resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==}
+
resolution: {integrity: sha512-2LdV822R+wmI86unXA93WCFpL6g+av8ynWk0nrHyJqGop5VoocYsSLFgN8jrfalT6iGeLNM4KXuVSsULP53kEA==}
+ resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
+
+ resolution: {integrity: sha512-Bsdjwm3Qsd/P0jR+BHDe3LytDfY7WBq2HmCCLIwuVRHMuEC9ae7/R474GIUdF1NgCyZjzVo/A9DOiOBtXq8ZoQ==}
+
resolution: {integrity: sha512-o6WSo/LUvY2uC4j7mO50a2ms7E/EAdbP0swigLV+nzHKTTaYnaLIWJ02VdXrsJX0vGedDESQnLsOekr94ryfjg==}
@@ -850,6 +1062,12 @@ packages:
engines: {node: '>=6'}
hasBin: true
+ resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==}
+
+ resolution: {integrity: sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==}
+
resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==}
engines: {node: '>=6'}
@@ -874,6 +1092,31 @@ packages:
resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}
+ resolution: {integrity: sha512-/Sa4qiiHZxf0/FQdBBowr9q4r10krCwMvpK48FUBdXdUXScDxiQGR9zCPrFgRVR5LU3iySOiIjy09ZQvADir1w==}
+ engines: {node: '>= 20'}
+ hasBin: true
+
+ resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==}
+ engines: {node: '>= 0.8'}
+
+ resolution: {integrity: sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==}
engines: {node: '>=10'}
@@ -907,6 +1150,10 @@ packages:
resolution: {integrity: sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==}
+ resolution: {integrity: sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==}
+ engines: {node: '>= 0.6'}
+
resolution: {integrity: sha512-W5ZNO5KRPB5TkYmGVD9F6YqhsglXJzE6etpbmT+f6EQElhiX/UTG551cnsRGvLG3fyZEg9HwaDmNmj5nwJ4z9g==}
engines: {node: '>=10'}
@@ -931,19 +1178,42 @@ packages:
resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==}
engines: {node: '>=0.10.0'}
+ resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==}
+ engines: {node: '>= 0.8'}
+
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
resolution: {integrity: sha512-SwzWD9gl/ElwYLCI0nUja1mFJzjq2D8ziShfNBa7zCHzkOozeOGDwHWQ+tvCzEZcewecWZ5U7kUopDnG+DFYEQ==}
+ resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}
+ engines: {node: '>= 0.8'}
+
resolution: {integrity: sha512-enSlaiat05iasnzmgNxRj8reFdj3puY2QpNgP1aPIaVfT6nn9ICuPoFlKHk8EN22HcwewshO+mN2DGbkCEOtqQ==}
engines: {node: '>=14.0.0'}
+ resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==}
+
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
+ resolution: {integrity: sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==}
+ engines: {node: '>=16.20.0'}
+
resolution: {integrity: sha512-9bW6zvX/m0lEbgTKJ6YppOKx8H3VOPBMOCFh2irXFOT4BbHgrx5hPjwJYLT40Lu+4qtD36qKc/Hn56StUW57IA==}
engines: {node: '>=18'}
@@ -967,9 +1237,17 @@ packages:
resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==}
+ resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==}
+ engines: {node: '>= 0.10'}
+
resolution: {integrity: sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==}
+ resolution: {integrity: sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==}
+ engines: {node: '>=0.6'}
+
resolution: {integrity: sha512-QFnPfjFey8EqknSrSxe1hZrf1/8z7/6s1QzGOmKo6++02r7QRRX7ZoyNaZh7JuVjWsVW87KnQrbZqnHkOAzUyg==}
@@ -977,6 +1255,14 @@ packages:
resolution: {integrity: sha512-So0Sqw869y/S2oE3Nuc0uT3Dhqgvsj8FSrwBdsuTosVsG8ME5/OcudU1GxsrIFdFABgy17GHnTVO9TYV/bLQcA==}
engines: {node: '>=16.0.0'}
+ resolution: {integrity: sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==}
+ engines: {node: '>= 0.6'}
+
+ resolution: {integrity: sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==}
+ engines: {node: '>= 0.10'}
+
resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==}
hasBin: true
@@ -1026,14 +1312,25 @@ packages:
resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}
engines: {node: '>= 6'}
+ resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}
+ engines: {node: '>=0.10.0'}
+
resolution: {integrity: sha512-pAQK9HalE84QSm4Po3EmWIZPd3FnjkShVkiMlz1iligWYkWQ7wHYd1PF/T7QZ5TVSD6uSTon5gBVMSM4JfBV+A==}
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true
+ resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==}
+ engines: {node: '>= 18'}
+
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
+ resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
+
resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==}
@@ -1050,6 +1347,41 @@ packages:
engines: {node: '>=10'}
hasBin: true
+ resolution: {integrity: sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==}
+ engines: {node: '>= 18'}
+
+ resolution: {integrity: sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==}
+ engines: {node: '>= 18'}
+
+ resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}
+
+ resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==}
+ engines: {node: '>= 0.4'}
+
resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==}
@@ -1070,6 +1402,10 @@ packages:
resolution: {integrity: sha512-gcj8zBWU5cFsi9WUP+4bFNXAyF1iRpA3LLyS/DP5xlrNzGmPIizUeBggKa8DbDwdqaKwUcTEnChtd2grWo/x/A==}
+ resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==}
+ engines: {node: '>= 0.8'}
+
resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==}
@@ -1091,6 +1427,10 @@ packages:
resolution: {integrity: sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==}
engines: {node: '>=6'}
+ resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==}
+ engines: {node: '>=0.6'}
+
resolution: {integrity: sha512-dRXchy+C0IgK8WPC6xvCHFRIWYUbqqdEIKPaKo/AcTUNzwLTK6AH7RjdLWsEZcAN/TBdtfUw3PYEgPr5VPr6ww==}
engines: {node: '>=14.16'}
@@ -1105,6 +1445,10 @@ packages:
resolution: {integrity: sha512-I8yFsfRzmzK0WV1pNNOA4A7y4RDfFxPRxb3t+e3ui14qSGOxGtiSP6GjeX+Y6CHb7HYaFj7ECUD7VE5kQMZWGQ==}
engines: {node: '>=18', npm: '>=9'}
+ resolution: {integrity: sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==}
+ engines: {node: '>= 18'}
+
resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
engines: {node: '>=14.17'}
@@ -1121,6 +1465,10 @@ packages:
resolution: {integrity: sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw==}
engines: {node: '>=20.18.1'}
+ resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==}
+ engines: {node: '>= 0.8'}
+
resolution: {integrity: sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==}
hasBin: true
@@ -1130,6 +1478,10 @@ packages:
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
+ resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==}
+ engines: {node: '>= 0.8'}
+
resolution: {integrity: sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==}
engines: {node: ^18.0.0 || >=20.0.0}
@@ -1167,6 +1519,11 @@ packages:
resolution: {integrity: sha512-HjYc14IQUwDcnGICuc8tVtqAd6EFpoAQMqgrqcNtWWZB+F1b7iTq44GzwM1qvnH4upFgbhJsaNHuK93NOFheSg==}
+ resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
+ engines: {node: '>= 8'}
+ hasBin: true
+
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
@@ -1182,6 +1539,14 @@ packages:
engines: {node: '>= 14.6'}
hasBin: true
+ resolution: {integrity: sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==}
+ peerDependencies:
+ zod: ^3.25.28 || ^4
+
+ resolution: {integrity: sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==}
+
snapshots:
@@ -1509,6 +1874,10 @@ snapshots:
dependencies:
tslib: 2.8.1
+ dependencies:
+ hono: 4.13.1
+
'@jitl/[email protected]': {}
@@ -1550,6 +1919,28 @@ snapshots:
'@mixmark-io/[email protected]': {}
+ '@modelcontextprotocol/[email protected]([email protected])':
+ dependencies:
+ '@hono/node-server': 1.19.17([email protected])
+ ajv: 8.20.0
+ ajv-formats: 3.0.1([email protected])
+ content-type: 1.0.5
+ cors: 2.8.6
+ cross-spawn: 7.0.6
+ eventsource: 3.0.7
+ eventsource-parser: 3.1.1
+ express: 5.2.1
+ express-rate-limit: 8.6.2([email protected])
+ hono: 4.13.1
+ jose: 6.2.8
+ json-schema-typed: 8.0.2
+ pkce-challenge: 5.0.1
+ raw-body: 3.0.2
+ zod: 4.4.3
+ zod-to-json-schema: 3.25.2([email protected])
+ transitivePeerDependencies:
+ - supports-color
+
'@mongodb-js/[email protected]':
dependencies:
node-addon-api: 8.9.1
@@ -1690,6 +2081,9 @@ snapshots:
'@types/prop-types': 15.7.15
csstype: 3.2.3
+ '@types/[email protected]':
+ optional: true
+
'@ubjs/[email protected]': {}
@@ -1704,8 +2098,24 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ dependencies:
+ mime-types: 3.0.2
+ negotiator: 1.0.0
+
+ optionalDependencies:
+ ajv: 8.20.0
+
+ dependencies:
+ fast-deep-equal: 3.1.3
+ fast-uri: 3.1.5
+ json-schema-traverse: 1.0.0
+ require-from-string: 2.0.2
+
dependencies:
entities: 2.2.0
@@ -1726,6 +2136,20 @@ snapshots:
readable-stream: 3.6.2
optional: true
+ dependencies:
+ bytes: 3.1.2
+ content-type: 2.0.0
+ debug: 4.4.3
+ http-errors: 2.0.1
+ iconv-lite: 0.7.3
+ on-finished: 2.4.1
+ qs: 6.15.3
+ raw-body: 3.0.2
+ type-is: 2.1.0
+ transitivePeerDependencies:
+ - supports-color
+
dependencies:
balanced-match: 4.0.4
@@ -1744,6 +2168,18 @@ snapshots:
ieee754: 1.2.1
optional: true
+
+ dependencies:
+ es-errors: 1.3.0
+ function-bind: 1.1.2
+
+ dependencies:
+ call-bind-apply-helpers: 1.0.2
+ get-intrinsic: 1.3.0
+
@@ -1753,8 +2189,29 @@ snapshots:
+
+
+
+
+
+ dependencies:
+ object-assign: 4.1.1
+ vary: 1.1.2
+
+ dependencies:
+ path-key: 3.1.1
+ shebang-command: 2.0.0
+ which: 2.0.2
+
dependencies:
cssesc: 3.0.0
@@ -1790,6 +2247,8 @@ snapshots:
optional: true
+
optional: true
@@ -1800,8 +2259,22 @@ snapshots:
'@babel/runtime': 7.29.2
csstype: 3.2.3
+ optionalDependencies:
+ '@types/trusted-types': 2.0.7
+
+ dependencies:
+ call-bind-apply-helpers: 1.0.2
+ es-errors: 1.3.0
+ gopd: 1.2.0
+
+
+
dependencies:
once: 1.4.0
@@ -1809,6 +2282,14 @@ snapshots:
+
+
+ dependencies:
+ es-errors: 1.3.0
+
optionalDependencies:
'@esbuild/aix-ppc64': 0.21.5
@@ -1837,9 +2318,64 @@ snapshots:
+
+
+
+ dependencies:
+ eventsource-parser: 3.1.1
+
optional: true
+ dependencies:
+ debug: 4.4.3
+ express: 5.2.1
+ ip-address: 10.5.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ accepts: 2.0.0
+ body-parser: 2.3.0
+ content-disposition: 1.1.0
+ content-type: 1.0.5
+ cookie: 0.7.2
+ cookie-signature: 1.2.2
+ debug: 4.4.3
+ depd: 2.0.0
+ encodeurl: 2.0.0
+ escape-html: 1.0.3
+ etag: 1.8.1
+ finalhandler: 2.1.1
+ fresh: 2.0.0
+ http-errors: 2.0.1
+ merge-descriptors: 2.0.0
+ mime-types: 3.0.2
+ on-finished: 2.4.1
+ once: 1.4.0
+ parseurl: 1.3.3
+ proxy-addr: 2.0.7
+ qs: 6.15.3
+ range-parser: 1.3.0
+ router: 2.2.0
+ send: 1.2.1
+ serve-static: 2.2.1
+ statuses: 2.0.2
+ type-is: 2.1.0
+ vary: 1.1.2
+ transitivePeerDependencies:
+ - supports-color
+
+
+
dependencies:
path-expression-matcher: 1.6.2
@@ -1865,6 +2401,21 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ dependencies:
+ debug: 4.4.3
+ encodeurl: 2.0.0
+ escape-html: 1.0.3
+ on-finished: 2.4.1
+ parseurl: 1.3.3
+ statuses: 2.0.2
+ transitivePeerDependencies:
+ - supports-color
+
+
+
optional: true
@@ -1874,15 +2425,56 @@ snapshots:
optional: true
+
+ dependencies:
+ call-bind-apply-helpers: 1.0.2
+ es-define-property: 1.0.1
+ es-errors: 1.3.0
+ es-object-atoms: 1.1.2
+ function-bind: 1.1.2
+ get-proto: 1.0.1
+ gopd: 1.2.0
+ has-symbols: 1.1.0
+ hasown: 2.0.4
+ math-intrinsics: 1.1.0
+
+ dependencies:
+ dunder-proto: 1.0.1
+ es-object-atoms: 1.1.2
+
optional: true
+
+
+ dependencies:
+ function-bind: 1.1.2
+
+
+ dependencies:
+ depd: 2.0.0
+ inherits: 2.0.4
+ setprototypeof: 1.2.0
+ statuses: 2.0.2
+ toidentifier: 1.0.1
+
+ dependencies:
+ safer-buffer: 2.1.2
+
- optional: true
optional: true
@@ -1896,14 +2488,28 @@ snapshots:
'@formatjs/icu-messageformat-parser': 2.11.4
tslib: 2.8.1
+
+
+
+
+
+
+
@@ -1945,6 +2551,20 @@ snapshots:
dependencies:
yallist: 3.1.1
+
+
+
+
+
+ dependencies:
+ mime-db: 1.54.0
+
optional: true
@@ -1971,6 +2591,8 @@ snapshots:
optional: true
+
dependencies:
semver: 7.8.5
@@ -1992,17 +2614,30 @@ snapshots:
+
+ dependencies:
+ ee-first: 1.1.1
+
dependencies:
wrappy: 1.0.2
- optional: true
+
+
+
+
@@ -2039,12 +2674,22 @@ snapshots:
object-assign: 4.1.1
react-is: 16.13.1
+ dependencies:
+ forwarded: 0.2.0
+ ipaddr.js: 1.9.1
+
dependencies:
end-of-stream: 1.4.5
once: 1.4.0
optional: true
+ dependencies:
+ es-define-property: 1.0.1
+ side-channel: 1.1.1
+
dependencies:
'@jitl/quickjs-ffi-types': 0.32.0
@@ -2057,6 +2702,15 @@ snapshots:
'@jitl/quickjs-wasmfile-release-sync': 0.32.0
quickjs-emscripten-core: 0.32.0
+
+ dependencies:
+ bytes: 3.1.2
+ http-errors: 2.0.1
+ iconv-lite: 0.7.3
+ unpipe: 1.0.0
+
dependencies:
deep-extend: 0.6.0
@@ -2111,6 +2765,8 @@ snapshots:
util-deprecate: 1.0.2
optional: true
+
dependencies:
'@types/estree': 1.0.8
@@ -2142,9 +2798,21 @@ snapshots:
'@rollup/rollup-win32-x64-msvc': 4.60.3
fsevents: 2.3.3
+ dependencies:
+ debug: 4.4.3
+ depd: 2.0.0
+ is-promise: 4.0.0
+ parseurl: 1.3.3
+ path-to-regexp: 8.4.2
+ transitivePeerDependencies:
+ - supports-color
+
optional: true
+
dependencies:
loose-envify: 1.4.0
@@ -2158,6 +2826,67 @@ snapshots:
optional: true
+ dependencies:
+ debug: 4.4.3
+ encodeurl: 2.0.0
+ escape-html: 1.0.3
+ etag: 1.8.1
+ fresh: 2.0.0
+ http-errors: 2.0.1
+ mime-types: 3.0.2
+ ms: 2.1.3
+ on-finished: 2.4.1
+ range-parser: 1.3.0
+ statuses: 2.0.2
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ encodeurl: 2.0.0
+ escape-html: 1.0.3
+ parseurl: 1.3.3
+ send: 1.2.1
+ transitivePeerDependencies:
+ - supports-color
+
+
+ dependencies:
+ shebang-regex: 3.0.0
+
+
+ dependencies:
+ es-errors: 1.3.0
+ object-inspect: 1.13.4
+
+ dependencies:
+ call-bound: 1.0.4
+ es-errors: 1.3.0
+ get-intrinsic: 1.3.0
+ object-inspect: 1.13.4
+
+ dependencies:
+ call-bound: 1.0.4
+ es-errors: 1.3.0
+ get-intrinsic: 1.3.0
+ object-inspect: 1.13.4
+ side-channel-map: 1.0.1
+
+ dependencies:
+ es-errors: 1.3.0
+ object-inspect: 1.13.4
+ side-channel-list: 1.0.1
+ side-channel-map: 1.0.1
+ side-channel-weakmap: 1.0.2
+
optional: true
@@ -2176,6 +2905,8 @@ snapshots:
+
dependencies:
safe-buffer: 5.2.1
@@ -2209,6 +2940,8 @@ snapshots:
readable-stream: 3.6.2
optional: true
+
dependencies:
'@borewit/text-codec': 0.2.2
@@ -2226,6 +2959,12 @@ snapshots:
dependencies:
'@mixmark-io/domino': 2.2.0
+ dependencies:
+ content-type: 2.0.0
+ media-typer: 1.1.1
+ mime-types: 3.0.2
+
@@ -2234,6 +2973,8 @@ snapshots:
+
dependencies:
browserslist: 4.28.2
@@ -2243,6 +2984,8 @@ snapshots:
optional: true
+
dependencies:
esbuild: 0.21.5
@@ -2256,11 +2999,20 @@ snapshots:
- optional: true
+ dependencies:
+ isexe: 2.0.0
+
+
+ dependencies:
+ zod: 4.4.3
+
diff --git a/libs/fleet/src/browser-agent.ts b/libs/fleet/src/browser-agent.ts
index a6b0b553a0..5aab75d1a1 100644
--- a/libs/fleet/src/browser-agent.ts
+++ b/libs/fleet/src/browser-agent.ts
@@ -1,4 +1,4 @@
-import { Bash } from "just-bash/browser"
+import { Bash, type Command } from "just-bash/browser"
export const BASH_TIMEOUT = { min: 250, default: 10_000, max: 60_000 } as const
export const BASH_OUTPUT = { min: 256, default: 20_000, max: 100_000 } as const
@@ -93,9 +93,11 @@ function capOutput(stdout: string, stderr: string, maxOutputChars: number): Pick
export class BrowserBashAgent {
private readonly shells = new Map<string, Bash>()
private readonly client: TurnClient
+ private readonly customCommands: Command[]
- constructor(client: TurnClient) {
+ constructor(client: TurnClient, customCommands: Command[] = []) {
this.client = client
+ this.customCommands = customCommands
}
async executeBash(conversationID: string, input: BashToolArguments, signal?: AbortSignal): Promise<BashToolResult> {
@@ -118,7 +120,7 @@ export class BrowserBashAgent {
timeoutController.signal.addEventListener("abort", abortLinked, { once: true })
try {
- const shell = this.getShell(conversationID)
+ const shell = await this.getShell(conversationID)
const result = await shell.exec(arguments_.command, { signal: linkedController.signal })
if (signal?.aborted) {
throw abortError()
@@ -194,10 +196,13 @@ export class BrowserBashAgent {
}
}
- private getShell(conversationID: string): Bash {
+ private async getShell(conversationID: string): Promise<Bash> {
let shell = this.shells.get(conversationID)
if (!shell) {
- shell = new Bash({ executionLimitProfile: "hardened" })
+ shell = new Bash({
+ customCommands: this.customCommands,
+ executionLimitProfile: "hardened",
+ })
this.shells.set(conversationID, shell)
}
return shell
diff --git a/libs/fleet/src/browser-mcp-commands.ts b/libs/fleet/src/browser-mcp-commands.ts
new file mode 100644
index 0000000000..389f3b9564
--- /dev/null
+++ b/libs/fleet/src/browser-mcp-commands.ts
@@ -0,0 +1,99 @@
+import { Client } from "@modelcontextprotocol/sdk/client/index.js"
+import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
+import { defineCommand, type Command } from "just-bash/browser"
+
+const CUA_DOCS_MCP_URL = "https://vk-mcp.cua.ai/mcp"
+
+export const BROWSER_MCP_COMMAND_NAMES = [
+ "query_docs_db",
+ "query_docs_vectors",
+ "query_code_db",
+ "query_code_vectors",
+] as const
+
+export type BrowserMcpCommandName = (typeof BROWSER_MCP_COMMAND_NAMES)[number]
+
+export interface McpToolResult {
+ content?: Array<{ type: string; text?: string; [key: string]: unknown }>
+ structuredContent?: Record<string, unknown>
+ isError?: boolean
+ [key: string]: unknown
+}
+
+export interface McpClient {
+ callTool(params: { name: BrowserMcpCommandName; arguments: Record<string, unknown> }): Promise<McpToolResult>
+}
+
+export type McpToolCaller = (name: BrowserMcpCommandName, arguments_: Record<string, unknown>) => Promise<McpToolResult>
+
+type McpConnector = () => Promise<McpClient>
+
+function decodeStdin(stdin: unknown): string {
+ const bytes = Uint8Array.from(stdin as string, character => character.charCodeAt(0))
+ return new TextDecoder().decode(bytes)
+}
+
+function parseArguments(args: string[], stdin: string): Record<string, unknown> {
+ if (args.length > 1) throw new Error("expected one JSON object argument")
+ const input = args[0] ?? stdin.trim()
+ if (!input) return {}
+
+ let parsed: unknown
+ try {
+ parsed = JSON.parse(input)
+ } catch {
+ throw new Error("arguments must be a JSON object")
+ }
+ if (parsed === null || Array.isArray(parsed) || typeof parsed !== "object") {
+ throw new Error("arguments must be a JSON object")
+ }
+ return parsed as Record<string, unknown>
+}
+
+function errorMessage(error: unknown): string {
+ return error instanceof Error && error.message ? error.message : "MCP command failed"
+}
+
+function toolErrorMessage(result: McpToolResult): string {
+ const text = result.content?.find(item => item.type === "text" && typeof item.text === "string")?.text
+ return text || "MCP tool failed"
+}
+
+async function connectCuaDocsMcp(): Promise<McpClient> {
+ const client = new Client({ name: "cyclops-cs", version: "0.0.1" })
+ const transport = new StreamableHTTPClientTransport(new URL(CUA_DOCS_MCP_URL), {
+ requestInit: { credentials: "include" },
+ })
+ await client.connect(transport)
+ return client
+}
+
+export function createBrowserMcpToolCaller(connect: McpConnector = connectCuaDocsMcp): McpToolCaller {
+ let clientPromise: Promise<McpClient> | undefined
+
+ return async (name, arguments_) => {
+ if (!clientPromise) {
+ clientPromise = connect().catch(error => {
+ clientPromise = undefined
+ throw error
+ })
+ }
+ const client = await clientPromise
+ return client.callTool({ name, arguments: arguments_ })
+ }
+}
+
+export function createBrowserMcpCommands(callTool: McpToolCaller = createBrowserMcpToolCaller()): Command[] {
+ return BROWSER_MCP_COMMAND_NAMES.map(name =>
+ defineCommand(name, async (args, context) => {
+ try {
+ const arguments_ = parseArguments(args, decodeStdin(context.stdin))
+ const result = await callTool(name, arguments_)
+ if (result.isError) throw new Error(toolErrorMessage(result))
+ return { stdout: `${JSON.stringify(result)}\n`, stderr: "", exitCode: 0 }
+ } catch (error) {
+ return { stdout: "", stderr: `${errorMessage(error)}\n`, exitCode: 1 }
+ }
+ }),
+ )
+}
diff --git a/libs/fleet/src/browser-sdk-commands.ts b/libs/fleet/src/browser-sdk-commands.ts
new file mode 100644
index 0000000000..f14d4d1090
--- /dev/null
+++ b/libs/fleet/src/browser-sdk-commands.ts
@@ -0,0 +1,78 @@
+import { defineCommand, type Command } from "just-bash/browser"
+
+export type BrowserSdkMethod = (...args: never[]) => Promise<unknown>
+
+export interface BrowserSdk {
+ listNamespaces: BrowserSdkMethod
+ listPools: BrowserSdkMethod
+ getPool: BrowserSdkMethod
+ createPool: BrowserSdkMethod
+ updatePoolServices: BrowserSdkMethod
+ deletePool: BrowserSdkMethod
+ listClaims: BrowserSdkMethod
+ createClaim: BrowserSdkMethod
+ getClaim: BrowserSdkMethod
+ deleteClaim: BrowserSdkMethod
+ listUserKeys: BrowserSdkMethod
+ createUserKey: BrowserSdkMethod
+ deleteUserKey: BrowserSdkMethod
+}
+
+export const BROWSER_SDK_COMMAND_NAMES = [
+ "listNamespaces",
+ "listPools",
+ "getPool",
+ "createPool",
+ "updatePoolServices",
+ "deletePool",
+ "listClaims",
+ "createClaim",
+ "getClaim",
+ "deleteClaim",
+ "listUserKeys",
+ "createUserKey",
+ "deleteUserKey",
+] as const satisfies readonly (keyof BrowserSdk)[]
+
+function decodeStdin(stdin: unknown): string {
+ const bytes = Uint8Array.from(stdin as string, character => character.charCodeAt(0))
+ return new TextDecoder().decode(bytes)
+}
+
+function parseArguments(args: string[], stdin: string): unknown[] {
+ if (args.length > 1) throw new Error("expected one JSON array argument")
+ const input = args[0] ?? stdin.trim()
+ if (!input) return []
+
+ let parsed: unknown
+ try {
+ parsed = JSON.parse(input)
+ } catch {
+ throw new Error("arguments must be a JSON array")
+ }
+ if (!Array.isArray(parsed)) throw new Error("arguments must be a JSON array")
+ return parsed
+}
+
+function errorMessage(error: unknown): string {
+ return error instanceof Error && error.message ? error.message : "SDK command failed"
+}
+
+export function createBrowserSdkCommands(sdk: BrowserSdk): Command[] {
+ return BROWSER_SDK_COMMAND_NAMES.map(name =>
+ defineCommand(name, async (args, context) => {
+ try {
+ const methodArguments = parseArguments(args, decodeStdin(context.stdin))
+ const method = sdk[name] as (...args: unknown[]) => Promise<unknown>
+ const result = await method(...methodArguments)
+ return {
+ stdout: result === undefined ? "" : `${JSON.stringify(result)}\n`,
+ stderr: "",
+ exitCode: 0,
+ }
+ } catch (error) {
+ return { stdout: "", stderr: `${errorMessage(error)}\n`, exitCode: 1 }
+ }
+ }),
+ )
+}
diff --git a/libs/fleet/src/components/MarkdownMessage.tsx b/libs/fleet/src/components/MarkdownMessage.tsx
new file mode 100644
index 0000000000..ed35ad2f7b
--- /dev/null
+++ b/libs/fleet/src/components/MarkdownMessage.tsx
@@ -0,0 +1,22 @@
+import DOMPurify, { type Config } from "dompurify"
+import { marked } from "marked"
+import { useMemo } from "react"
+
+const SANITIZE_OPTIONS = {
+ ALLOW_DATA_ATTR: false,
+ FORBID_ATTR: ["id", "name", "style"],
+ FORBID_TAGS: ["audio", "embed", "form", "iframe", "img", "input", "object", "picture", "source", "style", "svg", "video"],
+ SANITIZE_NAMED_PROPS: true,
+ USE_PROFILES: { html: true },
+} satisfies Config
+
+export function MarkdownMessage({ content }: { content: string }) {
+ const html = useMemo(() => {
+ const parsed = marked.parse(content, { async: false, breaks: true, gfm: true })
+ return DOMPurify.sanitize(parsed, SANITIZE_OPTIONS)
+ }, [content])
+
+ // DOMPurify is the security boundary for this intentional HTML sink.
+ // biome-ignore lint/security/noDangerouslySetInnerHtml: marked output is sanitized immediately before rendering.
+ return <div className="agent-chat-markdown" dangerouslySetInnerHTML={{ __html: html }} />
+}
diff --git a/libs/fleet/src/pages/AgentChat.css b/libs/fleet/src/pages/AgentChat.css
index 422a938118..18cd9be61e 100644
--- a/libs/fleet/src/pages/AgentChat.css
+++ b/libs/fleet/src/pages/AgentChat.css
@@ -21,6 +21,7 @@
}
.agent-chat-transcript {
+ contain: layout paint;
min-height: 0;
overflow-y: auto;
padding: 8px 8px 128px;
@@ -34,15 +35,33 @@
text-align: center;
}
+.agent-chat-announcements {
+ block-size: 1px;
+ clip: rect(0 0 0 0);
+ clip-path: inset(50%);
+ inline-size: 1px;
+ overflow: hidden;
+ position: absolute;
+ white-space: nowrap;
+}
+
.agent-chat-composer {
- background: var(--color-background-layout-main, #fff);
- border-top: 1px solid var(--color-border-divider-default, #d5dbdb);
+ background: linear-gradient(180deg, transparent, var(--color-background-layout-main, #0f1b2a) 28%);
bottom: 0;
- padding: 16px 0 8px;
+ padding: 24px 8px 12px;
position: sticky;
z-index: 1;
}
+.agent-chat-composer-surface {
+ align-items: flex-end;
+ display: flex;
+ gap: 8px;
+ margin: 0 auto;
+ max-width: 960px;
+ width: 100%;
+}
+
.agent-chat-timestamp {
color: var(--color-text-body-secondary, #5f6b7a);
font-size: 0.75rem;
@@ -115,6 +134,10 @@
.agent-chat-skeleton--message {
max-width: 90%;
}
+
+ .agent-chat-composer {
+ padding-inline: 0;
+ }
}
.agent-chat-mobile-overlay {
@@ -158,6 +181,98 @@
}
.agent-chat-prompt {
- flex: 1;
+ flex: 1 1 auto;
min-width: 0;
+ width: 100%;
+}
+
+.agent-chat-markdown {
+ line-height: 1.5;
+ max-width: 100%;
+ overflow-x: auto;
+ overflow-wrap: anywhere;
+}
+
+.agent-chat-markdown > :first-child {
+ margin-block-start: 0;
+}
+
+.agent-chat-markdown > :last-child {
+ margin-block-end: 0;
+}
+
+.agent-chat-markdown p,
+.agent-chat-markdown blockquote,
+.agent-chat-markdown pre,
+.agent-chat-markdown table,
+.agent-chat-markdown ul,
+.agent-chat-markdown ol {
+ margin-block: 0.5rem;
+}
+
+.agent-chat-markdown h1,
+.agent-chat-markdown h2,
+.agent-chat-markdown h3,
+.agent-chat-markdown h4,
+.agent-chat-markdown h5,
+.agent-chat-markdown h6 {
+ line-height: 1.25;
+ margin-block: 0.75rem 0.35rem;
+}
+
+.agent-chat-markdown ul,
+.agent-chat-markdown ol {
+ padding-inline-start: 1.5rem;
+}
+
+.agent-chat-markdown blockquote {
+ border-inline-start: 3px solid var(--color-border-divider-default, #5f6b7a);
+ color: var(--color-text-body-secondary, #8d99a8);
+ padding-inline-start: 0.75rem;
+}
+
+.agent-chat-markdown table {
+ border-collapse: collapse;
+ min-width: 100%;
+}
+
+.agent-chat-markdown th,
+.agent-chat-markdown td {
+ border: 1px solid var(--color-border-divider-default, #5f6b7a);
+ padding: 0.4rem 0.6rem;
+ text-align: start;
+ vertical-align: top;
+}
+
+.agent-chat-markdown th {
+ background: var(--color-background-container-header, rgb(255 255 255 / 6%));
+ font-weight: 700;
+}
+
+.agent-chat-markdown code {
+ background: var(--color-background-layout-toggle-default, rgb(255 255 255 / 8%));
+ border-radius: 4px;
+ font-family: "Fira Code", "Cascadia Code", monospace;
+ font-size: 0.875em;
+ padding: 0.12em 0.3em;
+}
+
+.agent-chat-markdown pre {
+ background: var(--color-background-layout-main, #0f1b2a);
+ border: 1px solid var(--color-border-divider-default, #5f6b7a);
+ border-radius: 8px;
+ max-width: 100%;
+ overflow-x: auto;
+ padding: 0.75rem;
+}
+
+.agent-chat-markdown pre code {
+ background: transparent;
+ padding: 0;
+}
+
+.agent-chat-markdown a {
+ color: var(--color-text-link-default, #539fe5);
+ text-decoration: underline;
+ text-underline-offset: 0.15em;
}
diff --git a/libs/fleet/src/pages/AgentChat.tsx b/libs/fleet/src/pages/AgentChat.tsx
index 39d1edefab..10e2812076 100644
--- a/libs/fleet/src/pages/AgentChat.tsx
+++ b/libs/fleet/src/pages/AgentChat.tsx
@@ -13,6 +13,10 @@ import LiveRegion from "@cloudscape-design/components/live-region"
import PromptInput from "@cloudscape-design/components/prompt-input"
import SpaceBetween from "@cloudscape-design/components/space-between"
import StatusIndicator from "@cloudscape-design/components/status-indicator"
+import { MarkdownMessage } from "../components/MarkdownMessage"
+import { createClaim, deleteClaim, getClaim, listClaims } from "../sdk/claims"
+import { createPool, deletePool, getPool, listNamespaces, listPools, updatePoolServices } from "../sdk/pools"
+import { createUserKey, deleteUserKey, listUserKeys } from "../sdk/userKeys"
import {
createConversation,
getConversation,
@@ -30,6 +34,8 @@ import {
type NormalizedBashArguments,
type ToolCall,
} from "../browser-agent"
+import { createBrowserMcpCommands } from "../browser-mcp-commands"
+import { createBrowserSdkCommands, type BrowserSdk } from "../browser-sdk-commands"
import "./AgentChat.css"
export interface ConversationGroup {
@@ -74,6 +80,21 @@ export function groupConversations(now: Date, summaries: ConversationSummary[]):
const MOBILE_HISTORY_QUERY = "(max-width: 700px)"
const GENERATION_LOADING_DELAY_MS = 300
+const browserSdk: BrowserSdk = {
+ listNamespaces,
+ listPools,
+ getPool,
+ createPool,
+ updatePoolServices,
+ deletePool,
+ listClaims,
+ createClaim,
+ getClaim,
+ deleteClaim,
+ listUserKeys,
+ createUserKey,
+ deleteUserKey,
+}
function useMobileHistory(): boolean {
const [mobile, setMobile] = useState(() => window.matchMedia(MOBILE_HISTORY_QUERY).matches)
@@ -187,7 +208,7 @@ function MessageBubble({ message, position, loading = false }: { message: ChatMe
return (
<ChatBubble ariaLabel={`${author} at ${time.full}, message ${position}`} avatar={incoming ? <Avatar ariaLabel="Assistant avatar" color="gen-ai" iconName="gen-ai" loading={loading} /> : <Avatar ariaLabel="Your avatar" initials="You" />} type={incoming ? "incoming" : "outgoing"}>
<SpaceBetween size="xxs">
- <div>{loading && !message.content ? "Generating a response" : message.content}</div>
+ {loading && !message.content ? <div>Generating a response</div> : <MarkdownMessage content={message.content} />}
{!loading && <span className="agent-chat-timestamp" title={time.full}>{author} - {time.local}</span>}
</SpaceBetween>
</ChatBubble>
@@ -260,7 +281,7 @@ export function AgentChat() {
content: message.content,
tool_calls: (message.tool_calls ?? []).filter((toolCall): toolCall is ToolCall => toolCall.type === "function"),
}
- })
+ }, [...createBrowserSdkCommands(browserSdk), ...createBrowserMcpCommands()])
}
const ownsRun = (runId: number, conversationID: string) =>
@@ -537,14 +558,16 @@ export function AgentChat() {
) : <div className="agent-chat-empty"><Box variant="h2">Select a conversation</Box><Box color="text-body-secondary">Choose a previous conversation to view its transcript.</Box></div>}
{turnError && <div role="alert"><Alert action={<Button onClick={initialCreatePrompt ? retryInitialCreate : retryTurn}>Retry</Button>} type="error">{turnError}</Alert></div>}
{refreshError && <div role="alert"><Alert action={<Button disabled={running} onClick={() => { if (selectedId) void recoverRefresh(selectedId) }}>Refresh conversation</Button>} type="error">{refreshError}</Alert></div>}
- <LiveRegion hidden>{conversationLoading ? "Loading conversation" : selectedConversation ? "Conversation loaded" : "No conversation selected"}</LiveRegion>
- <LiveRegion>{latestAnnouncement}</LiveRegion>
+ <div className="agent-chat-announcements">
+ <LiveRegion>{conversationLoading ? "Loading conversation" : selectedConversation ? "Conversation loaded" : "No conversation selected"}</LiveRegion>
+ <LiveRegion>{latestAnnouncement}</LiveRegion>
+ </div>
</section>
<div className="agent-chat-composer">
- <SpaceBetween direction="horizontal" size="xs">
- <div className="agent-chat-prompt"><PromptInput actionButtonAriaLabel="Send message" actionButtonIconName="send" disableActionButton={running || !draft.trim()} onAction={() => void submit()} onChange={({ detail }) => setDraft(detail.value)} placeholder="Ask a question" value={draft} /></div>
+ <div className="agent-chat-composer-surface">
+ <div className="agent-chat-prompt"><PromptInput actionButtonAriaLabel="Send message" actionButtonIconName="send" disableActionButton={running || !draft.trim()} maxRows={6} minRows={2} onAction={() => void submit()} onChange={({ detail }) => setDraft(detail.value)} placeholder="Ask a question" value={draft} /></div>
{abortable && <Button ariaLabel="Stop generating" onClick={stop}>Stop</Button>}
- </SpaceBetween>
+ </div>
</div>
</div>
{mobileHistory && historyOpen && createPortal(