flowent 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/backend/README.md +74 -0
- package/backend/pyproject.toml +2 -1
- package/backend/src/flowent/__pycache__/__init__.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/_version.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/access.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/agent.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/assistant_commands.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/cli.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/config.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/events.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/graph_runtime.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/graph_service.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/image_assets.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/logging.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/main.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/mcp_service.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/model_metadata.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/network.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/{stats_service.cpython-313.pyc → observability_service.cpython-313.pyc} +0 -0
- package/backend/src/flowent/__pycache__/registry.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/role_management.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/runtime.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/sandbox.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/security.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/settings.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/settings_management.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/state_db.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/workspace_store.cpython-313.pyc +0 -0
- package/backend/src/flowent/agent.py +364 -52
- package/backend/src/flowent/assistant_commands.py +31 -22
- package/backend/src/flowent/channels/__pycache__/__init__.cpython-313.pyc +0 -0
- package/backend/src/flowent/channels/__pycache__/telegram.cpython-313.pyc +0 -0
- package/backend/src/flowent/channels/telegram.py +4 -4
- package/backend/src/flowent/graph_service.py +1307 -145
- package/backend/src/flowent/mcp_service.py +21 -7
- package/backend/src/flowent/model_metadata.py +4 -0
- package/backend/src/flowent/models/__init__.py +6 -2
- package/backend/src/flowent/models/__pycache__/__init__.cpython-313.pyc +0 -0
- package/backend/src/flowent/models/__pycache__/agent.cpython-313.pyc +0 -0
- package/backend/src/flowent/models/__pycache__/base.cpython-313.pyc +0 -0
- package/backend/src/flowent/models/__pycache__/blueprint.cpython-313.pyc +0 -0
- package/backend/src/flowent/models/__pycache__/content.cpython-313.pyc +0 -0
- package/backend/src/flowent/models/__pycache__/delta.cpython-313.pyc +0 -0
- package/backend/src/flowent/models/__pycache__/event.cpython-313.pyc +0 -0
- package/backend/src/flowent/models/__pycache__/graph.cpython-313.pyc +0 -0
- package/backend/src/flowent/models/__pycache__/history.cpython-313.pyc +0 -0
- package/backend/src/flowent/models/__pycache__/llm.cpython-313.pyc +0 -0
- package/backend/src/flowent/models/__pycache__/message.cpython-313.pyc +0 -0
- package/backend/src/flowent/models/__pycache__/tab.cpython-313.pyc +0 -0
- package/backend/src/flowent/models/__pycache__/todo.cpython-313.pyc +0 -0
- package/backend/src/flowent/models/agent.py +1 -0
- package/backend/src/flowent/models/graph.py +44 -9
- package/backend/src/flowent/models/history.py +73 -15
- package/backend/src/flowent/models/llm.py +1 -0
- package/backend/src/flowent/models/message.py +6 -0
- package/backend/src/flowent/models/tab.py +38 -1
- package/backend/src/flowent/{stats_service.py → observability_service.py} +4 -4
- package/backend/src/flowent/prompts/__pycache__/__init__.cpython-313.pyc +0 -0
- package/backend/src/flowent/prompts/__pycache__/common.cpython-313.pyc +0 -0
- package/backend/src/flowent/prompts/__pycache__/steward.cpython-313.pyc +0 -0
- package/backend/src/flowent/prompts/common.py +2 -2
- package/backend/src/flowent/prompts/steward.py +2 -2
- package/backend/src/flowent/providers/__pycache__/__init__.cpython-313.pyc +0 -0
- package/backend/src/flowent/providers/__pycache__/anthropic.cpython-313.pyc +0 -0
- package/backend/src/flowent/providers/__pycache__/base_url.cpython-313.pyc +0 -0
- package/backend/src/flowent/providers/__pycache__/configuration.cpython-313.pyc +0 -0
- package/backend/src/flowent/providers/__pycache__/content.cpython-313.pyc +0 -0
- package/backend/src/flowent/providers/__pycache__/errors.cpython-313.pyc +0 -0
- package/backend/src/flowent/providers/__pycache__/gateway.cpython-313.pyc +0 -0
- package/backend/src/flowent/providers/__pycache__/headers.cpython-313.pyc +0 -0
- package/backend/src/flowent/providers/__pycache__/management.cpython-313.pyc +0 -0
- package/backend/src/flowent/providers/__pycache__/openai.cpython-313.pyc +0 -0
- package/backend/src/flowent/providers/__pycache__/openai_responses.cpython-313.pyc +0 -0
- package/backend/src/flowent/providers/__pycache__/registry.cpython-313.pyc +0 -0
- package/backend/src/flowent/providers/__pycache__/sse.cpython-313.pyc +0 -0
- package/backend/src/flowent/providers/__pycache__/thinking.cpython-313.pyc +0 -0
- package/backend/src/flowent/providers/configuration.py +7 -0
- package/backend/src/flowent/role_management.py +12 -0
- package/backend/src/flowent/routes/__init__.py +0 -2
- package/backend/src/flowent/routes/__pycache__/__init__.cpython-313.pyc +0 -0
- package/backend/src/flowent/routes/__pycache__/access.cpython-313.pyc +0 -0
- package/backend/src/flowent/routes/__pycache__/assistant.cpython-313.pyc +0 -0
- package/backend/src/flowent/routes/__pycache__/image_assets.cpython-313.pyc +0 -0
- package/backend/src/flowent/routes/__pycache__/mcp.cpython-313.pyc +0 -0
- package/backend/src/flowent/routes/__pycache__/meta.cpython-313.pyc +0 -0
- package/backend/src/flowent/routes/__pycache__/nodes.cpython-313.pyc +0 -0
- package/backend/src/flowent/routes/__pycache__/prompts.cpython-313.pyc +0 -0
- package/backend/src/flowent/routes/__pycache__/providers_route.cpython-313.pyc +0 -0
- package/backend/src/flowent/routes/__pycache__/roles.cpython-313.pyc +0 -0
- package/backend/src/flowent/routes/__pycache__/settings.cpython-313.pyc +0 -0
- package/backend/src/flowent/routes/__pycache__/tabs.cpython-313.pyc +0 -0
- package/backend/src/flowent/routes/__pycache__/ws.cpython-313.pyc +0 -0
- package/backend/src/flowent/routes/assistant.py +4 -4
- package/backend/src/flowent/routes/nodes.py +54 -6
- package/backend/src/flowent/routes/providers_route.py +1 -0
- package/backend/src/flowent/routes/roles.py +1 -1
- package/backend/src/flowent/routes/settings.py +4 -0
- package/backend/src/flowent/routes/tabs.py +29 -11
- package/backend/src/flowent/runtime.py +7 -30
- package/backend/src/flowent/security.py +23 -8
- package/backend/src/flowent/settings.py +56 -5
- package/backend/src/flowent/settings_management.py +12 -0
- package/backend/src/flowent/static/assets/AssistantPage-VBohhz4d.js +1 -0
- package/backend/src/flowent/static/assets/ChannelsPage-CIydPZA_.js +1 -0
- package/backend/src/flowent/static/assets/McpPage-CHPm2TPY.js +7 -0
- package/backend/src/flowent/static/assets/PageScaffold-DteOA8V7.js +1 -0
- package/backend/src/flowent/static/assets/PromptsPage-CSmJ3sZg.js +1 -0
- package/backend/src/flowent/static/assets/ProvidersPage-sl2jeG4e.js +3 -0
- package/backend/src/flowent/static/assets/RolesPage-DCe7W6Km.js +1 -0
- package/backend/src/flowent/static/assets/SettingsPage-Bix9e63E.js +3 -0
- package/backend/src/flowent/static/assets/ToolsPage-favNkj5C.js +1 -0
- package/backend/src/flowent/static/assets/WorkspaceCommandDialog-DRS6wiD6.js +1 -0
- package/backend/src/flowent/static/assets/WorkspacePage-KuaDjt_D.js +3 -0
- package/backend/src/flowent/static/assets/WorkspacePanels-BZxBw8M5.js +1 -0
- package/backend/src/flowent/static/assets/alert-dialog-DIBUCmqM.js +1 -0
- package/backend/src/flowent/static/assets/{dialog-BeGSweF6.js → dialog-BOvHIBrg.js} +1 -1
- package/backend/src/flowent/static/assets/index-Biio-CoI.js +10 -0
- package/backend/src/flowent/static/assets/index-CmQvO7sl.css +1 -0
- package/backend/src/flowent/static/assets/modelParams-DcEhGnu0.js +1 -0
- package/backend/src/flowent/static/assets/roles-BbIEIMeG.js +1 -0
- package/backend/src/flowent/static/assets/select-D9SwnlXF.js +1 -0
- package/backend/src/flowent/static/assets/surface-Bzr1FRG4.js +1 -0
- package/backend/src/flowent/static/assets/{ui-vendor-Dg9NNnWX.js → ui-vendor-UazN8rcv.js} +15 -15
- package/backend/src/flowent/static/index.html +3 -4
- package/backend/src/flowent/tools/__init__.py +76 -2
- package/backend/src/flowent/tools/__pycache__/__init__.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/connect.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/contacts.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/create_agent.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/create_tab.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/delete_tab.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/edit.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/exec.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/fetch.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/idle.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/list_roles.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/list_tabs.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/list_tools.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/manage_prompts.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/manage_providers.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/manage_roles.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/manage_settings.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/mcp.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/read.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/send.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/set_permissions.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/sleep.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/__pycache__/todo.cpython-313.pyc +0 -0
- package/backend/src/flowent/tools/connect.py +10 -66
- package/backend/src/flowent/tools/contacts.py +1 -1
- package/backend/src/flowent/tools/create_agent.py +9 -88
- package/backend/src/flowent/tools/create_tab.py +7 -5
- package/backend/src/flowent/tools/exec.py +3 -2
- package/backend/src/flowent/tools/list_roles.py +29 -4
- package/backend/src/flowent/tools/list_tabs.py +4 -0
- package/backend/src/flowent/tools/list_tools.py +5 -1
- package/backend/src/flowent/tools/manage_settings.py +18 -0
- package/backend/src/flowent/tools/send.py +21 -3
- package/backend/src/flowent/tools/set_permissions.py +21 -6
- package/backend/tests/__pycache__/__init__.cpython-313.pyc +0 -0
- package/backend/tests/__pycache__/conftest.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/integration/api/__pycache__/conftest.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/integration/api/__pycache__/test_access_api.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/integration/api/__pycache__/test_assistant_api.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/integration/api/__pycache__/test_frontend_mounting.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/integration/api/__pycache__/test_mcp_api.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/integration/api/__pycache__/test_meta_api.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/integration/api/__pycache__/test_nodes_api.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/integration/api/__pycache__/test_prompts_api.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/integration/api/__pycache__/test_roles_api.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/integration/api/__pycache__/test_tabs_api.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/integration/api/test_assistant_api.py +1 -1
- package/backend/tests/integration/api/test_nodes_api.py +257 -21
- package/backend/tests/integration/api/test_roles_api.py +3 -2
- package/backend/tests/integration/api/test_tabs_api.py +312 -11
- package/backend/tests/unit/__pycache__/test_access.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/__pycache__/test_cli.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/__pycache__/test_graph_runtime.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/__pycache__/test_network.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/__pycache__/test_state_sqlite_storage.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/__pycache__/test_workspace_store.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/agent/__pycache__/test_agent_public_api.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/agent/__pycache__/test_agent_runtime.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/agent/test_agent_public_api.py +162 -71
- package/backend/tests/unit/agent/test_agent_runtime.py +285 -69
- package/backend/tests/unit/channels/__pycache__/test_telegram_channel.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/logging/__pycache__/test_logging.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/prompts/__pycache__/test_prompts.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/prompts/test_prompts.py +3 -2
- package/backend/tests/unit/providers/__pycache__/test_anthropic_provider.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/providers/__pycache__/test_errors.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/providers/__pycache__/test_extract_delta_parts.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/providers/__pycache__/test_openai_provider.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/providers/__pycache__/test_openai_responses.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/providers/__pycache__/test_provider_gateway.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/providers/__pycache__/test_think_tag_parser.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/routes/__pycache__/test_prompts_routes.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/routes/__pycache__/test_providers_route.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/routes/__pycache__/test_roles_routes.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/routes/__pycache__/test_settings_routes.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/routes/test_providers_route.py +2 -0
- package/backend/tests/unit/routes/test_roles_routes.py +109 -0
- package/backend/tests/unit/routes/test_settings_routes.py +4 -0
- package/backend/tests/unit/runtime/__pycache__/test_bootstrap_runtime.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/runtime/test_bootstrap_runtime.py +8 -18
- package/backend/tests/unit/sandbox/__pycache__/test_sandbox_tools.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/security/__pycache__/test_security.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/security/test_security.py +16 -2
- package/backend/tests/unit/settings/__pycache__/test_settings_roles.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/settings/test_settings_roles.py +40 -0
- package/backend/tests/unit/test_state_sqlite_storage.py +67 -1
- package/backend/tests/unit/tools/__pycache__/test_connect_tool.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/tools/__pycache__/test_create_agent_tool.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/tools/__pycache__/test_delete_tab_tool.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/tools/__pycache__/test_edit_tool.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/tools/__pycache__/test_exec_tool.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/tools/__pycache__/test_fetch_tool.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/tools/__pycache__/test_manage_prompts_tool.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/tools/__pycache__/test_manage_providers_tool.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/tools/__pycache__/test_manage_roles_tool.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/tools/__pycache__/test_manage_settings_tool.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/tools/__pycache__/test_read_tool.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/tools/__pycache__/test_set_permissions_tool.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/tools/__pycache__/test_todo_tool.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/tools/__pycache__/test_tool_registry.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/tools/test_connect_tool.py +2 -3
- package/backend/tests/unit/tools/test_create_agent_tool.py +9 -97
- package/backend/tests/unit/tools/test_delete_tab_tool.py +33 -0
- package/backend/tests/unit/tools/test_manage_providers_tool.py +2 -0
- package/backend/tests/unit/tools/test_manage_settings_tool.py +3 -0
- package/backend/tests/unit/tools/test_set_permissions_tool.py +216 -12
- package/backend/tests/unit/tools/test_tool_registry.py +103 -0
- package/backend/uv.lock +1 -1
- package/dist/frontend/assets/AssistantPage-VBohhz4d.js +1 -0
- package/dist/frontend/assets/ChannelsPage-CIydPZA_.js +1 -0
- package/dist/frontend/assets/McpPage-CHPm2TPY.js +7 -0
- package/dist/frontend/assets/PageScaffold-DteOA8V7.js +1 -0
- package/dist/frontend/assets/PromptsPage-CSmJ3sZg.js +1 -0
- package/dist/frontend/assets/ProvidersPage-sl2jeG4e.js +3 -0
- package/dist/frontend/assets/RolesPage-DCe7W6Km.js +1 -0
- package/dist/frontend/assets/SettingsPage-Bix9e63E.js +3 -0
- package/dist/frontend/assets/ToolsPage-favNkj5C.js +1 -0
- package/dist/frontend/assets/WorkspaceCommandDialog-DRS6wiD6.js +1 -0
- package/dist/frontend/assets/WorkspacePage-KuaDjt_D.js +3 -0
- package/dist/frontend/assets/WorkspacePanels-BZxBw8M5.js +1 -0
- package/dist/frontend/assets/alert-dialog-DIBUCmqM.js +1 -0
- package/dist/frontend/assets/{dialog-BeGSweF6.js → dialog-BOvHIBrg.js} +1 -1
- package/dist/frontend/assets/index-Biio-CoI.js +10 -0
- package/dist/frontend/assets/index-CmQvO7sl.css +1 -0
- package/dist/frontend/assets/modelParams-DcEhGnu0.js +1 -0
- package/dist/frontend/assets/roles-BbIEIMeG.js +1 -0
- package/dist/frontend/assets/select-D9SwnlXF.js +1 -0
- package/dist/frontend/assets/surface-Bzr1FRG4.js +1 -0
- package/dist/frontend/assets/{ui-vendor-Dg9NNnWX.js → ui-vendor-UazN8rcv.js} +15 -15
- package/dist/frontend/index.html +3 -4
- package/package.json +3 -3
- package/backend/src/flowent/routes/__pycache__/stats.cpython-313.pyc +0 -0
- package/backend/src/flowent/routes/stats.py +0 -229
- package/backend/src/flowent/static/assets/AssistantPage-B3Xc08AS.js +0 -1
- package/backend/src/flowent/static/assets/ChannelsPage-ByLd28xk.js +0 -1
- package/backend/src/flowent/static/assets/HomePage-C0hAx9_l.js +0 -3
- package/backend/src/flowent/static/assets/McpPage-DkrYLvBv.js +0 -7
- package/backend/src/flowent/static/assets/PageScaffold-D4jO9ooX.js +0 -1
- package/backend/src/flowent/static/assets/PromptsPage-DWA7rRJd.js +0 -1
- package/backend/src/flowent/static/assets/ProvidersPage-PUWT8seJ.js +0 -3
- package/backend/src/flowent/static/assets/RolesPage-CqcclGRw.js +0 -1
- package/backend/src/flowent/static/assets/SettingsPage-8tS2cJgX.js +0 -3
- package/backend/src/flowent/static/assets/StatsPage-BX9khYzu.js +0 -1
- package/backend/src/flowent/static/assets/ToolsPage-9Tl9FdeD.js +0 -1
- package/backend/src/flowent/static/assets/WorkspaceCommandDialog-CCXxjDL8.js +0 -1
- package/backend/src/flowent/static/assets/WorkspacePanels-aMdJ7ZH7.js +0 -1
- package/backend/src/flowent/static/assets/alert-dialog-kFYVQ7oX.js +0 -1
- package/backend/src/flowent/static/assets/badge-74-3jsCg.js +0 -1
- package/backend/src/flowent/static/assets/constants-XUzFf6i1.js +0 -1
- package/backend/src/flowent/static/assets/index-BHC1Vhy8.css +0 -1
- package/backend/src/flowent/static/assets/index-CL1ALZ3r.js +0 -10
- package/backend/src/flowent/static/assets/modelParams-CaHd0903.js +0 -1
- package/backend/src/flowent/static/assets/roles-2OLDeTc5.js +0 -1
- package/backend/src/flowent/static/assets/select-DL_LPeDj.js +0 -1
- package/backend/src/flowent/static/assets/shared-CMxbpLeQ.js +0 -1
- package/backend/tests/unit/routes/__pycache__/test_stats_routes.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/routes/test_stats_routes.py +0 -149
- package/dist/frontend/assets/AssistantPage-B3Xc08AS.js +0 -1
- package/dist/frontend/assets/ChannelsPage-ByLd28xk.js +0 -1
- package/dist/frontend/assets/HomePage-C0hAx9_l.js +0 -3
- package/dist/frontend/assets/McpPage-DkrYLvBv.js +0 -7
- package/dist/frontend/assets/PageScaffold-D4jO9ooX.js +0 -1
- package/dist/frontend/assets/PromptsPage-DWA7rRJd.js +0 -1
- package/dist/frontend/assets/ProvidersPage-PUWT8seJ.js +0 -3
- package/dist/frontend/assets/RolesPage-CqcclGRw.js +0 -1
- package/dist/frontend/assets/SettingsPage-8tS2cJgX.js +0 -3
- package/dist/frontend/assets/StatsPage-BX9khYzu.js +0 -1
- package/dist/frontend/assets/ToolsPage-9Tl9FdeD.js +0 -1
- package/dist/frontend/assets/WorkspaceCommandDialog-CCXxjDL8.js +0 -1
- package/dist/frontend/assets/WorkspacePanels-aMdJ7ZH7.js +0 -1
- package/dist/frontend/assets/alert-dialog-kFYVQ7oX.js +0 -1
- package/dist/frontend/assets/badge-74-3jsCg.js +0 -1
- package/dist/frontend/assets/constants-XUzFf6i1.js +0 -1
- package/dist/frontend/assets/index-BHC1Vhy8.css +0 -1
- package/dist/frontend/assets/index-CL1ALZ3r.js +0 -10
- package/dist/frontend/assets/modelParams-CaHd0903.js +0 -1
- package/dist/frontend/assets/roles-2OLDeTc5.js +0 -1
- package/dist/frontend/assets/select-DL_LPeDj.js +0 -1
- package/dist/frontend/assets/shared-CMxbpLeQ.js +0 -1
- /package/backend/src/flowent/static/assets/{datetime-m6_O_Ci9.js → datetime-eJqd0V2S.js} +0 -0
- /package/backend/src/flowent/static/assets/{markdown-vendor-DVdy_w12.js → markdown-vendor-C9RtvaJh.js} +0 -0
- /package/backend/src/flowent/static/assets/{triState-DEr3NkXV.js → triState-DgLlKdRR.js} +0 -0
- /package/dist/frontend/assets/{datetime-m6_O_Ci9.js → datetime-eJqd0V2S.js} +0 -0
- /package/dist/frontend/assets/{markdown-vendor-DVdy_w12.js → markdown-vendor-C9RtvaJh.js} +0 -0
- /package/dist/frontend/assets/{triState-DEr3NkXV.js → triState-DgLlKdRR.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BYbx6iT9.js";import{d as t,l as n}from"./graph-vendor-DRq_-6fV.js";import{H as r,R as i,ft as a,it as o,q as s,rn as c,st as l,z as u,zt as d}from"./ui-vendor-Dg9NNnWX.js";import{a as f}from"./shared-CMxbpLeQ.js";import{a as p,i as ee,n as m,t as h}from"./roles-2OLDeTc5.js";import{B as g,G as _,J as v,L as y,R as b,W as x,o as S}from"./index-CL1ALZ3r.js";import{t as C}from"./badge-74-3jsCg.js";import{i as w,n as te,o as T,r as E,t as D}from"./PageScaffold-D4jO9ooX.js";import{a as O,i as k,n as A,r as j,t as M}from"./select-DL_LPeDj.js";import{a as N,c as P,i as F,n as I,o as L,r as R,s as z,t as B}from"./alert-dialog-kFYVQ7oX.js";import{i as V,n as H,r as U,t as W}from"./modelParams-CaHd0903.js";var G=e(t(),1),K=new Set([`idle`,`sleep`,`todo`,`contacts`]);function q(){return{name:``,description:``,system_prompt:``,model:null,model_params:null,included_tools:[],excluded_tools:[]}}function J(e){return e?{name:e.name,description:e.description,system_prompt:e.system_prompt,model:e.model?{provider_id:e.model.provider_id,model:e.model.model}:null,model_params:e.model_params?W(e.model_params):null,included_tools:[...e.included_tools],excluded_tools:[...e.excluded_tools]}:q()}function ne(e){return e.filter(e=>!K.has(e.name))}function re(e){return Object.fromEntries(e.map(e=>[e.id,e]))}function Y(e,t){return e.included_tools.includes(t)?`included`:e.excluded_tools.includes(t)?`excluded`:`allowed`}function X(e,t){let n=Y(e,t);return n===`allowed`?{...e,included_tools:[...e.included_tools,t],excluded_tools:e.excluded_tools.filter(e=>e!==t)}:n===`included`?{...e,included_tools:e.included_tools.filter(e=>e!==t),excluded_tools:[...e.excluded_tools,t]}:{...e,included_tools:e.included_tools.filter(e=>e!==t),excluded_tools:e.excluded_tools.filter(e=>e!==t)}}function Z(e){return e.length===0?null:{provider_id:e[0]?.id??``,model:``}}function Q(e){let{activeRoleName:t,draft:n,roles:r}=e,i=n.name.trim();if(!i)return`Role name is required`;if(!n.description.trim())return`Role description is required`;if(!n.system_prompt.trim())return`System prompt is required`;if(n.model){if(!n.model.provider_id.trim())return`Provider is required for a role model override`;if(!n.model.model.trim())return`Model is required for a role model override`}return r.some(e=>e.name===i&&e.name!==t)?`Role name already exists`:null}function ie(e){return{name:e.name.trim(),description:e.description.trim(),system_prompt:e.system_prompt,model:e.model?{provider_id:e.model.provider_id.trim(),model:e.model.model.trim()}:null,model_params:U(e.model_params),included_tools:e.included_tools,excluded_tools:e.excluded_tools}}function ae(e){return e===`view`}function oe(e,t){return e!==`create`&&e!==null&&t?.is_builtin===!0}function se(e,t){return e===`create`?`New Role`:t?.is_builtin?`Built-in`:`Custom`}function ce(e,t){return e===`create`?`Create Role`:t?.is_builtin?`Role Details`:t?.name??`Role Details`}function le(e,t){return!(t||!e.name.trim()||!e.description.trim()||!e.system_prompt.trim())}function ue(){let[e,t]=(0,G.useState)(null),[n,r]=(0,G.useState)(null),[a,o]=(0,G.useState)(q()),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(null),{data:d,isLoading:f,mutate:g}=T(`rolesBootstrap`,ee),_=(0,G.useMemo)(()=>d?.roles??[],[d?.roles]),v=(0,G.useMemo)(()=>d?.tools??[],[d?.tools]),y=(0,G.useMemo)(()=>d?.providers??[],[d?.providers]),b=(0,G.useMemo)(()=>ne(v),[v]),x=(0,G.useMemo)(()=>re(y),[y]),S=(0,G.useMemo)(()=>n?_.find(e=>e.name===n)??null:null,[n,_]),C=a.model?.provider_id??``,w=(0,G.useMemo)(()=>C?x[C]?.models??[]:[],[C,x]),te=e!==null,E=ae(e),D=oe(e,S),O=se(e,S),k=ce(e,S),A=le(a,s),j=(0,G.useCallback)(e=>{g({roles:e,tools:v,providers:y},!1)},[g,y,v]),M=(0,G.useCallback)(async()=>{await g()},[g]),N=(0,G.useCallback)(()=>{t(null),r(null),o(q())},[]),P=(0,G.useCallback)(()=>{t(`create`),r(null),o(q())},[]),F=(0,G.useCallback)(e=>{t(`view`),r(e.name),o(J(e))},[]),I=(0,G.useCallback)(e=>{t(`edit`),r(e.name),o(J(e))},[]),L=(0,G.useCallback)(e=>{o(t=>e(t))},[]),R=(0,G.useCallback)(e=>{if(!e){L(e=>({...e,model:null}));return}if(y.length===0){i.error(`Create a provider before setting a role model`);return}L(e=>({...e,model:e.model??Z(y)}))},[y,L]),z=(0,G.useCallback)(e=>{L(t=>({...t,model:t.model?{provider_id:e,model:``}:null}))},[L]),B=(0,G.useCallback)(e=>{L(t=>({...t,model_params:e?W(t.model_params):null}))},[L]),V=(0,G.useCallback)(async()=>{let t=Q({activeRoleName:n,draft:a,roles:_});if(t){i.error(t);return}c(!0);try{let t=ie(a);if(e===`edit`&&n){let e=await p(n,S?.is_builtin?{model:t.model,model_params:t.model_params}:t);j(_.map(t=>t.name===n?e:t)),i.success(`Role updated`)}else j([await h(t),..._]),i.success(`Role created`);N()}catch(e){i.error(e instanceof Error?e.message:`Failed to save role`)}finally{c(!1)}},[S,n,N,a,e,_,j]),H=(0,G.useCallback)(e=>{u(e)},[]),U=(0,G.useCallback)(()=>{u(null)},[]),K=(0,G.useCallback)(async()=>{if(!l)return;let e=l.name;u(null);try{await m(e),j(_.filter(t=>t.name!==e)),n===e&&N(),i.success(`Role deleted`)}catch(e){i.error(e instanceof Error?e.message:`Failed to delete role`)}},[n,N,l,_,j]);return{activeRole:S,activeRoleName:n,availableActiveProviderModelOptions:w,canSave:A,configurableTools:b,draft:a,isPanelOpen:te,isReadOnly:E,loading:f,lockBuiltinFields:D,panelEyebrow:O,panelMode:e,panelTitle:k,providers:y,providersById:x,refreshRoles:M,roleToDelete:l,roles:_,saving:s,actions:{clearRoleToDelete:U,closePanel:N,cycleRoleToolState:(0,G.useCallback)(e=>{L(t=>X(t,e))},[L]),handleDelete:K,handleModelModeChange:R,handleModelParamsModeChange:B,handleProviderChange:z,handleSave:V,openCreate:P,openEdit:I,openView:F,requestDeleteRole:H,updateDraft:L},getToolState:e=>Y(a,e)}}var $=n();function de(){let{activeRole:e,availableActiveProviderModelOptions:t,canSave:n,configurableTools:i,draft:p,getToolState:ee,isPanelOpen:m,isReadOnly:h,loading:T,lockBuiltinFields:U,panelEyebrow:G,panelMode:K,panelTitle:q,providers:J,providersById:ne,refreshRoles:re,roleToDelete:Y,roles:X,saving:Z,actions:Q}=ue();return T&&!m?(0,$.jsx)(S,{label:`Loading roles...`}):(0,$.jsxs)(D,{className:`px-4 pt-6 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsx)(te,{title:`Roles`,actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(v,{type:`button`,variant:`outline`,size:`icon-sm`,onClick:()=>void re(),disabled:T,className:`bg-accent/20 text-muted-foreground hover:bg-accent/45 hover:text-foreground`,children:(0,$.jsx)(o,{className:f(`size-4`,T&&`animate-spin`)})}),(0,$.jsxs)(v,{type:`button`,size:`sm`,onClick:Q.openCreate,disabled:m,children:[(0,$.jsx)(l,{className:`size-4`}),`New Role`]})]})}),(0,$.jsx)(`div`,{className:`mt-6 min-h-0 flex-1`,children:m?(0,$.jsx)(`div`,{className:`h-full min-h-0 overflow-y-auto pr-2 scrollbar-none`,children:(0,$.jsxs)(`div`,{className:`mx-auto max-w-3xl pb-10`,children:[(0,$.jsxs)(`div`,{className:`mb-8 flex items-center justify-between rounded-xl border border-border bg-card/30 px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(C,{variant:`secondary`,className:`rounded-full border border-border/70 bg-accent/20 px-2.5 py-0.5 text-[11px] font-medium text-muted-foreground`,children:G}),(0,$.jsx)(`h2`,{className:`text-[15px] font-medium text-foreground`,children:q})]}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,size:`icon-xs`,onClick:Q.closePanel,className:`text-muted-foreground hover:bg-accent/45 hover:text-foreground`,children:(0,$.jsx)(u,{className:`size-3.5`})})]}),(0,$.jsxs)(`section`,{className:`mb-10`,children:[(0,$.jsx)(E,{title:`Identity`}),(0,$.jsxs)(`div`,{className:`border border-dashed border-border rounded-lg bg-card/30`,children:[(0,$.jsx)(w,{label:`Role Name`,children:(0,$.jsx)(b,{value:p.name,onChange:e=>Q.updateDraft(t=>({...t,name:e.target.value})),readOnly:h||U,placeholder:`e.g., Code Reviewer`,className:f(h||U?x:``)})}),(0,$.jsx)(w,{label:`Description`,children:(0,$.jsx)(g,{value:p.description,onChange:e=>Q.updateDraft(t=>({...t,description:e.target.value})),readOnly:h||U,placeholder:`Briefly explain what this role is best suited for`,rows:3,className:f(`resize-y`,h||U?x:``)})}),(0,$.jsx)(w,{label:`System Prompt`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(g,{value:p.system_prompt,onChange:e=>Q.updateDraft(t=>({...t,system_prompt:e.target.value})),readOnly:h||U,placeholder:`You are a helpful assistant that...`,rows:12,className:f(`resize-y`,h||U?x:``),mono:!0}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:h?e?.is_builtin?`This built-in role can be inspected. Use Edit to adjust only its model configuration.`:`This role is in read-only view. Use Edit to modify it.`:U?`Built-in role prompt and tool configuration are fixed. Only model configuration can be changed.`:`This prompt defines how agents with this role will behave.`})]})})]})]}),(0,$.jsxs)(`section`,{className:`mb-10 border-t border-border pt-8`,children:[(0,$.jsx)(E,{title:`Model Configuration`}),(0,$.jsxs)(`div`,{className:`space-y-6`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,disabled:h,onClick:()=>Q.handleModelModeChange(!1),className:f(`h-8 rounded-md border px-3 text-[13px] font-medium transition-colors`,p.model===null?`border-border bg-accent/45 text-foreground`:`border-transparent bg-card/20 text-muted-foreground hover:bg-accent/25`,h&&`cursor-default`),children:`Use Settings Default`}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,disabled:h,onClick:()=>Q.handleModelModeChange(!0),className:f(`h-8 rounded-md border px-3 text-[13px] font-medium transition-colors`,p.model===null?`border-transparent bg-card/20 text-muted-foreground hover:bg-accent/25`:`border-border bg-accent/45 text-foreground`,h&&`cursor-default`),children:`Set Role Override`})]}),p.model?(0,$.jsx)(`div`,{className:`rounded-xl border border-border bg-card/30 p-5`,children:(0,$.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-2`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`label`,{className:`text-[13px] font-medium text-foreground/80`,children:`Provider`}),(0,$.jsxs)(M,{value:p.model.provider_id||void 0,onValueChange:Q.handleProviderChange,disabled:h,children:[(0,$.jsx)(k,{className:_,children:(0,$.jsx)(O,{placeholder:`Select a provider`})}),(0,$.jsx)(A,{className:`rounded-xl border-border bg-popover`,children:J.map(e=>(0,$.jsx)(j,{value:e.id,className:`text-[13px]`,children:e.name},e.id))})]})]}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`label`,{className:`text-[13px] font-medium text-foreground/80`,children:`Provider Models`}),(0,$.jsxs)(M,{value:t.some(e=>e.model===p.model?.model)?p.model?.model:void 0,onValueChange:e=>Q.updateDraft(t=>({...t,model:t.model?{...t.model,model:e}:null})),disabled:h||!p.model.provider_id||t.length===0,children:[(0,$.jsx)(k,{className:_,children:(0,$.jsx)(O,{placeholder:t.length>0?`Pick a provider model`:`No saved provider models`})}),(0,$.jsx)(A,{className:`max-h-[300px] rounded-xl border-border bg-popover`,children:t.map(e=>(0,$.jsx)(j,{value:e.model,className:`text-[13px]`,children:e.model},e.model))})]}),t.length===0?(0,$.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:`No saved provider models. Manage this provider catalog in Providers.`}):null]}),(0,$.jsxs)(`div`,{className:`space-y-2 md:col-span-2`,children:[(0,$.jsx)(`label`,{className:`text-[13px] font-medium text-foreground/80`,children:`Model ID`}),(0,$.jsx)(b,{value:p.model.model,onChange:e=>Q.updateDraft(t=>({...t,model:t.model?{...t.model,model:e.target.value}:null})),readOnly:h,placeholder:`e.g., gpt-4o-mini`,className:f(h?x:``),mono:!0}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Catalog or manual ID`})]})]})}):(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This role follows the default provider and model from Settings.`})]})]}),(0,$.jsxs)(`section`,{className:`mb-10 border-t border-border pt-8`,children:[(0,$.jsx)(E,{title:`Model Parameters`}),(0,$.jsxs)(`div`,{className:`space-y-6`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,disabled:h,onClick:()=>Q.handleModelParamsModeChange(!1),className:f(`h-8 rounded-md border px-3 text-[13px] font-medium transition-colors`,H(p.model_params)?`border-border bg-accent/45 text-foreground`:`border-transparent bg-card/20 text-muted-foreground hover:bg-accent/25`,h&&`cursor-default`),children:`Use Settings Default`}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,disabled:h,onClick:()=>Q.handleModelParamsModeChange(!0),className:f(`h-8 rounded-md border px-3 text-[13px] font-medium transition-colors`,H(p.model_params)?`border-transparent bg-card/20 text-muted-foreground hover:bg-accent/25`:`border-border bg-accent/45 text-foreground`,h&&`cursor-default`),children:`Set Parameter Overrides`})]}),H(p.model_params)?(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This role inherits the default model parameters from Settings.`}):(0,$.jsx)(`div`,{className:`rounded-xl border border-border bg-card/30 p-5`,children:(0,$.jsx)(V,{value:W(p.model_params),onChange:e=>Q.updateDraft(t=>({...t,model_params:e})),disabled:h,emptyLabel:`Inherit settings default`,numberPlaceholder:`Inherit settings default`,reasoningDisableLabel:`Disable`,helperText:`These canonical parameters override Settings only for this role. Unsupported fields are ignored by the resolved provider.`})})]})]}),(0,$.jsxs)(`section`,{className:`mb-10 border-t border-border pt-8`,children:[(0,$.jsx)(E,{title:`Tool Configuration`}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-card/30`,children:i.map(e=>{let t=ee(e.name);return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-b border-border px-5 py-4 last:border-b-0`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,title:e.description,children:[(0,$.jsx)(`p`,{className:`font-mono text-[13px] text-foreground/80`,children:e.name}),(0,$.jsx)(`p`,{className:`mt-1 truncate text-[12px] text-muted-foreground`,children:e.description})]}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,size:`xs`,onClick:()=>Q.cycleRoleToolState(e.name),disabled:h||U,className:f(`shrink-0 rounded-full px-3 py-1 text-xs font-medium transition-colors`,t===`included`&&`bg-accent/50 text-foreground`,t===`excluded`&&`bg-transparent text-muted-foreground line-through`,t===`allowed`&&`bg-accent/20 text-muted-foreground hover:bg-accent/35`,(h||U)&&`cursor-default hover:bg-inherit opacity-60`),children:t===`allowed`?`Allowed`:t===`included`?`Included`:`Excluded`})]},e.name)})})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-3 border-t border-border pt-6`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,onClick:Q.closePanel,disabled:Z,children:`Cancel`}),h?null:(0,$.jsx)(v,{type:`button`,size:`sm`,onClick:()=>void Q.handleSave(),disabled:!n,children:Z?`Saving...`:K===`create`?`Create Role`:`Save Changes`}),h&&e&&!e.is_builtin?(0,$.jsx)(v,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>Q.openEdit(e),children:`Edit Role`}):null]})]})}):X.length===0?(0,$.jsxs)(c.div,{initial:{opacity:0},animate:{opacity:1},className:`flex h-full flex-col items-center justify-center text-center`,children:[(0,$.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-xl border border-border bg-accent/20 shadow-sm`,children:(0,$.jsx)(r,{className:`size-5 text-muted-foreground`})}),(0,$.jsx)(`h3`,{className:`mt-5 text-[15px] font-medium text-foreground`,children:`No Roles Created`}),(0,$.jsx)(`p`,{className:`mt-1.5 max-w-sm text-[13px] text-muted-foreground`,children:`Roles define agent behavior. Create your first role to get started.`})]}):(0,$.jsx)(`div`,{className:`h-full min-h-0 overflow-y-auto pr-2 scrollbar-none`,children:(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl`,children:[(0,$.jsxs)(`div`,{className:`mb-2 grid grid-cols-[260px_1fr_120px_100px] gap-4 px-4 pb-3`,children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Name`}),(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Model`}),(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Tools`}),(0,$.jsx)(`span`,{})]}),(0,$.jsx)(`div`,{className:`space-y-1`,children:X.map((t,n)=>{let r=t.model?ne[t.model.provider_id]?.name??t.model.provider_id:null,i=t.included_tools.length,o=t.excluded_tools.length,l=i===0&&o===0?`Default`:`${i>0?`+${i}`:``}${i>0&&o>0?` `:``}${o>0?`-${o}`:``}`;return(0,$.jsxs)(c.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{delay:n*.03},className:f(`group grid grid-cols-[220px_1fr_100px_80px] items-center gap-4 rounded-xl px-4 py-3.5 transition-colors`,e?.name===t.name?`bg-accent/25`:`hover:bg-accent/15`),children:[(0,$.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-[13px] font-medium text-foreground`,children:t.name}),t.is_builtin?(0,$.jsx)(`span`,{className:`shrink-0 rounded-full border border-border bg-accent/25 px-1.5 py-0.5 text-[9px] text-muted-foreground`,children:`Built-in`}):null]}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[12px] leading-relaxed text-muted-foreground`,children:t.description})]}),(0,$.jsx)(`div`,{className:`min-w-0 pr-2`,children:(0,$.jsx)(`span`,{className:`block truncate text-[13px] text-muted-foreground`,children:t.model?`${r} / ${t.model.model}`:`Settings default`})}),(0,$.jsx)(`div`,{className:`pr-2`,children:(0,$.jsx)(`span`,{className:`text-[13px] font-mono text-muted-foreground`,children:l})}),(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[(0,$.jsx)(y,{onClick:()=>Q.openView(t),"aria-label":`View ${t.name}`,title:`View ${t.name}`,className:`size-7`,children:(0,$.jsx)(d,{className:`size-3.5`})}),(0,$.jsx)(y,{onClick:()=>Q.openEdit(t),"aria-label":`Edit ${t.name}`,title:`Edit ${t.name}`,className:`size-7`,children:(0,$.jsx)(a,{className:`size-3.5`})}),t.is_builtin?null:(0,$.jsx)(y,{onClick:()=>Q.requestDeleteRole(t),"aria-label":`Delete ${t.name}`,title:`Delete ${t.name}`,className:`flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,children:(0,$.jsx)(s,{className:`size-3.5`})})]})]},t.name)})})]})})})]}),(0,$.jsx)(B,{open:Y!==null,onOpenChange:e=>{e||Q.clearRoleToDelete()},children:(0,$.jsxs)(F,{children:[(0,$.jsxs)(z,{children:[(0,$.jsx)(P,{children:`Delete role?`}),(0,$.jsx)(N,{children:Y?`This will permanently remove ${Y.name}.`:`This will permanently remove the selected role.`})]}),(0,$.jsxs)(L,{children:[(0,$.jsx)(R,{asChild:!0,children:(0,$.jsx)(v,{variant:`ghost`,children:`Cancel`})}),(0,$.jsx)(I,{asChild:!0,children:(0,$.jsx)(v,{variant:`destructive`,onClick:()=>void Q.handleDelete(),children:`Delete`})})]})]})})]})}export{de as RolesPage};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BYbx6iT9.js";import{d as t,l as n}from"./graph-vendor-DRq_-6fV.js";import{R as r,nt as i}from"./ui-vendor-Dg9NNnWX.js";import{a,t as o}from"./shared-CMxbpLeQ.js";import{B as s,G as c,H as l,J as u,R as d,U as f,V as p,f as m,o as h,z as g}from"./index-CL1ALZ3r.js";import{i as _,n as v,o as y,r as b,t as x}from"./PageScaffold-D4jO9ooX.js";import{a as S,i as C,n as w,r as T,t as E}from"./select-DL_LPeDj.js";import{n as D,r as O,t as k}from"./triState-DEr3NkXV.js";import{i as A,t as j}from"./modelParams-CaHd0903.js";async function M(){return o(`/api/settings/bootstrap`,{errorMessage:`Failed to fetch settings bootstrap`})}async function ee(e){return o(`/api/settings`,{method:`POST`,body:e,errorMessage:`Failed to save settings`,map:e=>{if(!e)throw Error(`Failed to save settings`);return{settings:e.settings,reauthRequired:e.reauth_required===!0}}})}var N=1024;function P(e){let t=[],n=new Set;for(let r of e){let e=r.trim();if(!e)continue;let i=e.replace(/\/+$/u,``)||`/`;n.has(i)||(n.add(i),t.push(i))}return t}function F(e,t){return e.find(e=>e.id===t)??null}function I(e,t){return e.find(e=>e.name===t)??null}function L(e){return e?.models??[]}function R(e,t){return t?e.find(e=>e.model===t)??null:null}function z(e,t){return e.model.context_window_tokens??t?.context_window_tokens??e.model.resolved_context_window_tokens??null}function B(e,t){return{input_image:e.model.input_image??t?.input_image??e.model.capabilities?.input_image??!1,output_image:e.model.output_image??t?.output_image??e.model.capabilities?.output_image??!1}}function V(e,t){if(!e)return null;let n=t.max_output_tokens??1024;return Math.max(1,e-n-N)}function H(e,t){return e!==null&&t!==null&&e>=t?`Automatic Compact token limit must stay below the known safe input window`:null}function U(e,t){let n=t&&(t.newCode||t.confirmCode)?{new_code:t.newCode,confirm_code:t.confirmCode}:void 0;return{...n?{access:n}:{},working_dir:e.working_dir.trim(),assistant:{role_name:e.assistant.role_name,allow_network:e.assistant.allow_network,write_dirs:P(e.assistant.write_dirs)},leader:e.leader,model:{active_provider_id:e.model.active_provider_id,active_model:e.model.active_model,input_image:e.model.input_image,output_image:e.model.output_image,context_window_tokens:e.model.context_window_tokens,timeout_ms:e.model.timeout_ms,retry_policy:e.model.retry_policy,max_retries:e.model.max_retries,retry_initial_delay_seconds:e.model.retry_initial_delay_seconds,retry_max_delay_seconds:e.model.retry_max_delay_seconds,retry_backoff_cap_retries:e.model.retry_backoff_cap_retries,auto_compact_token_limit:e.model.auto_compact_token_limit,params:e.model.params}}}var W=n(),G=[{value:`no_retry`,label:`No retry`},{value:`limited`,label:`Limited`},{value:`unlimited`,label:`Unlimited`}];function K({accessDraftError:e,onSave:t,saving:n,settings:r}){return(0,W.jsx)(v,{title:`Settings`,actions:(0,W.jsxs)(u,{type:`button`,size:`sm`,onClick:t,disabled:n||!!e||!r.working_dir.trim(),className:`text-[13px]`,children:[(0,W.jsx)(i,{className:`size-4`}),n?`Saving...`:`Save Changes`]}),className:`mb-8`})}function q({accessDraft:e,accessDraftError:t,onAccessDraftChange:n}){return(0,W.jsxs)(`section`,{className:`mt-8 first:mt-0`,children:[(0,W.jsx)(b,{title:`Access Configuration`}),(0,W.jsxs)(`div`,{className:`rounded-xl border border-border bg-surface-2 shadow-sm overflow-hidden`,children:[(0,W.jsx)(_,{label:`New Access Code`,children:(0,W.jsx)(`div`,{className:`space-y-2 w-full`,children:(0,W.jsx)(p,{id:`new-access-code`,value:e.newCode,onChange:e=>n(t=>({...t,newCode:e.target.value})),placeholder:`Leave empty to keep`,showLabel:`Show new access code`,hideLabel:`Hide new access code`,buttonSize:`default`})})}),(0,W.jsx)(_,{label:`Confirm Access Code`,children:(0,W.jsxs)(`div`,{className:`space-y-2 w-full`,children:[(0,W.jsx)(p,{id:`confirm-access-code`,value:e.confirmCode,onChange:e=>n(t=>({...t,confirmCode:e.target.value})),placeholder:`Repeat the new access code`,showLabel:`Show confirmed access code`,hideLabel:`Hide confirmed access code`,buttonSize:`default`}),t?(0,W.jsx)(`p`,{className:a(`text-destructive font-medium pt-1`,l),children:t}):null]})})]})]})}function J({onSettingsChange:e,settings:t}){return(0,W.jsxs)(`section`,{className:`mt-10`,children:[(0,W.jsx)(b,{title:`Path Configuration`}),(0,W.jsxs)(`div`,{className:`rounded-xl border border-border bg-surface-2 shadow-sm overflow-hidden`,children:[(0,W.jsx)(_,{label:`App Data Directory`,children:(0,W.jsx)(`div`,{className:`space-y-2`,children:(0,W.jsx)(d,{"aria-label":`App Data Directory`,value:t.app_data_dir,readOnly:!0,mono:!0})})}),(0,W.jsx)(_,{label:`Working Directory`,children:(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(d,{"aria-label":`Working Directory`,value:t.working_dir,onChange:t=>e(e=>({...e,working_dir:t.target.value})),placeholder:`/workspace/project`,mono:!0}),(0,W.jsx)(`div`,{className:a(`space-y-2`,l),children:t.working_dir.trim()?null:(0,W.jsx)(`p`,{className:`text-destructive`,children:`Working Directory must not be empty.`})})]})})]})]})}function Y({assistantRole:e,onSettingsChange:t,roles:n,settings:r}){return(0,W.jsxs)(`section`,{className:`mt-10`,children:[(0,W.jsx)(b,{title:`Assistant Configuration`}),(0,W.jsxs)(`div`,{className:`rounded-xl border border-border bg-surface-2 shadow-sm overflow-hidden`,children:[(0,W.jsxs)(_,{label:`Assistant Role`,children:[(0,W.jsxs)(E,{value:r.assistant.role_name,onValueChange:e=>t(t=>({...t,assistant:{...t.assistant,role_name:e}})),children:[(0,W.jsx)(C,{className:c,children:(0,W.jsx)(S,{placeholder:`Select a role`})}),(0,W.jsx)(w,{children:n.map(e=>(0,W.jsx)(T,{value:e.name,children:(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start`,children:[(0,W.jsx)(`span`,{children:e.name}),(0,W.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.description})]})},e.name))})]}),e?(0,W.jsx)(`div`,{"data-testid":`assistant-role-guidance`,className:a(`mt-2`,l),children:(0,W.jsx)(`p`,{children:e.description})}):null]}),(0,W.jsx)(_,{label:`Network Access`,children:(0,W.jsx)(`div`,{className:`space-y-2`,children:(0,W.jsx)(g,{checked:r.assistant.allow_network,label:`Network Access`,onCheckedChange:e=>t(t=>({...t,assistant:{...t.assistant,allow_network:e}})),showStateText:!0})})}),(0,W.jsx)(_,{label:`Write Dirs`,children:(0,W.jsx)(`div`,{className:`space-y-2`,children:(0,W.jsx)(s,{"aria-label":`Write Dirs`,value:r.assistant.write_dirs.join(`
|
|
2
|
-
`),onChange:e=>t(t=>({...t,assistant:{...t.assistant,write_dirs:e.target.value.split(`
|
|
3
|
-
`)}})),rows:4,spellCheck:!1,placeholder:`/workspace/output`,className:`min-h-[108px]`,mono:!0})})})]})]})}function X({leaderRole:e,onSettingsChange:t,roles:n,settings:r}){return(0,W.jsxs)(`section`,{className:`mt-10`,children:[(0,W.jsx)(b,{title:`Leader Configuration`}),(0,W.jsx)(`div`,{className:`rounded-xl border border-border bg-surface-2 shadow-sm overflow-hidden`,children:(0,W.jsxs)(_,{label:`Leader Role`,children:[(0,W.jsxs)(E,{value:r.leader.role_name,onValueChange:e=>t(t=>({...t,leader:{role_name:e}})),children:[(0,W.jsx)(C,{className:c,children:(0,W.jsx)(S,{placeholder:`Select a role`})}),(0,W.jsx)(w,{children:n.map(e=>(0,W.jsx)(T,{value:e.name,children:(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start`,children:[(0,W.jsx)(`span`,{children:e.name}),(0,W.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.description})]})},e.name))})]}),e?(0,W.jsx)(`p`,{className:a(`mt-2`,l),children:e.description}):null]})})]})}function Z({activeProvider:e,activeProviderModels:t,availableActiveProviderModels:n,effectiveContextWindowTokens:r,effectiveModelCapabilities:i,knownSafeInputTokens:o,onSettingsChange:s,providers:u,settings:p}){return(0,W.jsxs)(`section`,{className:`mt-10`,children:[(0,W.jsx)(b,{title:`Model Configuration`}),(0,W.jsxs)(`div`,{className:`rounded-xl border border-border bg-surface-2 shadow-sm overflow-hidden`,children:[(0,W.jsxs)(_,{label:`Active Provider`,children:[(0,W.jsxs)(E,{value:p.model.active_provider_id,onValueChange:e=>{s(t=>({...t,model:{...t.model,active_provider_id:e,active_model:``}}))},children:[(0,W.jsx)(C,{className:c,children:(0,W.jsx)(S,{placeholder:`Select a provider`})}),(0,W.jsx)(w,{children:u.map(e=>(0,W.jsxs)(T,{value:e.id,children:[e.name,` (`,O(e.type),`)`]},e.id))})]}),e?(0,W.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Using `,e.name,` (`,e.base_url,`)`]}):null]}),(0,W.jsxs)(_,{label:`Model`,children:[(0,W.jsxs)(`div`,{className:`space-y-3`,children:[p.model.active_provider_id?t.length>0?(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(`label`,{className:f,children:`Provider Models`}),(0,W.jsxs)(E,{value:n.some(e=>e.model===p.model.active_model)?p.model.active_model:void 0,onValueChange:e=>s(t=>({...t,model:{...t.model,active_model:e}})),children:[(0,W.jsx)(C,{className:c,children:(0,W.jsx)(S,{placeholder:`Select a provider model`})}),(0,W.jsx)(w,{children:n.map(e=>(0,W.jsx)(T,{value:e.model,children:e.model},e.model))})]})]}):(0,W.jsx)(`p`,{className:l,children:`No saved provider models.`}):null,(0,W.jsx)(d,{value:p.model.active_model,onChange:e=>s(t=>({...t,model:{...t.model,active_model:e.target.value}})),placeholder:p.model.active_provider_id?`Enter model ID manually`:`Select a provider first`})]}),p.model.active_model?(0,W.jsxs)(`div`,{className:a(`mt-2 space-y-1`,l),children:[(0,W.jsxs)(`p`,{children:[`Context window:`,` `,r?r.toLocaleString():`Not resolved`]}),(0,W.jsxs)(`p`,{children:[`Capabilities: input_image=`,i.input_image?`true`:`false`,`, output_image=`,i.output_image?`true`:`false`]})]}):null]}),(0,W.jsx)(_,{label:`Model Metadata Overrides`,children:(0,W.jsx)(`div`,{className:`space-y-3`,children:(0,W.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsx)(`label`,{htmlFor:`model-context-window`,className:f,children:`Context Window`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(d,{id:`model-context-window`,"aria-label":`Context Window`,inputMode:`numeric`,pattern:`[0-9]*`,value:p.model.context_window_tokens===null?``:String(p.model.context_window_tokens),onChange:e=>{let t=e.target.value.trim();/^\d*$/.test(t)&&(t&&Number.parseInt(t,10)<=0||s(e=>({...e,model:{...e.model,context_window_tokens:t?Number.parseInt(t,10):null}})))},placeholder:`Auto`,mono:!0}),(0,W.jsx)(`span`,{className:`text-[13px] font-medium text-muted-foreground`,children:`tokens`})]})]}),(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsx)(`label`,{className:f,children:`Input Image`}),(0,W.jsxs)(E,{value:D(p.model.input_image),onValueChange:e=>s(t=>({...t,model:{...t.model,input_image:k(e)}})),children:[(0,W.jsx)(C,{"aria-label":`Input Image`,className:c,children:(0,W.jsx)(S,{placeholder:`Auto`})}),(0,W.jsxs)(w,{children:[(0,W.jsx)(T,{value:`auto`,children:`Auto`}),(0,W.jsx)(T,{value:`enabled`,children:`Enabled`}),(0,W.jsx)(T,{value:`disabled`,children:`Disabled`})]})]})]}),(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsx)(`label`,{className:f,children:`Output Image`}),(0,W.jsxs)(E,{value:D(p.model.output_image),onValueChange:e=>s(t=>({...t,model:{...t.model,output_image:k(e)}})),children:[(0,W.jsx)(C,{"aria-label":`Output Image`,className:c,children:(0,W.jsx)(S,{placeholder:`Auto`})}),(0,W.jsxs)(w,{children:[(0,W.jsx)(T,{value:`auto`,children:`Auto`}),(0,W.jsx)(T,{value:`enabled`,children:`Enabled`}),(0,W.jsx)(T,{value:`disabled`,children:`Disabled`})]})]})]})]})})}),(0,W.jsx)(_,{label:`Default Model Parameters`,valueClassName:`w-full md:w-80`,children:(0,W.jsx)(`div`,{className:`rounded-xl border border-border bg-card/30 p-5`,children:(0,W.jsx)(A,{className:`w-full`,value:j(p.model.params),onChange:e=>s(t=>({...t,model:{...t.model,params:e}})),emptyLabel:`Not set`,numberPlaceholder:`Not set`,reasoningDisableLabel:null,helperText:`Empty fields are omitted from outgoing provider requests. Reasoning effort and verbosity are mainly effective on reasoning-capable providers such as OpenAI Responses with GPT-5 family models.`})})}),(0,W.jsx)(_,{label:`Request Timeout`,children:(0,W.jsx)(`div`,{className:`space-y-2`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(d,{"aria-label":`Request Timeout`,inputMode:`numeric`,pattern:`[0-9]*`,value:String(p.model.timeout_ms),onChange:e=>{let t=e.target.value.trim();if(!/^\d+$/.test(t))return;let n=Number.parseInt(t,10);!Number.isSafeInteger(n)||n<=0||s(e=>({...e,model:{...e.model,timeout_ms:n}}))},mono:!0}),(0,W.jsx)(`span`,{className:`text-[13px] font-medium text-muted-foreground`,children:`ms`})]})})}),(0,W.jsx)(_,{label:`Retry Policy`,children:(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsxs)(E,{value:p.model.retry_policy,onValueChange:e=>s(t=>({...t,model:{...t.model,retry_policy:e}})),children:[(0,W.jsx)(C,{className:c,children:(0,W.jsx)(S,{placeholder:`Select a retry policy`})}),(0,W.jsx)(w,{children:G.map(e=>(0,W.jsx)(T,{value:e.value,children:e.label},e.value))})]}),p.model.retry_policy===`limited`?(0,W.jsx)(`div`,{className:`space-y-2`,children:(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsx)(`label`,{htmlFor:`retry-attempts`,className:f,children:`Retry Attempts`}),(0,W.jsx)(d,{id:`retry-attempts`,"aria-label":`Retry Attempts`,inputMode:`numeric`,pattern:`[0-9]*`,value:String(p.model.max_retries),onChange:e=>{let t=e.target.value.trim();if(!/^\d+$/.test(t))return;let n=Number.parseInt(t,10);!Number.isSafeInteger(n)||n<=0||s(e=>({...e,model:{...e.model,max_retries:n}}))},mono:!0})]})}):null]})}),(0,W.jsx)(_,{label:`Retry Backoff`,children:(0,W.jsx)(`div`,{className:`space-y-3`,children:(0,W.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsx)(`label`,{htmlFor:`retry-initial-delay`,className:f,children:`Initial Delay`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(d,{id:`retry-initial-delay`,"aria-label":`Initial Delay`,inputMode:`decimal`,value:String(p.model.retry_initial_delay_seconds),onChange:e=>{let t=e.target.value.trim();if(!/^\d+(\.\d+)?$/.test(t))return;let n=Number.parseFloat(t);!Number.isFinite(n)||n<=0||s(e=>({...e,model:{...e.model,retry_initial_delay_seconds:n}}))},mono:!0}),(0,W.jsx)(`span`,{className:`text-[13px] font-medium text-muted-foreground`,children:`s`})]})]}),(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsx)(`label`,{htmlFor:`retry-max-delay`,className:f,children:`Max Delay`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(d,{id:`retry-max-delay`,"aria-label":`Max Delay`,inputMode:`decimal`,value:String(p.model.retry_max_delay_seconds),onChange:e=>{let t=e.target.value.trim();if(!/^\d+(\.\d+)?$/.test(t))return;let n=Number.parseFloat(t);!Number.isFinite(n)||n<=0||s(e=>({...e,model:{...e.model,retry_max_delay_seconds:n}}))},mono:!0}),(0,W.jsx)(`span`,{className:`text-[13px] font-medium text-muted-foreground`,children:`s`})]})]}),(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsx)(`label`,{htmlFor:`retry-backoff-cap-retries`,className:f,children:`Cap Retries`}),(0,W.jsx)(d,{id:`retry-backoff-cap-retries`,"aria-label":`Cap Retries`,inputMode:`numeric`,pattern:`[0-9]*`,value:String(p.model.retry_backoff_cap_retries),onChange:e=>{let t=e.target.value.trim();if(!/^\d+$/.test(t))return;let n=Number.parseInt(t,10);!Number.isSafeInteger(n)||n<=0||s(e=>({...e,model:{...e.model,retry_backoff_cap_retries:n}}))},mono:!0})]})]})})}),(0,W.jsx)(_,{label:`Automatic Compact`,children:(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsx)(`label`,{htmlFor:`auto-compact-token-limit`,className:f,children:`Token Limit`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(d,{id:`auto-compact-token-limit`,"aria-label":`Automatic Compact Token Limit`,inputMode:`numeric`,pattern:`[0-9]*`,value:p.model.auto_compact_token_limit===null?``:String(p.model.auto_compact_token_limit),onChange:e=>{let t=e.target.value.trim();/^\d*$/.test(t)&&(t&&Number.parseInt(t,10)<=0||s(e=>({...e,model:{...e.model,auto_compact_token_limit:t?Number.parseInt(t,10):null}})))},placeholder:`Disabled`,mono:!0}),(0,W.jsx)(`span`,{className:`text-[13px] font-medium text-muted-foreground`,children:`tokens`})]})]}),o===null?p.model.auto_compact_token_limit===null?null:(0,W.jsx)(`p`,{className:`text-[11px] leading-relaxed text-graph-status-idle`,children:`The current model window is not resolved, so this token limit can be saved but cannot be fully validated yet.`}):(0,W.jsxs)(`p`,{className:l,children:[`Known safe input window: `,o.toLocaleString(),` `,`tokens.`,p.model.auto_compact_token_limit!==null&&p.model.auto_compact_token_limit>=o?` Save is blocked until the token limit is lower than this window.`:null]})]})})]})]})}function Q({appVersion:e}){return(0,W.jsxs)(`div`,{className:`mt-12 flex flex-col items-center pt-2 pb-6 text-center`,children:[(0,W.jsxs)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:[`Flowent Agent Studio v`,e??`—`]}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[10px] text-muted-foreground/80`,children:`A multi-agent collaboration framework.`})]})}var $=e(t(),1);function te(){let{requireReauth:e}=m(),{data:t,isLoading:n,mutate:i}=y(`settingsBootstrap`,()=>M()),[a,o]=(0,$.useState)(null),[s,c]=(0,$.useState)(!1),[l,u]=(0,$.useState)({newCode:``,confirmCode:``}),d=(0,$.useMemo)(()=>t?.providers??[],[t?.providers]),f=(0,$.useMemo)(()=>t?.roles??[],[t?.roles]),p=t?.version??null;(0,$.useEffect)(()=>{t?.settings&&!a&&o(t.settings)},[t?.settings,a]);let h=a??t?.settings??null,g=(0,$.useCallback)(e=>{o(n=>{let r=n??t?.settings??null;return r?e(r):n})},[t?.settings]),_=(0,$.useCallback)(e=>{u(t=>e(t))},[]),v=(0,$.useMemo)(()=>h?F(d,h.model.active_provider_id):null,[d,h]),b=(0,$.useMemo)(()=>h?I(f,h.assistant.role_name):null,[f,h]),x=(0,$.useMemo)(()=>L(v),[v]),S=x,C=(0,$.useMemo)(()=>h?R(x,h.model.active_model):null,[x,h]),w=(0,$.useMemo)(()=>h?z(h,C):null,[C,h]),T=(0,$.useMemo)(()=>h?B(h,C):{input_image:!1,output_image:!1},[C,h]),E=(0,$.useMemo)(()=>h?V(w,h.model.params):null,[w,h]),D=(0,$.useMemo)(()=>h?I(f,h.leader.role_name):null,[f,h]),O=(0,$.useMemo)(()=>!l.newCode&&!l.confirmCode?null:l.newCode.trim()?l.confirmCode===l.newCode?null:`Confirm Access Code must exactly match New Access Code.`:`New Access Code must not be empty.`,[l.confirmCode,l.newCode]);return{accessDraft:l,accessDraftError:O,activeProvider:v,activeProviderModels:x,availableActiveProviderModels:S,appVersion:p,assistantRole:b,effectiveContextWindowTokens:w,effectiveModelCapabilities:T,handleSave:(0,$.useCallback)(async()=>{if(!h)return;if(O){r.error(O);return}if(!h.working_dir.trim()){r.error(`Working Directory must not be empty`);return}if(h.model.retry_max_delay_seconds<h.model.retry_initial_delay_seconds){r.error(`Max Delay must be greater than or equal to Initial Delay`);return}let t=H(h.model.auto_compact_token_limit,E);if(t){r.error(t);return}c(!0);try{let t=await ee(U(h,l)),n=t.settings;if(o(n),u({newCode:``,confirmCode:``}),i(e=>e&&{...e,settings:n},!1),t.reauthRequired){r.success(`Access code updated. Sign in again with the new code.`),e();return}r.success(`Settings saved`)}catch(e){r.error(e instanceof Error?e.message:`Failed to save settings`)}finally{c(!1)}},[l,O,E,i,e,h]),knownSafeInputTokens:E,leaderRole:D,loading:n,providers:d,roles:f,saving:s,settings:h,updateAccessDraft:_,updateSettings:g}}function ne(){let{accessDraft:e,accessDraftError:t,activeProvider:n,activeProviderModels:r,availableActiveProviderModels:i,appVersion:a,assistantRole:o,effectiveContextWindowTokens:s,effectiveModelCapabilities:c,handleSave:l,knownSafeInputTokens:u,leaderRole:d,loading:f,providers:p,roles:m,saving:g,settings:_,updateAccessDraft:v,updateSettings:y}=te();return f||!_?(0,W.jsx)(h,{label:`Loading settings...`,textClassName:`text-[13px]`}):(0,W.jsx)(x,{children:(0,W.jsx)(`div`,{className:`h-full min-h-0 overflow-y-auto pr-2 scrollbar-none`,children:(0,W.jsxs)(`div`,{className:`mx-auto max-w-[680px] pb-10 pt-6`,children:[(0,W.jsx)(K,{accessDraftError:t,onSave:()=>{l()},saving:g,settings:_}),(0,W.jsx)(q,{accessDraft:e,accessDraftError:t,onAccessDraftChange:v}),(0,W.jsx)(J,{onSettingsChange:y,settings:_}),(0,W.jsx)(Y,{assistantRole:o,onSettingsChange:y,roles:m,settings:_}),(0,W.jsx)(X,{leaderRole:d,onSettingsChange:y,roles:m,settings:_}),(0,W.jsx)(Z,{activeProvider:n,activeProviderModels:r,availableActiveProviderModels:i,effectiveContextWindowTokens:s,effectiveModelCapabilities:c,knownSafeInputTokens:u,onSettingsChange:y,providers:p,settings:_}),(0,W.jsx)(Q,{appVersion:a})]})})})}export{ne as SettingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BYbx6iT9.js";import{d as t,l as n}from"./graph-vendor-DRq_-6fV.js";import{$ as r,Et as i,Gt as a,It as o,K as s,Mt as c,Qt as l,V as u,Vt as d,X as f,en as p,it as m}from"./ui-vendor-Dg9NNnWX.js";import{a as h,t as g}from"./shared-CMxbpLeQ.js";import{J as _}from"./index-CL1ALZ3r.js";import{r as ee}from"./constants-XUzFf6i1.js";import{a as v,n as te,o as y,t as ne}from"./PageScaffold-D4jO9ooX.js";import{t as b}from"./datetime-m6_O_Ci9.js";import{a as x,i as S,n as C,r as w,t as T}from"./select-DL_LPeDj.js";async function E(e){return g(`/api/stats?range=${encodeURIComponent(e)}`,{method:`GET`,errorMessage:`Failed to fetch stats`,map:t=>({requested_at:typeof t?.requested_at==`number`?t.requested_at:0,range:t?.range===`1h`||t?.range===`24h`||t?.range===`7d`||t?.range===`30d`?t.range:e,tabs:Array.isArray(t?.workflows)?t.workflows:[],nodes:Array.isArray(t?.nodes)?t.nodes.map(e=>({...e,tab_id:typeof e.workflow_id==`string`?e.workflow_id:null,tab_title:typeof e.workflow_title==`string`?e.workflow_title:null})):[],requests:Array.isArray(t?.requests)?t.requests.map(e=>({...e,tab_id:typeof e.workflow_id==`string`?e.workflow_id:null,tab_title:typeof e.workflow_title==`string`?e.workflow_title:null})):[],compacts:Array.isArray(t?.compacts)?t.compacts.map(e=>({...e,tab_id:typeof e.workflow_id==`string`?e.workflow_id:null,tab_title:typeof e.workflow_title==`string`?e.workflow_title:null})):[],mcp_activity:Array.isArray(t?.mcp_activity)?t.mcp_activity.map(e=>({...e,tab_id:typeof e.workflow_id==`string`?e.workflow_id:null})):[]})})}var D=e(t(),1),O={"1h":3600,"24h":1440*60,"7d":10080*60,"30d":720*60*60},k={"1h":12,"24h":24,"7d":28,"30d":30};function A(e){return typeof e!=`number`||!Number.isFinite(e)?null:e>0xe8d4a51000?e:e*1e3}function j(e,t){return t||e||`Unknown provider`}function M(e){return e||`Unknown model`}function N(e){return e||`Unknown workflow`}function P(e){return e||`Unknown agent`}function F(e,t){return!(t.providerId&&e.provider_id!==t.providerId||t.model&&(e.model||null)!==t.model||t.tabId&&(e.tab_id||null)!==t.tabId||t.agentId&&(e.node_id||null)!==t.agentId)}function I(e,t){return!(t.providerId&&(e.provider_id||null)!==t.providerId||t.model&&(e.model||null)!==t.model||t.tabId&&(e.tab_id||null)!==t.tabId||t.agentId&&e.id!==t.agentId)}function L(e){return e.reduce((e,t)=>e+(typeof t==`number`?t:0),0)}function R(e){return e.length===0?null:e.reduce((e,t)=>e+t,0)/e.length}function z(e){let t=0,n=0;for(let r of e)typeof r.cacheRead==`number`&&typeof r.inputTokens==`number`&&r.inputTokens>0&&(t+=r.cacheRead,n+=r.inputTokens);return n<=0?null:Math.max(0,Math.min(1,t/n))}function B(e){let t=e.map(e=>e.duration_ms),n=e.filter(e=>e.result===`success`);return{requestCount:e.length,errorCount:e.filter(e=>e.result===`error`).length,totalTokens:L(n.map(e=>e.normalized_usage?.total_tokens??null)),avgLatencyMs:R(t),retryCount:e.reduce((e,t)=>e+t.retry_count,0),cacheRead:L(n.map(e=>e.normalized_usage?.cache_read_tokens??null)),cacheWrite:L(n.map(e=>e.normalized_usage?.cache_write_tokens??null)),cacheHitRate:z(n.map(e=>({cacheRead:e.normalized_usage?.cache_read_tokens??null,inputTokens:e.normalized_usage?.input_tokens??null}))),lastActivityAt:e.length>0?Math.max(...e.map(e=>A(e.ended_at)??0)):null}}function V(e,t){let n=new Date(e);return t===`1h`||t===`24h`?n.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n.toLocaleDateString([],{month:`numeric`,day:`numeric`})}function H(e){return[...e.entries()].sort((e,t)=>e[1].localeCompare(t[1])).map(([e,t])=>({value:e,label:t}))}function U(e){let t=new Map,n=new Map,r=new Map,i=new Map;for(let a of e.nodes)a.provider_id&&t.set(a.provider_id,j(a.provider_id,a.provider_name)),a.model&&n.set(a.model,M(a.model)),a.tab_id&&r.set(a.tab_id,N(a.tab_title)),i.set(a.id,P(a.label));for(let a of e.requests)a.provider_id&&t.set(a.provider_id,j(a.provider_id,a.provider_name)),a.model&&n.set(a.model,M(a.model)),a.tab_id&&r.set(a.tab_id,N(a.tab_title)),i.set(a.node_id,P(a.node_label));for(let a of e.compacts)a.provider_id&&t.set(a.provider_id,j(a.provider_id,a.provider_name)),a.model&&n.set(a.model,M(a.model)),a.tab_id&&r.set(a.tab_id,N(a.tab_title)),i.set(a.node_id,P(a.node_label));return{providers:H(t),models:H(n),tabs:H(r),agents:H(i)}}function re(e,t){let n=e.requests.filter(e=>F(e,t)),r=e.compacts.filter(e=>F(e,t)),i=e.nodes.filter(e=>I(e,t)),a=new Set(i.map(e=>e.tab_id).filter(e=>typeof e==`string`&&e.length>0));return{requests:n,compacts:r,nodes:i,tabs:e.tabs.filter(e=>t.tabId?e.id===t.tabId:t.agentId||t.providerId||t.model?a.has(e.id):!0)}}function ie(e,t,n){let r=n.nodes.filter(e=>e.state===`running`).length,i=n.tabs.length,a=B(n.requests),o=n.requests.some(e=>e.normalized_usage?.cache_read_tokens!=null||e.normalized_usage?.cache_write_tokens!=null),s=t.providerId||t.model||t.tabId||t.agentId?n:re(e,t);return{activeTabs:t.providerId||t.model||t.tabId||t.agentId?i:s.tabs.length,runningAgents:t.providerId||t.model||t.tabId||t.agentId?r:s.nodes.filter(e=>e.state===`running`).length,llmRequests:a.requestCount,totalTokens:a.totalTokens,errorRate:a.requestCount>0?a.errorCount/a.requestCount:null,avgLatencyMs:a.avgLatencyMs,cacheRead:a.cacheRead,cacheWrite:a.cacheWrite,cacheHitRate:a.cacheHitRate,hasCacheUsage:o}}function ae(e,t,n,r){let i=A(r)??Date.now(),a=k[e],o=O[e]*1e3,s=Math.max(1,Math.ceil(o/a)),c=i-o,l=Array.from({length:a},(t,n)=>{let r=c+n*s;return{startMs:r,endMs:r+s,label:V(r,e),requestCount:0,errorCount:0,totalTokens:0,avgLatencyMs:null,compactCount:0,manualCompactCount:0,autoCompactCount:0,cacheRead:0,cacheWrite:0,cacheHitRate:null}}),u=new Map,d=new Map,f=e=>e===null||e<c||e>i?null:Math.min(a-1,Math.max(0,Math.floor((e-c)/s)));for(let e of t){let t=f(A(e.ended_at));if(t===null)continue;let n=l[t];if(n.requestCount+=1,e.result===`error`&&(n.errorCount+=1),e.result===`success`){n.totalTokens+=e.normalized_usage?.total_tokens??0,n.cacheRead+=e.normalized_usage?.cache_read_tokens??0,n.cacheWrite+=e.normalized_usage?.cache_write_tokens??0;let r=d.get(t)??[];r.push({cacheRead:e.normalized_usage?.cache_read_tokens??null,inputTokens:e.normalized_usage?.input_tokens??null}),d.set(t,r)}let r=u.get(t)??[];r.push(e.duration_ms),u.set(t,r)}for(let e of n){let t=f(A(e.ended_at));if(t===null)continue;let n=l[t];n.compactCount+=1,e.trigger_type===`manual`?n.manualCompactCount+=1:n.autoCompactCount+=1}for(let e=0;e<l.length;e+=1){let t=l[e];t.avgLatencyMs=R(u.get(e)??[]),t.cacheHitRate=z(d.get(e)??[])}return l}function oe(e){let t=new Map;for(let n of e){let e=n.provider_id||`unknown-provider`,r=t.get(e)??[];r.push(n),t.set(e,r)}return[...t.entries()].map(([e,t])=>{let n=new Map;for(let e of t){let t=e.model||`Unknown model`,r=n.get(t)??[];r.push(e),n.set(t,r)}let r=B(t),i=[...n.entries()].map(([t,n])=>{let r=B(n);return{key:`${e}:${t}`,model:M(n[0]?.model??null),requestCount:r.requestCount,errorCount:r.errorCount,totalTokens:r.totalTokens,avgLatencyMs:r.avgLatencyMs,retryCount:r.retryCount,cacheRead:r.cacheRead,cacheWrite:r.cacheWrite,cacheHitRate:r.cacheHitRate,lastActivityAt:r.lastActivityAt}}).sort((e,t)=>t.requestCount-e.requestCount);return{key:e,providerLabel:j(t[0]?.provider_id??null,t[0]?.provider_name??null),requestCount:r.requestCount,errorCount:r.errorCount,totalTokens:r.totalTokens,avgLatencyMs:r.avgLatencyMs,retryCount:r.retryCount,cacheRead:r.cacheRead,cacheWrite:r.cacheWrite,cacheHitRate:r.cacheHitRate,lastActivityAt:r.lastActivityAt,models:i}}).sort((e,t)=>t.requestCount-e.requestCount)}function se(e,t,n){return n===`tokens`?t.totalTokens-e.totalTokens:n===`errors`?t.errorCount-e.errorCount:n===`latency`?(t.avgLatencyMs??-1)-(e.avgLatencyMs??-1):n===`cache_hit_rate`?(t.cacheHitRate??-1)-(e.cacheHitRate??-1):t.requestCount-e.requestCount}function ce(e,t,n,r,i){let a=new Map;for(let t of e){let e=t.tab_id||`unknown-tab`,n=a.get(e)??[];n.push(t),a.set(e,n)}let o=new Map;for(let e of t){let t=e.tab_id||`unknown-tab`;o.set(t,(o.get(t)??0)+1)}let s=new Map;for(let e of n)!e.tab_id||e.state!==`running`||s.set(e.tab_id,(s.get(e.tab_id)??0)+1);return[...new Set([...r.map(e=>e.id),...a.keys(),...o.keys()])].map(e=>{let t=r.find(t=>t.id===e)??null,n=B(a.get(e)??[]);return{key:e,tabId:t?.id??null,tabTitle:N(t?.title??a.get(e)?.[0]?.tab_title??null),requestCount:n.requestCount,errorCount:n.errorCount,totalTokens:n.totalTokens,avgLatencyMs:n.avgLatencyMs,compactCount:o.get(e)??0,runningAgents:s.get(e)??0,cacheRead:n.cacheRead,cacheWrite:n.cacheWrite,cacheHitRate:n.cacheHitRate}}).sort((e,t)=>se(e,t,i))}function le(e,t,n){let r=new Map;for(let t of e){let e=r.get(t.node_id)??[];e.push(t),r.set(t.node_id,e)}let i=new Map(t.map(e=>[e.id,e]));return[...new Set([...i.keys(),...r.keys()])].map(e=>{let t=i.get(e)??null,n=B(r.get(e)??[]);return{key:e,nodeId:e,agentLabel:P(t?.label??r.get(e)?.[0]?.node_label??null),roleName:t?.role_name??r.get(e)?.[0]?.role_name??null,tabTitle:N(t?.tab_title??r.get(e)?.[0]?.tab_title??null),requestCount:n.requestCount,errorCount:n.errorCount,totalTokens:n.totalTokens,avgLatencyMs:n.avgLatencyMs,cacheRead:n.cacheRead,cacheWrite:n.cacheWrite,cacheHitRate:n.cacheHitRate,state:t?.state??null}}).sort((e,t)=>se(e,t,n))}function ue(e,t){let n=[];for(let t of e){if(t.result===`error`){n.push({key:t.id,kind:`request_error`,endedAt:A(t.ended_at)??0,tabTitle:N(t.tab_title),agentLabel:P(t.node_label),providerLabel:j(t.provider_id,t.provider_name),modelLabel:M(t.model),result:t.result,retryCount:t.retry_count,errorSummary:t.error_summary??null,request:t});continue}t.retry_count>0&&n.push({key:t.id,kind:`request_retry`,endedAt:A(t.ended_at)??0,tabTitle:N(t.tab_title),agentLabel:P(t.node_label),providerLabel:j(t.provider_id,t.provider_name),modelLabel:M(t.model),result:t.result,retryCount:t.retry_count,errorSummary:t.error_summary??null,request:t})}for(let e of t)n.push({key:e.id,kind:`compact`,endedAt:A(e.ended_at)??0,tabTitle:N(e.tab_title),agentLabel:P(e.node_label),providerLabel:j(e.provider_id,e.provider_name),modelLabel:M(e.model),result:e.result,compact:e});return n.sort((e,t)=>t.endedAt-e.endedAt)}function de(e,t){return t===`tokens`?e.totalTokens:t===`errors`?e.errorCount:t===`latency`?e.avgLatencyMs:t===`compacts`?e.compactCount:t===`cache_read`?e.cacheRead:t===`cache_write`?e.cacheWrite:t===`cache_hit_rate`?e.cacheHitRate:e.requestCount}var fe={providerId:null,model:null,tabId:null,agentId:null},pe=`requests`,me=`requests`,he=[{value:`1h`,label:`1h`},{value:`24h`,label:`24h`},{value:`7d`,label:`7d`},{value:`30d`,label:`30d`}],W=`__all__`,ge=[{value:`requests`,label:`Requests`},{value:`tokens`,label:`Tokens`},{value:`errors`,label:`Errors`},{value:`latency`,label:`Latency`},{value:`compacts`,label:`Compacts`},{value:`cache_read`,label:`Cache Read`},{value:`cache_write`,label:`Cache Write`},{value:`cache_hit_rate`,label:`Cache Hit Rate`}],_e=[{value:`requests`,label:`Requests`},{value:`tokens`,label:`Tokens`},{value:`errors`,label:`Errors`},{value:`latency`,label:`Latency`},{value:`cache_hit_rate`,label:`Cache Hit Rate`}],G=`h-8 rounded-md bg-background/50 text-foreground`,K=`text-[10px] font-medium text-muted-foreground/80`;function q(e,t){return!!(t&&e.some(e=>e.value===t))}function J(e){return b(e,{fallback:`Unknown`})}function Y(e){return typeof e!=`number`||!Number.isFinite(e)?`N/A`:e.toLocaleString()}function X(e){return typeof e!=`number`||!Number.isFinite(e)?`N/A`:e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(2)} s`}function Z(e){return typeof e!=`number`||!Number.isFinite(e)?`Unavailable`:`${(e*100).toFixed(1)}%`}function ve(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n.requestCount>0||n.compactCount>0)return t}return Math.max(e.length-1,0)}function ye(e){return{requested_at:Date.now(),range:e,tabs:[],nodes:[],requests:[],compacts:[]}}function be(e,t){return{providerId:q(t.providers,e.providerId)?e.providerId:null,model:q(t.models,e.model)?e.model:null,tabId:q(t.tabs,e.tabId)?e.tabId:null,agentId:q(t.agents,e.agentId)?e.agentId:null}}function xe(e){return e.requests.length>0||e.compacts.length>0||e.nodes.some(e=>[`running`,`sleeping`,`initializing`,`error`].includes(e.state))}function Se(){let[e,t]=(0,D.useState)(`24h`),[n,r]=(0,D.useState)({...fe}),[i,a]=(0,D.useState)(pe),[o,s]=(0,D.useState)(me),[c,l]=(0,D.useState)(null),{data:u,error:d,isLoading:f,mutate:p}=y([`stats`,e],([,e])=>E(e),{keepPreviousData:!0}),m=u??ye(e),h=(0,D.useMemo)(()=>U(m),[m]),g=(0,D.useMemo)(()=>be(n,h),[h,n]),_=(0,D.useMemo)(()=>re(m,g),[g,m]);return{range:e,metric:i,sortKey:o,expandedEventId:c,filterOptions:h,effectiveFilters:g,overview:(0,D.useMemo)(()=>ie(m,g,_),[g,_,m]),buckets:(0,D.useMemo)(()=>ae(m.range,_.requests,_.compacts,m.requested_at),[_.compacts,_.requests,m.range,m.requested_at]),providerGroups:(0,D.useMemo)(()=>oe(_.requests),[_.requests]),tabGroups:(0,D.useMemo)(()=>ce(_.requests,_.compacts,_.nodes,_.tabs,o),[_.compacts,_.nodes,_.requests,_.tabs,o]),agentGroups:(0,D.useMemo)(()=>le(_.requests,_.nodes,o),[_.nodes,_.requests,o]),recentEvents:(0,D.useMemo)(()=>ue(_.requests,_.compacts),[_.compacts,_.requests]),hasVisibleStats:(0,D.useMemo)(()=>xe(_),[_]),isLoading:f,isInitialLoading:f&&!u,hasBlockingError:!!(d&&!u),hasRecoverableError:!!(d&&u),errorMessage:d instanceof Error?d.message:`Unknown error`,refresh:(0,D.useCallback)(async()=>{await p()},[p]),handleRangeChange:(0,D.useCallback)(e=>{t(e)},[]),handleMetricChange:(0,D.useCallback)(e=>{a(e)},[]),handleSortKeyChange:(0,D.useCallback)(e=>{s(e)},[]),handleFilterChange:(0,D.useCallback)((e,t)=>{r(n=>({...n,[e]:t===`__all__`?null:t}))},[]),toggleExpandedEvent:(0,D.useCallback)(e=>{l(t=>t===e?null:e)},[])}}var Q=n();function Ce(){return(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsx)(v,{children:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`div`,{className:`h-3 w-24 rounded-full skeleton-shimmer`}),(0,Q.jsx)(`div`,{className:`h-8 w-52 rounded-full skeleton-shimmer`})]}),(0,Q.jsx)(`div`,{className:`h-9 w-32 rounded-full skeleton-shimmer`})]})}),(0,Q.jsx)(`div`,{className:`grid gap-4 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Q.jsxs)(v,{className:`space-y-3`,children:[(0,Q.jsx)(`div`,{className:`h-3 w-20 rounded-full skeleton-shimmer`}),(0,Q.jsx)(`div`,{className:`h-8 w-28 rounded-full skeleton-shimmer`}),(0,Q.jsx)(`div`,{className:`h-3 w-32 rounded-full skeleton-shimmer`})]},t))}),(0,Q.jsxs)(v,{className:`space-y-4`,children:[(0,Q.jsx)(`div`,{className:`h-3 w-28 rounded-full skeleton-shimmer`}),(0,Q.jsx)(`div`,{className:`h-[220px] rounded-xl skeleton-shimmer`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading stats...`})]})]})}function we(){return(0,Q.jsxs)(v,{className:`flex min-h-[280px] flex-col items-center justify-center text-center`,children:[(0,Q.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-xl border border-border bg-accent/20 text-muted-foreground`,children:(0,Q.jsx)(l,{className:`size-5`})}),(0,Q.jsx)(`h2`,{className:`mt-5 text-xl font-medium text-foreground`,children:`No stats yet`})]})}function Te({message:e,onRetry:t}){return(0,Q.jsxs)(v,{className:`flex min-h-[280px] flex-col items-center justify-center text-center`,children:[(0,Q.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-xl border border-destructive/20 bg-destructive/10 text-destructive`,children:(0,Q.jsx)(s,{className:`size-5`})}),(0,Q.jsx)(`h2`,{className:`mt-5 text-xl font-medium text-foreground`,children:`Failed to load stats`}),(0,Q.jsx)(`p`,{className:`mt-2 max-w-xl text-[13px] leading-6 text-muted-foreground`,children:e}),(0,Q.jsx)(_,{type:`button`,variant:`outline`,className:`mt-5 border-border bg-accent/20 text-foreground hover:bg-accent/35`,onClick:t,children:`Retry`})]})}function Ee({title:e,value:t,icon:n,accentClassName:r}){return(0,Q.jsxs)(v,{className:`flex flex-col gap-4 py-4 min-h-[140px] justify-between`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:e}),(0,Q.jsx)(`div`,{className:h(`flex size-8 items-center justify-center rounded-md bg-accent/20 text-muted-foreground`,r),children:(0,Q.jsx)(n,{className:`size-4`})})]}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`div`,{className:`text-2xl font-semibold leading-none tracking-tight`,children:t})})]})}function De({buckets:e,metric:t}){let[n,r]=(0,D.useState)(()=>ve(e));if((0,D.useEffect)(()=>{r(ve(e))},[e]),e.length===0)return(0,Q.jsx)(`div`,{className:`flex h-[220px] items-center justify-center rounded-xl border border-border bg-card/30 text-[13px] text-muted-foreground`,children:`No trend data in the selected range.`});let i=e.map(e=>de(e,t)??0),a=t===`cache_hit_rate`?1:Math.max(1,...i,...e.map(e=>e.compactCount)),o=e[Math.min(n,e.length-1)]??e[0],s=1e3;s-36;let c=964/e.length;return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 rounded-xl border border-border bg-card/30 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:ge.find(e=>e.value===t)?.label}),(0,Q.jsxs)(`p`,{className:`mt-2 text-sm text-foreground`,children:[J(o.startMs),` to`,` `,J(o.endMs)]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-x-5 gap-y-2 text-[12px] text-muted-foreground sm:grid-cols-4`,children:[(0,Q.jsxs)(`span`,{children:[`Requests `,Y(o.requestCount)]}),(0,Q.jsxs)(`span`,{children:[`Failures `,Y(o.errorCount)]}),(0,Q.jsxs)(`span`,{children:[`Tokens `,Y(o.totalTokens)]}),(0,Q.jsxs)(`span`,{children:[`Compacts`,` `,Y(o.manualCompactCount+o.autoCompactCount)]}),(0,Q.jsxs)(`span`,{children:[`Cache Read `,Y(o.cacheRead)]}),(0,Q.jsxs)(`span`,{children:[`Cache Write `,Y(o.cacheWrite)]}),(0,Q.jsxs)(`span`,{children:[`Avg Latency `,X(o.avgLatencyMs)]}),(0,Q.jsxs)(`span`,{children:[`Hit Rate `,Z(o.cacheHitRate)]})]})]}),(0,Q.jsx)(`div`,{className:`rounded-xl border border-border bg-card/25 p-4`,children:(0,Q.jsxs)(`svg`,{viewBox:`0 0 ${s} 220`,className:`h-[220px] w-full`,children:[Array.from({length:5}).map((e,t)=>{let n=20+146/4*t;return(0,Q.jsx)(`line`,{x1:18,y1:n,x2:s-18,y2:n,stroke:`var(--graph-grid)`,strokeWidth:`1`},t)}),e.map((e,n)=>{let r=de(e,t)??0,i=e.manualCompactCount+e.autoCompactCount,o=t===`compacts`?i/a*146:r/a*146,s=18+n*c+c*.15,l=166-o;if(t===`compacts`){let t=a>0?e.manualCompactCount/a*146:0,n=a>0?e.autoCompactCount/a*146:0;return(0,Q.jsxs)(`g`,{children:[(0,Q.jsx)(`rect`,{x:s,y:166-n,width:Math.max(8,c*.7),height:Math.max(n,e.autoCompactCount>0?2:0),rx:`8`,fill:`var(--primary)`,fillOpacity:`0.78`}),(0,Q.jsx)(`rect`,{x:s,y:166-n-t,width:Math.max(8,c*.7),height:Math.max(t,e.manualCompactCount>0?2:0),rx:`8`,fill:`var(--graph-status-idle)`,fillOpacity:`0.78`})]},e.startMs)}let u=t===`errors`?`var(--graph-status-error)`:t===`latency`?`var(--graph-status-idle)`:t===`cache_hit_rate`?`var(--graph-status-running)`:t===`cache_read`||t===`cache_write`?`var(--primary)`:`var(--foreground)`;return(0,Q.jsx)(`rect`,{x:s,y:l,width:Math.max(8,c*.7),height:Math.max(o,r>0?2:0),rx:`10`,fill:u,fillOpacity:t===`errors`?`0.82`:`0.78`},e.startMs)}),e.map((e,t)=>{let i=18+t*c;return(0,Q.jsxs)(`g`,{children:[n===t?(0,Q.jsx)(`rect`,{x:i,y:12,width:c,height:162,rx:`14`,fill:`var(--accent)`,fillOpacity:`0.35`}):null,(0,Q.jsx)(`rect`,{x:i,y:10,width:c,height:168,fill:`transparent`,onMouseEnter:()=>r(t)})]},`${e.startMs}-overlay`)}),e.map((t,n)=>n===0||n===e.length-1||n%Math.max(1,Math.floor(e.length/6))===0?(0,Q.jsx)(`text`,{x:18+n*c+c*.5,y:208,textAnchor:`middle`,fill:`var(--muted-foreground)`,fillOpacity:`0.8`,fontSize:`10`,children:t.label},`${t.startMs}-label`):null)]})})]})}function $({title:e,action:t}){return(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`h2`,{className:`text-[15px] font-medium text-foreground`,children:e})}),t]})}function Oe({event:e}){if(e.kind===`compact`)return(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-xl border border-border bg-card/30 p-4 text-[12px] text-muted-foreground sm:grid-cols-2`,children:[(0,Q.jsxs)(`span`,{children:[`Trigger `,e.compact.trigger_type]}),(0,Q.jsxs)(`span`,{children:[`Duration `,X(e.compact.duration_ms)]}),(0,Q.jsxs)(`span`,{children:[`Result `,e.compact.result]}),(0,Q.jsxs)(`span`,{children:[`Error `,e.compact.error_summary||`None`]})]});let t=e.request.normalized_usage;return(0,Q.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-border bg-card/30 p-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 text-[12px] text-muted-foreground sm:grid-cols-3`,children:[(0,Q.jsxs)(`span`,{children:[`Duration `,X(e.request.duration_ms)]}),(0,Q.jsxs)(`span`,{children:[`Retries `,Y(e.request.retry_count)]}),(0,Q.jsxs)(`span`,{children:[`Result `,e.request.result]}),(0,Q.jsxs)(`span`,{children:[`Input `,Y(t?.input_tokens??null)]}),(0,Q.jsxs)(`span`,{children:[`Output `,Y(t?.output_tokens??null)]}),(0,Q.jsxs)(`span`,{children:[`Total `,Y(t?.total_tokens??null)]}),(0,Q.jsxs)(`span`,{children:[`Cache Read `,Y(t?.cache_read_tokens??null)]}),(0,Q.jsxs)(`span`,{children:[`Cache Write `,Y(t?.cache_write_tokens??null)]}),(0,Q.jsxs)(`span`,{children:[`Cache Hit Rate`,` `,Z(typeof t?.cache_read_tokens==`number`&&typeof t?.input_tokens==`number`&&t.input_tokens>0?t.cache_read_tokens/t.input_tokens:null)]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Normalized Usage`}),(0,Q.jsx)(`pre`,{className:`max-h-[240px] overflow-auto rounded-xl border border-border bg-background/50 p-4 text-[11px] leading-6 text-foreground/75`,children:JSON.stringify(e.request.normalized_usage??null,null,2)})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Raw Usage`}),(0,Q.jsx)(`pre`,{className:`max-h-[240px] overflow-auto rounded-xl border border-border bg-background/50 p-4 text-[11px] leading-6 text-foreground/75`,children:JSON.stringify(e.request.raw_usage??null,null,2)})]})]})]})}function ke(){let{range:e,metric:t,sortKey:n,expandedEventId:l,filterOptions:g,effectiveFilters:y,overview:b,buckets:E,providerGroups:D,tabGroups:O,agentGroups:k,recentEvents:A,hasVisibleStats:j,isLoading:M,isInitialLoading:N,hasBlockingError:P,hasRecoverableError:F,errorMessage:I,refresh:L,handleRangeChange:R,handleMetricChange:z,handleSortKeyChange:B,handleFilterChange:V,toggleExpandedEvent:H}=Se(),U=[{title:`Active Workflows`,value:Y(b.activeTabs),icon:i},{title:`Running Agents`,value:Y(b.runningAgents),icon:p},{title:`LLM Requests`,value:Y(b.llmRequests),icon:f},{title:`Total Tokens`,value:Y(b.totalTokens),icon:u},{title:`Error Rate`,value:Z(b.errorRate),icon:o,accentClassName:`text-destructive`},{title:`Avg Latency`,value:X(b.avgLatencyMs),icon:a,accentClassName:`text-graph-status-idle`},...b.hasCacheUsage?[{title:`Cache Read`,value:Y(b.cacheRead),icon:d,accentClassName:`text-graph-status-running`},{title:`Cache Write`,value:Y(b.cacheWrite),icon:r,accentClassName:`text-primary`},{title:`Cache Hit Rate`,value:Z(b.cacheHitRate),icon:c,accentClassName:`text-graph-status-running`}]:[]];return(0,Q.jsx)(ne,{className:`min-h-0`,children:(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-border px-6 py-5`,children:[(0,Q.jsx)(te,{title:`Stats`,hint:`Review system-wide runtime observability here instead of a single task conversation.`,actions:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:K,children:`Range`}),(0,Q.jsxs)(T,{value:e,onValueChange:R,children:[(0,Q.jsx)(S,{className:`w-[120px] ${G}`,children:(0,Q.jsx)(x,{placeholder:`Range`})}),(0,Q.jsx)(C,{children:he.map(e=>(0,Q.jsx)(w,{value:e.value,children:e.label},e.value))})]})]}),(0,Q.jsxs)(_,{type:`button`,variant:`outline`,className:`mt-5 border-border bg-accent/20 text-foreground hover:bg-accent/35`,onClick:()=>void L(),children:[(0,Q.jsx)(m,{className:h(`size-4`,M&&`animate-spin`)}),`Refresh`]})]}),className:`border-b-0 pb-0`}),(0,Q.jsxs)(`div`,{className:`mt-5 grid gap-3 md:grid-cols-2 xl:grid-cols-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`span`,{className:K,children:`Provider`}),(0,Q.jsxs)(T,{value:y.providerId??`__all__`,onValueChange:e=>V(`providerId`,e),children:[(0,Q.jsx)(S,{className:`w-full ${G}`,children:(0,Q.jsx)(x,{placeholder:`All Providers`})}),(0,Q.jsxs)(C,{children:[(0,Q.jsx)(w,{value:W,children:`All Providers`}),g.providers.map(e=>(0,Q.jsx)(w,{value:e.value,children:e.label},e.value))]})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`span`,{className:K,children:`Model`}),(0,Q.jsxs)(T,{value:y.model??`__all__`,onValueChange:e=>V(`model`,e),children:[(0,Q.jsx)(S,{className:`w-full ${G}`,children:(0,Q.jsx)(x,{placeholder:`All Models`})}),(0,Q.jsxs)(C,{children:[(0,Q.jsx)(w,{value:W,children:`All Models`}),g.models.map(e=>(0,Q.jsx)(w,{value:e.value,children:e.label},e.value))]})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`span`,{className:K,children:`Workflow`}),(0,Q.jsxs)(T,{value:y.tabId??`__all__`,onValueChange:e=>V(`tabId`,e),children:[(0,Q.jsx)(S,{className:`w-full ${G}`,children:(0,Q.jsx)(x,{placeholder:`All Workflows`})}),(0,Q.jsxs)(C,{children:[(0,Q.jsx)(w,{value:W,children:`All Workflows`}),g.tabs.map(e=>(0,Q.jsx)(w,{value:e.value,children:e.label},e.value))]})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`span`,{className:K,children:`Agent`}),(0,Q.jsxs)(T,{value:y.agentId??`__all__`,onValueChange:e=>V(`agentId`,e),children:[(0,Q.jsx)(S,{className:`w-full ${G}`,children:(0,Q.jsx)(x,{placeholder:`All Agents`})}),(0,Q.jsxs)(C,{children:[(0,Q.jsx)(w,{value:W,children:`All Agents`}),g.agents.map(e=>(0,Q.jsx)(w,{value:e.value,children:e.label},e.value))]})]})]})]})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-6`,children:N?(0,Q.jsx)(Ce,{}):P?(0,Q.jsx)(Te,{message:I,onRetry:()=>void L()}):j?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[F?(0,Q.jsx)(v,{className:`border-destructive/12 bg-destructive/6`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`div`,{className:`flex size-9 items-center justify-center rounded-xl border border-destructive/16 bg-destructive/10 text-destructive`,children:(0,Q.jsx)(s,{className:`size-4`})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Stats refresh failed`}),(0,Q.jsx)(`p`,{className:`text-[12px] text-muted-foreground`,children:`Showing the last successful response. Retry when ready.`})]})]}),(0,Q.jsx)(_,{type:`button`,variant:`outline`,className:`border-border bg-accent/20 text-foreground hover:bg-accent/35`,onClick:()=>void L(),children:`Retry`})]})}):null,(0,Q.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4`,children:U.map(e=>(0,Q.jsx)(Ee,{title:e.title,value:e.value,icon:e.icon,accentClassName:e.accentClassName},e.title))}),(0,Q.jsxs)(v,{className:`overflow-hidden`,children:[(0,Q.jsx)($,{title:`Trend`,action:(0,Q.jsxs)(T,{value:t,onValueChange:z,children:[(0,Q.jsx)(S,{className:`w-[180px] ${G}`,children:(0,Q.jsx)(x,{placeholder:`Metric`})}),(0,Q.jsx)(C,{children:ge.map(e=>(0,Q.jsx)(w,{value:e.value,children:e.label},e.value))})]})}),(0,Q.jsx)(De,{buckets:E,metric:t})]}),(0,Q.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-2`,children:[(0,Q.jsxs)(v,{className:`overflow-hidden`,children:[(0,Q.jsx)($,{title:`By Provider / Model`}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:D.length===0?(0,Q.jsx)(`div`,{className:`rounded-xl border border-border bg-card/30 px-4 py-6 text-[13px] text-muted-foreground`,children:`No request data matches the current scope.`}):D.map(e=>(0,Q.jsxs)(`div`,{className:`rounded-xl border border-border bg-card/30 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-[14px] font-medium text-foreground`,children:e.providerLabel}),(0,Q.jsxs)(`p`,{className:`mt-1 text-[12px] text-muted-foreground`,children:[`Requests `,Y(e.requestCount),` `,`· Errors `,Y(e.errorCount),` · Tokens `,Y(e.totalTokens),` · Avg `,X(e.avgLatencyMs),` · Retries `,Y(e.retryCount)]})]}),(0,Q.jsxs)(`div`,{className:`text-right text-[12px] text-muted-foreground`,children:[(0,Q.jsxs)(`p`,{children:[`Cache Read `,Y(e.cacheRead)]}),(0,Q.jsxs)(`p`,{children:[`Cache Write `,Y(e.cacheWrite)]}),(0,Q.jsxs)(`p`,{children:[`Hit Rate `,Z(e.cacheHitRate)]})]})]}),(0,Q.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.models.map(e=>(0,Q.jsxs)(`div`,{className:`grid gap-2 rounded-xl border border-border bg-accent/15 px-3.5 py-3 text-[12px] text-muted-foreground md:grid-cols-[minmax(0,1.2fr)_repeat(6,minmax(0,0.8fr))]`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:e.model}),(0,Q.jsxs)(`span`,{children:[`Req `,Y(e.requestCount)]}),(0,Q.jsxs)(`span`,{children:[`Err `,Y(e.errorCount)]}),(0,Q.jsxs)(`span`,{children:[`Tok `,Y(e.totalTokens)]}),(0,Q.jsxs)(`span`,{children:[`Avg `,X(e.avgLatencyMs)]}),(0,Q.jsxs)(`span`,{children:[`Cache `,Y(e.cacheRead)]}),(0,Q.jsxs)(`span`,{children:[`Hit `,Z(e.cacheHitRate)]})]},e.key))})]},e.key))})]}),(0,Q.jsx)(`div`,{className:`space-y-6`,children:(0,Q.jsxs)(v,{className:`overflow-hidden`,children:[(0,Q.jsx)($,{title:`By Workflow / Agent`,action:(0,Q.jsxs)(T,{value:n,onValueChange:B,children:[(0,Q.jsx)(S,{className:`w-[170px] ${G}`,children:(0,Q.jsx)(x,{placeholder:`Sort`})}),(0,Q.jsx)(C,{children:_e.map(e=>(0,Q.jsx)(w,{value:e.value,children:e.label},e.value))})]})}),(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground/80`,children:`Tabs`}),O.length===0?(0,Q.jsx)(`div`,{className:`rounded-xl border border-border bg-card/30 px-4 py-6 text-[13px] text-muted-foreground`,children:`No matching tab aggregates.`}):O.map(e=>(0,Q.jsxs)(`div`,{className:`grid gap-2 rounded-xl border border-border bg-card/30 px-4 py-3 text-[12px] text-muted-foreground md:grid-cols-[minmax(0,1.15fr)_repeat(6,minmax(0,0.75fr))]`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:e.tabTitle}),(0,Q.jsxs)(`span`,{children:[`Req `,Y(e.requestCount)]}),(0,Q.jsxs)(`span`,{children:[`Err `,Y(e.errorCount)]}),(0,Q.jsxs)(`span`,{children:[`Tok `,Y(e.totalTokens)]}),(0,Q.jsxs)(`span`,{children:[`Cmp `,Y(e.compactCount)]}),(0,Q.jsxs)(`span`,{children:[`Run `,Y(e.runningAgents)]}),(0,Q.jsxs)(`span`,{children:[`Hit `,Z(e.cacheHitRate)]})]},e.key))]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground/80`,children:`Agents`}),k.length===0?(0,Q.jsx)(`div`,{className:`rounded-xl border border-border bg-card/30 px-4 py-6 text-[13px] text-muted-foreground`,children:`No matching agent aggregates.`}):k.map(e=>(0,Q.jsxs)(`div`,{className:`grid gap-2 rounded-xl border border-border bg-card/30 px-4 py-3 text-[12px] text-muted-foreground md:grid-cols-[minmax(0,1.1fr)_minmax(0,0.8fr)_repeat(5,minmax(0,0.72fr))]`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`truncate font-medium text-foreground`,children:e.agentLabel}),(0,Q.jsxs)(`p`,{className:`truncate text-[11px] text-muted-foreground/80`,children:[e.roleName||`No role`,` ·`,` `,e.tabTitle]})]}),(0,Q.jsx)(`span`,{className:h(`inline-flex h-fit w-fit rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.12em]`,e.state?ee[e.state]:`border-border bg-accent/25 text-muted-foreground`),children:e.state||`unknown`}),(0,Q.jsxs)(`span`,{children:[`Req `,Y(e.requestCount)]}),(0,Q.jsxs)(`span`,{children:[`Err `,Y(e.errorCount)]}),(0,Q.jsxs)(`span`,{children:[`Tok `,Y(e.totalTokens)]}),(0,Q.jsxs)(`span`,{children:[`Avg `,X(e.avgLatencyMs)]}),(0,Q.jsxs)(`span`,{children:[`Cache `,Y(e.cacheRead)]}),(0,Q.jsxs)(`span`,{children:[`Hit `,Z(e.cacheHitRate)]})]},e.key))]})]})]})})]}),(0,Q.jsxs)(v,{className:`overflow-hidden`,children:[(0,Q.jsx)($,{title:`Recent Events`}),(0,Q.jsx)(`div`,{className:`space-y-2`,children:A.length===0?(0,Q.jsx)(`div`,{className:`rounded-xl border border-border bg-card/30 px-4 py-6 text-[13px] text-muted-foreground`,children:`No recent events match the current scope.`}):A.map(e=>{let t=l===e.key,n=``;return n=e.kind===`compact`?`${e.compact.trigger_type} compact ${e.compact.result}`:e.kind===`request_error`?`Request failed${e.retryCount>0?` after ${e.retryCount} retries`:``}`:`Retried ${e.retryCount} time${e.retryCount===1?``:`s`}`,(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(_,{type:`button`,variant:`ghost`,className:`grid h-auto w-full gap-3 rounded-xl border border-border bg-card/30 px-4 py-3 text-left text-[12px] text-muted-foreground hover:bg-accent/20 hover:text-inherit md:grid-cols-[minmax(0,1fr)_minmax(0,1.05fr)_minmax(0,1.2fr)_minmax(0,1.2fr)_minmax(0,1.25fr)]`,onClick:()=>H(e.key),children:[(0,Q.jsx)(`span`,{className:`text-foreground/85`,children:J(e.endedAt)}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.tabTitle}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.agentLabel}),(0,Q.jsxs)(`span`,{className:`truncate`,children:[e.providerLabel,` / `,e.modelLabel]}),(0,Q.jsx)(`span`,{className:h(`truncate`,e.kind===`request_error`?`text-destructive`:e.kind===`compact`?`text-graph-status-idle`:`text-graph-status-running`),children:n})]}),t?(0,Q.jsx)(Oe,{event:e}):null]},e.key)})})]})]}):(0,Q.jsx)(we,{})})]})})}export{ke as StatsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BYbx6iT9.js";import{d as t,l as n}from"./graph-vendor-DRq_-6fV.js";import{B as r,Ct as i,Ft as a,H as o,J as s,Lt as c,Nt as l,Pt as u,Q as d,St as f,Tt as p,U as m,Wt as h,Z as g,_t as _,ct as v,et as y,jt as b,kt as x,rn as S}from"./ui-vendor-Dg9NNnWX.js";import{a as C,t as w}from"./shared-CMxbpLeQ.js";import{Z as T}from"./index-CL1ALZ3r.js";import{n as E,o as D,t as O}from"./PageScaffold-D4jO9ooX.js";async function k(){return w(`/api/tools`,{errorMessage:`Failed to fetch tools`,fallback:[],map:e=>e?.tools??[]})}var A=e(t(),1),j=n(),M=`inline-flex h-5 shrink-0 items-center rounded-full border border-border bg-accent/20 px-2.5 text-[11px] font-medium text-muted-foreground`,N={send:y,idle:h,sleep:h,todo:f,contacts:_,list_tools:r,list_roles:o,list_workflows:p,exec:s,read:u,edit:a,fetch:x,create_workflow:l,create_agent:b,connect:i,set_permissions:g,manage_providers:v,manage_roles:m,manage_settings:d,manage_prompts:c};function P({expanded:e,onToggle:t,tool:n}){let i=N[n.name]??r;return(0,j.jsxs)(`div`,{onClick:t,title:n.description,className:C(`group cursor-pointer rounded-xl border border-border bg-card/30 p-5 shadow-none transition-colors duration-300 hover:border-ring/25 hover:bg-accent/20 hover:shadow-sm`,e&&`border-border bg-accent/20 shadow-sm`),children:[(0,j.jsx)(`div`,{className:`mb-4 flex size-10 items-center justify-center rounded-xl border border-border bg-accent/25 transition-colors group-hover:bg-accent/40`,children:(0,j.jsx)(i,{className:`size-4.5 text-foreground/80`})}),(0,j.jsx)(`code`,{className:`block text-[13px] font-mono font-medium text-foreground`,children:n.name}),(0,j.jsx)(`p`,{className:`mt-2 text-[10px] text-muted-foreground/75`,children:n.source===`mcp`?`MCP · ${n.server_name??`unknown`}`:`Builtin`}),(0,j.jsx)(`p`,{className:`mt-2 text-[12px] leading-relaxed text-muted-foreground`,children:n.description}),(0,j.jsx)(T,{initial:!1,children:e?(0,j.jsx)(S.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:[.22,1,.36,1]},className:`overflow-hidden`,onClick:e=>e.stopPropagation(),children:(0,j.jsxs)(`div`,{className:`mt-4 border-t border-border pt-4`,children:[n.source===`mcp`?(0,j.jsxs)(`div`,{className:`mb-4 space-y-2 text-[11px] text-muted-foreground`,children:[(0,j.jsxs)(`div`,{children:[`Raw Tool Name`,` `,(0,j.jsx)(`code`,{className:`font-mono text-foreground/82`,children:n.tool_name??`unknown`})]}),(0,j.jsxs)(`div`,{children:[`Fully Qualified ID`,` `,(0,j.jsx)(`code`,{className:`font-mono text-foreground/82`,children:n.fully_qualified_id??n.name})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n.read_only_hint?(0,j.jsx)(`span`,{className:`rounded-full border border-primary/15 bg-primary/10 px-2 py-1 text-[10px] text-primary`,children:`readOnly`}):null,n.destructive_hint?(0,j.jsx)(`span`,{className:`rounded-full border border-destructive/20 bg-destructive/10 px-2 py-1 text-[10px] text-destructive`,children:`destructive`}):null,n.open_world_hint?(0,j.jsx)(`span`,{className:`rounded-full border border-graph-status-idle/20 bg-graph-status-idle/[0.12] px-2 py-1 text-[10px] text-graph-status-idle`,children:`openWorld`}):null]})]}):null,(0,j.jsx)(`p`,{className:`mb-2 text-[10px] font-medium text-muted-foreground/75`,children:`Parameters`}),(0,j.jsx)(`pre`,{className:`max-h-48 select-text overflow-auto rounded-xl border border-border bg-background/50 p-3.5 text-[11px] font-mono text-foreground/70 scrollbar-none`,children:JSON.stringify(n.parameters??{},null,2)})]})}):null})]})}function F(){let{data:e=[],isLoading:t}=D(`tools`,k),[n,i]=(0,A.useState)(new Set),a=e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,j.jsx)(O,{children:(0,j.jsxs)(`div`,{className:`flex h-full flex-col px-8 pt-6`,children:[(0,j.jsx)(E,{title:`Tools`}),(0,j.jsxs)(`div`,{className:`mb-6 mt-6 flex items-center justify-between gap-4`,children:[(0,j.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Built-in and connected MCP tools appear here.`}),(0,j.jsxs)(`span`,{className:M,children:[e.length,` tools`]})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-2 scrollbar-none`,children:t?(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-4 lg:grid-cols-3`,children:[...[,,,,,,]].map((e,t)=>(0,j.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-border bg-accent/20`},t))}):e.length===0?(0,j.jsxs)(S.div,{initial:{opacity:0},animate:{opacity:1},className:`flex h-full flex-col items-center justify-center text-center`,children:[(0,j.jsx)(`div`,{className:`flex size-14 items-center justify-center rounded-xl border border-border bg-accent/20 shadow-sm`,children:(0,j.jsx)(r,{className:`size-6 text-muted-foreground`})}),(0,j.jsx)(`h3`,{className:`mt-5 text-[15px] font-medium text-foreground`,children:`No Tools Available`}),(0,j.jsx)(`p`,{className:`mt-1.5 text-[13px] text-muted-foreground`,children:`Connect an MCP server to expand this catalog.`})]}):(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-4 lg:grid-cols-3 pb-8`,children:e.map((e,t)=>(0,j.jsx)(S.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:t*.03},children:(0,j.jsx)(P,{tool:e,expanded:n.has(e.name),onToggle:()=>a(e.name)})},e.name))})})]})})}export{F as ToolsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as e}from"./graph-vendor-DRq_-6fV.js";import{z as t}from"./ui-vendor-Dg9NNnWX.js";import{a as n}from"./shared-CMxbpLeQ.js";import{J as r}from"./index-CL1ALZ3r.js";import{a as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./dialog-BeGSweF6.js";var d=e();function f({open:e,onOpenChange:f,title:p,children:m,footer:h,className:g}){return(0,d.jsx)(u,{open:e,onOpenChange:f,children:(0,d.jsx)(c,{className:n(`flex max-h-[calc(100svh-2rem)] flex-col p-0`,g),children:(0,d.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col overflow-hidden p-6`,children:[(0,d.jsx)(`div`,{className:`pointer-events-none absolute inset-0 bg-gradient-to-b from-foreground/[0.04] to-transparent opacity-50`}),(0,d.jsx)(o,{asChild:!0,children:(0,d.jsx)(r,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Close dialog`,className:`absolute right-4 top-4 z-20 size-7 rounded-md bg-accent/45 text-muted-foreground hover:bg-accent/65 hover:text-accent-foreground`,children:(0,d.jsx)(t,{className:`size-3.5`})})}),(0,d.jsxs)(s,{className:`relative z-10 shrink-0 pr-8`,children:[(0,d.jsx)(l,{className:`text-[1.1rem] font-medium text-foreground`,children:p}),(0,d.jsx)(a,{className:`sr-only`,children:p})]}),(0,d.jsx)(`div`,{className:`relative z-10 mt-6 min-h-0 flex-1 space-y-4 overflow-y-auto pr-1 scrollbar-none`,"data-testid":`workspace-command-dialog-body`,children:m}),(0,d.jsx)(i,{className:`relative z-10 mt-6 shrink-0 border-t border-border pt-4`,children:h})]})})})}function p({label:e,hint:t,children:n}){return(0,d.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,d.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,d.jsx)(`span`,{className:`text-sm font-medium text-foreground/80`,children:e}),t?(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t}):null]}),n]})}function m({children:e}){return(0,d.jsx)(`div`,{className:`rounded-lg border border-border bg-accent/35 px-3.5 py-2.5 text-xs text-muted-foreground`,children:e})}export{p as n,m as r,f as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BYbx6iT9.js";import{d as t,l as n}from"./graph-vendor-DRq_-6fV.js";import{$t as r,B as i,Ht as a,J as o,Jt as s,Kt as c,Ot as l,R as u,V as d,X as f,Xt as p,Y as m,Z as h,en as g,et as _,mt as v,pt as y,rn as b,rt as x,tn as S,vt as C,xt as w,z as T}from"./ui-vendor-Dg9NNnWX.js";import{a as E,t as D}from"./shared-CMxbpLeQ.js";import{F as O,I as k,J as A,K as ee,M as j,N as M,P as N,Z as P,_ as F,b as I,g as L,h as te,m as ne,p as re,q as ie,s as R,v as ae,x as z}from"./index-CL1ALZ3r.js";import{n as B,t as oe}from"./markdown-vendor-DVdy_w12.js";import{t as se}from"./badge-74-3jsCg.js";import{t as V}from"./constants-XUzFf6i1.js";function ce(e){return`/api/image-assets/${encodeURIComponent(e)}`}async function le(e){let t=new FormData;return t.append(`file`,e),D(`/api/image-assets`,{method:`POST`,body:t,errorMessage:`Failed to upload image`})}var H=e(t(),1),U=n();function ue({assetId:e,alt:t,mimeType:n,width:r,height:i,compact:a=!1}){let{openImage:o}=k(),s=ce(e),c=typeof r==`number`&&r>0&&typeof i==`number`&&i>0?`${r} / ${i}`:void 0,l=`${n||`image asset`}${r&&i?` · ${r}x${i}`:``}`;return(0,U.jsx)(U.Fragment,{children:(0,U.jsxs)(A,{type:`button`,variant:`ghost`,onClick:()=>o({src:s,alt:t,meta:l,width:r,height:i}),className:E(`group h-auto w-full flex-col items-stretch overflow-hidden rounded-xl border border-border bg-accent/20 p-0 text-left transition-colors hover:bg-accent/30 hover:text-inherit`,a?`max-w-[240px]`:`max-w-[360px]`),children:[(0,U.jsx)(`div`,{style:c?{aspectRatio:c}:void 0,className:E(`relative overflow-hidden bg-background/45`,a?`min-h-[132px]`:`min-h-[180px]`),children:(0,U.jsx)(`img`,{alt:t||`Image`,className:`h-full w-full object-cover`,loading:`lazy`,src:s})}),(0,U.jsxs)(`div`,{className:`space-y-1 px-3 py-2.5`,children:[(0,U.jsx)(`div`,{className:`text-[12px] font-medium text-foreground`,children:t||`Image`}),(0,U.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:l})]})]})})}function W({content:e,className:t}){return(0,U.jsx)(`div`,{className:E(`min-w-0 max-w-full select-text overflow-hidden break-words [overflow-wrap:anywhere]`,t),children:(0,U.jsx)(B,{remarkPlugins:[oe],components:{p:({children:e})=>(0,U.jsx)(`p`,{className:`mb-1.5 last:mb-0 whitespace-pre-wrap`,children:e}),code:({children:e,className:t})=>t?(0,U.jsx)(`code`,{className:`block font-mono text-[0.9em] text-foreground/80`,children:e}):(0,U.jsx)(`code`,{className:`rounded bg-surface-3 px-1 py-0.5 font-mono text-[0.9em] text-foreground/90 break-all`,children:e}),pre:({children:e})=>(0,U.jsx)(`pre`,{className:`mb-1.5 max-w-full overflow-x-auto rounded bg-surface-1 p-2 text-[0.9em] leading-relaxed`,children:e}),a:({href:e,children:t})=>(0,U.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary underline hover:text-primary/80`,children:t}),ul:({children:e})=>(0,U.jsx)(`ul`,{className:`mb-1.5 list-disc pl-4 space-y-0.5`,children:e}),ol:({children:e})=>(0,U.jsx)(`ol`,{className:`mb-1.5 list-decimal pl-4 space-y-0.5`,children:e}),li:({children:e})=>(0,U.jsx)(`li`,{className:`leading-relaxed`,children:e}),strong:({children:e})=>(0,U.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e}),em:({children:e})=>(0,U.jsx)(`em`,{className:`italic text-foreground/80`,children:e}),blockquote:({children:e})=>(0,U.jsx)(`blockquote`,{className:`mb-1.5 border-l-2 border-muted-foreground pl-3 text-muted-foreground italic`,children:e}),table:({children:e})=>(0,U.jsx)(`div`,{className:`mb-1.5 overflow-x-auto`,children:(0,U.jsx)(`table`,{className:`w-full border-collapse text-xs`,children:e})}),th:({children:e})=>(0,U.jsx)(`th`,{className:`border border-border bg-surface-2 px-2 py-1 text-left font-semibold text-foreground`,children:e}),td:({children:e})=>(0,U.jsx)(`td`,{className:`border border-border px-2 py-1 text-foreground/80`,children:e}),h1:({children:e})=>(0,U.jsx)(`h1`,{className:`mb-1.5 text-base font-bold text-foreground`,children:e}),h2:({children:e})=>(0,U.jsx)(`h2`,{className:`mb-1.5 text-sm font-bold text-foreground`,children:e}),h3:({children:e})=>(0,U.jsx)(`h3`,{className:`mb-1.5 text-xs font-bold text-foreground/90`,children:e})},children:e})})}function G(e){if(e==null)return null;if(typeof e==`string`){let t=e.trim();if(!t||!t.startsWith(`{`)&&!t.startsWith(`[`))return null;try{return JSON.stringify(JSON.parse(t),null,4)}catch{return null}}if(typeof e==`object`)try{return JSON.stringify(e,null,4)}catch{return String(e)}return null}function K({content:e,layout:t=`parts-order`,parts:n,streaming:r,markdownClassName:i,preClassName:a}){let o=z(n,e),s=o.some(e=>e.type===`image`),c=I(o,e),l=G(c);if(t===`human-attachments-top`&&s){let e=o.filter(e=>e.type===`text`);return(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsx)(`div`,{className:`flex flex-wrap gap-2.5`,children:o.filter(e=>e.type===`image`).map((e,t)=>(0,U.jsx)(ue,{alt:e.alt,assetId:e.asset_id,compact:!0,height:e.height,mimeType:e.mime_type,width:e.width},`${t}-attachment-${e.asset_id}`))}),e.length>0?(0,U.jsx)(K,{content:I(e),markdownClassName:i,preClassName:a,parts:e,streaming:r}):null]})}return l?(0,U.jsx)(`pre`,{className:E(`select-text whitespace-pre-wrap break-words rounded-xl border border-border bg-background/40 px-3.5 py-3 text-[11px] font-mono leading-relaxed text-foreground/80`,a),children:(0,U.jsx)(q,{text:l,streaming:r})}):o.length>0&&s?(0,U.jsx)(`div`,{className:`space-y-3`,children:o.map((e,t)=>e.type===`text`?(0,U.jsx)(K,{content:e.text,markdownClassName:i,preClassName:a},`${t}-text`):(0,U.jsx)(ue,{alt:e.alt,assetId:e.asset_id,height:e.height,mimeType:e.mime_type,width:e.width},`${t}-image-${e.asset_id}`))}):r?(0,U.jsx)(`div`,{className:E(`min-w-0 select-text whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,i),children:(0,U.jsx)(q,{text:c,streaming:!0})}):(0,U.jsx)(`div`,{className:`min-w-0`,children:(0,U.jsx)(W,{content:c,className:i})})}function q({text:e,streaming:t}){return(0,U.jsxs)(U.Fragment,{children:[e,t?(0,U.jsx)(`span`,{className:`streaming-cursor`}):null]})}var J=[{name:`/clear`,description:`Clear the current Assistant chat history.`,usage:`/clear`},{name:`/compact`,description:`Compact the current execution context.`,usage:`/compact [focus]`},{name:`/help`,description:`Show the built-in Assistant commands and usage.`,usage:`/help`}],de=/^\/\S*/;function Y(e){let t=e.trimStart(),n=e.slice(0,e.length-t.length),r=t.match(de)?.[0]??`/`;return{leadingWhitespace:n,trimmedStart:t,token:r,suffix:t.slice(r.length)}}function fe(e,t){return t<=0?0:Math.min(e,t-1)}function pe(e){let{trimmedStart:t,token:n}=Y(e);return t.startsWith(`/`)?{filtered:n===`/`?J:J.filter(e=>e.name.startsWith(n)),isCommandInput:!0,token:n}:{filtered:[],isCommandInput:!1,token:``}}function X(e,t,n){let r=t.token===n?fe(t.index,e.length):0;return{selectedCommand:e[Math.min(r,Math.max(e.length-1,0))]??null,selectedCommandIndex:r}}function me(e,t,n,r){if(e.length===0)return{index:0,token:n};let{selectedCommandIndex:i}=X(e,t,n);return{index:(i+r+e.length)%e.length,token:n}}function he(e,t){let{trimmedStart:n,token:r}=Y(e);return r===t&&(n===t||n.startsWith(`${t} `))}function ge(e,t){let{leadingWhitespace:n,suffix:r}=Y(e);return r?`${n}${t.name}${r.startsWith(` `)?r:` ${r}`}`:`${n}${t.name} `}function _e({busy:e=!1,commandsEnabled:t=!0,disabled:n,images:r=[],imageInputEnabled:i=!0,input:a,onAddImages:o=()=>{},onChange:s,onNavigateHistory:c,onKeyDown:u,onRemoveImage:d=()=>{},onSend:f,onStop:p,overlay:h=!1,targetLabel:g=`Assistant`,stopping:_=!1,suppressCommandNavigation:v=!1,variant:y}){let b=y===`workspace`,x=y===`page`,C=(0,H.useRef)(null),w=(0,H.useRef)(null),T=e?_?`Stopping...`:`Stop`:`Send`,D=e?_||!p:n,{filtered:O,isCommandInput:k,token:j}=t?pe(a):{filtered:[],isCommandInput:!1,token:``},[M,N]=(0,H.useState)({index:0,token:``}),[P,F]=(0,H.useState)(null),I=t&&r.length===0&&k&&P!==j,{selectedCommand:L,selectedCommandIndex:te}=X(O,M,j);(0,H.useLayoutEffect)(()=>{let e=C.current;if(!e)return;let t=window.getComputedStyle(e),n=Number.parseFloat(t.lineHeight)||20,r=Number.parseFloat(t.paddingTop)||0,i=Number.parseFloat(t.paddingBottom)||0,a=n+r+i,o=n*(b?8:7)+r+i;e.style.height=`0px`;let s=Math.min(Math.max(e.scrollHeight,a),o);e.style.height=`${s}px`,e.style.overflowY=e.scrollHeight>o?`auto`:`hidden`},[a,b]);let ne=e=>{let n=t?pe(e):{isCommandInput:!1,token:``};n.isCommandInput?n.token!==j&&(N({index:0,token:n.token}),P&&P!==n.token&&F(null)):(F(null),N({index:0,token:``})),s(e)},re=e=>{s(ge(a,e)),N({index:0,token:e.name}),F(null),C.current?.focus()},R=()=>{F(null),N({index:0,token:``})};return(0,U.jsxs)(`div`,{className:E(h?`w-full pointer-events-auto`:E(`border-t border-border`,b?`p-2.5`:`px-3.5 py-2.5`)),children:[I?(0,U.jsx)(`div`,{role:`listbox`,"aria-label":`Assistant commands`,className:E(`pointer-events-auto mb-2 overflow-hidden rounded-xl border`,b?`border-border bg-surface-overlay shadow-sm`:`border-border bg-popover shadow-sm`),children:O.length>0?O.map((e,t)=>{let n=t===te;return(0,U.jsxs)(A,{type:`button`,variant:`ghost`,role:`option`,"aria-selected":n,onMouseDown:t=>{t.preventDefault(),re(e)},className:E(`h-auto w-full items-start justify-start gap-3 rounded-none px-3 py-2.5 text-left whitespace-normal transition-colors`,n?`bg-accent/60 hover:bg-accent/60`:`hover:bg-accent/35`),children:[(0,U.jsx)(`span`,{className:`mt-0.5 shrink-0 rounded-full border border-border bg-accent/45 px-2 py-0.5 font-mono text-[11px] text-foreground`,children:e.name}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block text-[12px] font-medium text-foreground`,children:e.description}),(0,U.jsx)(`span`,{className:`mt-1 block font-mono text-[11px] text-muted-foreground`,children:e.usage})]})]},e.name)}):(0,U.jsx)(`div`,{className:`px-3 py-3 text-[12px] text-muted-foreground`,children:`No matching commands.`})}):null,(0,U.jsxs)(`div`,{className:E(`border transition-[border-color,background-color,box-shadow] duration-200`,b?`rounded-md border-border bg-background/30 px-2 py-1 shadow-sm hover:border-ring/35 focus-within:border-ring/45 focus-within:ring-[3px] focus-within:ring-ring/35`:x?`rounded-[20px] border-border bg-surface-2 px-3 py-2 shadow-sm hover:border-ring/30 focus-within:border-ring/40 focus-within:ring-[3px] focus-within:ring-ring/30`:`rounded-md border-border bg-surface-2/90 px-2 py-1 shadow-sm hover:border-ring/30 focus-within:border-ring/40 focus-within:ring-[3px] focus-within:ring-ring/30`),children:[r.length>0?(0,U.jsx)(`div`,{className:`flex flex-wrap gap-2 border-b border-border px-0.5 py-2`,children:r.map(e=>(0,U.jsx)(ye,{image:e,onRemove:()=>d(e.id)},e.id))}):null,(0,U.jsxs)(`div`,{className:`grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-1`,children:[(0,U.jsx)(ie,{ref:w,accept:`image/png,image/jpeg,image/gif,image/webp`,className:`hidden`,multiple:!0,onChange:e=>{e.target.files&&e.target.files.length>0&&(R(),o(e.target.files)),e.currentTarget.value=``},type:`file`}),(0,U.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":i?`Add images`:`Current model does not support image input`,disabled:!i,onClick:()=>w.current?.click(),className:E(`shrink-0 rounded-full transition-colors disabled:opacity-35`,i?`bg-accent/55 text-foreground hover:bg-accent`:`bg-accent/20 text-muted-foreground`),children:(0,U.jsx)(l,{className:`size-4`})}),(0,U.jsx)(ee,{ref:C,value:a,onChange:e=>ne(e.target.value),onKeyDown:e=>{if((e.key===`ArrowUp`||e.key===`ArrowDown`)&&c&&c(e.key===`ArrowUp`?-1:1,{start:e.currentTarget.selectionStart,end:e.currentTarget.selectionEnd})){e.preventDefault();return}if(v&&I&&(e.key===`ArrowUp`||e.key===`ArrowDown`)){u(e);return}if(I){let t=O.length>0&&L&&!he(a,L.name)?L:null;if(e.key===`Escape`){e.preventDefault(),F(j);return}if(O.length>0&&e.key===`ArrowDown`){e.preventDefault(),N(me(O,M,j,1));return}if(O.length>0&&e.key===`ArrowUp`){e.preventDefault(),N(me(O,M,j,-1));return}if(t&&e.key===`Tab`&&!e.shiftKey){e.preventDefault(),re(t);return}if(t&&e.key===`Enter`&&!e.shiftKey){e.preventDefault(),re(t);return}}u(e)},onPaste:e=>{let t=ve(e.clipboardData?.items);t.length===0||!i||(e.preventDefault(),R(),o(t))},placeholder:t?`Message ${g} or type / for commands`:`Message ${g}`,rows:1,className:E(`min-h-5 w-full resize-none self-center border-0 bg-transparent px-0.5 py-0 text-[13px] leading-5 text-foreground shadow-none placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0`,`rounded-sm`)}),(0,U.jsxs)(A,{type:`button`,variant:b&&!e?`default`:`ghost`,size:b?`sm`:`icon-sm`,onClick:e?p:f,disabled:D,"aria-label":e?`Stop ${g}`:`Send ${g} message`,className:E(`shrink-0 rounded-full transition-all duration-300 active:scale-[0.96] disabled:opacity-30`,b?`h-8 gap-1.5 px-3.5`:`bg-accent/70 p-0 text-foreground hover:bg-accent`,e?`bg-destructive/18 text-destructive hover:bg-destructive/24`:b?`bg-primary text-primary-foreground hover:bg-primary/90`:``),children:[e?(0,U.jsx)(m,{className:`size-3.5 fill-current`,strokeWidth:2.4}):(0,U.jsx)(S,{className:`size-4`,strokeWidth:2.5}),b?(0,U.jsx)(`span`,{className:`text-[11px] font-medium`,children:T}):null]})]})]}),i?null:(0,U.jsx)(`div`,{className:`px-1.5 pt-2 text-[11px] text-muted-foreground`,children:`Current model does not support image input.`})]})}function ve(e){return e?Array.from(e).filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).flatMap(e=>{let t=e.getAsFile();return t?[t]:[]}):[]}function ye({image:e,onRemove:t}){let{openImage:n}=k(),r=e.status===`uploading`?`Uploading...`:e.width&&e.height?`${e.width}x${e.height}`:`Ready`;return(0,U.jsxs)(`div`,{className:`relative overflow-hidden rounded-lg border border-border bg-background/35 transition-colors hover:border-ring/35`,children:[(0,U.jsxs)(A,{"aria-label":`Preview ${e.name}`,type:`button`,variant:`ghost`,className:`h-auto w-auto items-start justify-start rounded-none p-0 text-left hover:bg-transparent hover:text-inherit`,onClick:()=>n({src:e.previewUrl,alt:e.name,meta:r,width:e.width,height:e.height}),children:[(0,U.jsx)(`img`,{alt:e.name,className:`h-20 w-20 object-cover`,src:e.previewUrl}),(0,U.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 bg-background/80 px-2 py-1 text-[10px] text-foreground/84`,children:[(0,U.jsx)(`div`,{className:`truncate`,children:e.name}),(0,U.jsx)(`div`,{className:`text-muted-foreground`,children:r})]})]}),(0,U.jsx)(A,{"aria-label":`Remove ${e.name}`,type:`button`,variant:`ghost`,size:`icon-xs`,className:`absolute right-1 top-1 z-10 rounded-full bg-background/72 text-muted-foreground hover:bg-background/90 hover:text-foreground`,onClick:t,children:(0,U.jsx)(T,{className:`size-3.5`})})]})}function Z({text:e,className:t,iconClassName:n,copiedClassName:r}){let[i,o]=(0,H.useState)(!1),s=(0,H.useRef)(null),c=(0,H.useRef)(!0);return(0,H.useEffect)(()=>()=>{c.current=!1,s.current&&clearTimeout(s.current)},[]),(0,U.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-xs`,onClick:t=>{t.stopPropagation(),navigator.clipboard.writeText(e).then(()=>{c.current&&(o(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{c.current&&o(!1)},1500))})},"aria-label":`Copy`,className:E(`size-5 rounded p-0.5 text-muted-foreground opacity-0 transition-all hover:bg-accent/45 hover:text-foreground group-hover:opacity-100`,t),title:`Copy`,children:i?(0,U.jsx)(p,{className:E(`size-3 text-foreground`,r)}):(0,U.jsx)(a,{className:E(`size-3`,n)})})}var be=(0,H.memo)(function({allowHumanMessageRetry:e=!0,bottomInset:t=0,scrollRef:n,items:r,nodes:i,onRetryHumanMessage:a,onScroll:o,retryImageInputEnabled:s=!0,retryingMessageId:c=null,runningHint:l=null,variant:u}){let d=u===`workspace`,f=u===`floating`,p=u===`page`,m=d?14:16,h=r.filter(e=>e.type!==`SystemEntry`&&e.type!==`StateEntry`);return(0,U.jsxs)(`div`,{ref:n,onScroll:o,style:{paddingBottom:`${m+t}px`,scrollPaddingBottom:`${m+t}px`},className:E(`flex-1 space-y-2.5 overflow-y-auto`,d?`px-3 pt-3`:`px-3.5 pt-3.5`,p?`px-4 pt-6 space-y-6`:``),children:[h.length===0&&!l&&(d?(0,U.jsx)(Ne,{}):(0,U.jsx)(Pe,{floating:f,page:p})),h.map((t,n)=>(0,U.jsx)(`div`,{className:E(`[content-visibility:auto] [contain-intrinsic-size:auto_100px]`,p?`mx-auto w-full max-w-3xl`:``),children:(0,U.jsx)(Se,{allowHumanMessageRetry:e,item:t,nodes:i,onRetryHumanMessage:a,retryImageInputEnabled:s,retryingMessageId:c,variant:u})},Me(t,n))),l?(0,U.jsx)(`div`,{className:E(p?`mx-auto w-full max-w-3xl`:``),children:(0,U.jsx)(xe,{label:l.label,toolName:l.toolName,variant:u})}):null]})});function xe({label:e,toolName:t,variant:n}){return(0,U.jsx)(`div`,{className:`flex min-w-0 items-center`,children:(0,U.jsxs)(`div`,{className:E(`inline-flex max-w-full items-center gap-2 rounded-full border px-3 py-1.5 text-[11px] text-muted-foreground/82`,n===`workspace`?`border-border bg-accent/25`:`border-border bg-accent/20`),children:[(0,U.jsx)(`span`,{className:`flex items-center gap-1.5`,children:[0,1,2].map(e=>(0,U.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-muted-foreground/80`,style:{animationDelay:`${e*140}ms`}},e))}),(0,U.jsx)(`span`,{children:e}),t?(0,U.jsx)(`span`,{className:`truncate rounded-full border border-border bg-background/40 px-2 py-0.5 font-mono text-[10px] text-foreground/80`,children:t}):null]})})}var Se=(0,H.memo)(function({allowHumanMessageRetry:e,item:t,nodes:n,onRetryHumanMessage:r,retryImageInputEnabled:i,retryingMessageId:a,variant:o}){if(t.type===`PendingHumanMessage`)return(0,U.jsx)(Ce,{content:t.content,parts:t.parts,retrying:!1,variant:o,pending:!0});switch(t.type){case`ReceivedMessage`:if(z(t.parts,t.content).length===0)return null;if(t.from_id===`human`){let n=z(t.parts,t.content).some(e=>e.type===`image`)&&!i;return(0,U.jsx)(Ce,{allowRetry:e,content:I(t.parts,t.content),retryDisabled:n,retryDisabledReason:n?`Current model does not support image input`:void 0,messageId:t.message_id??null,onRetry:t.message_id&&r&&!n?()=>r(t.message_id):void 0,parts:t.parts,retrying:a===t.message_id,variant:o})}return(0,U.jsx)(Te,{content:I(t.parts,t.content),parts:t.parts,icon:(0,U.jsx)(C,{className:`size-3.5 text-foreground/68`}),label:`From ${R(t.from_id??``,n)}`,tone:`received`,streaming:t.streaming,variant:o});case`AssistantText`:return z(t.parts,t.content).length===0?null:(0,U.jsx)(we,{content:I(t.parts,t.content),parts:t.parts,streaming:t.streaming});case`SentMessage`:return z(t.parts,t.content).length===0?null:(0,U.jsx)(Te,{content:I(t.parts,t.content),parts:t.parts,icon:(0,U.jsx)(_,{className:`size-3.5 text-foreground/58`}),label:`To ${(t.to_id?[t.to_id]:(t.to_ids??[]).filter(e=>!!e)).map(e=>R(e,n)).join(`, `)||`Unknown`}`,tone:`sent`,streaming:t.streaming,variant:o});case`AssistantThinking`:return(0,U.jsx)(Ee,{item:t,variant:o});case`ToolCall`:return(0,U.jsx)(De,{item:t,variant:o});case`CommandResultEntry`:return(0,U.jsx)(Oe,{item:t,variant:o});case`ErrorEntry`:return(0,U.jsx)(ke,{content:t.content??``,variant:o});default:return null}});function Ce({allowRetry:e=!0,content:t,messageId:n,onRetry:r,parts:i,retryDisabled:a,retryDisabledReason:o,retrying:s,variant:c,pending:l=!1}){let u=c===`workspace`,d=e&&!l&&!!n&&(!!r||a);return(0,U.jsxs)(`div`,{className:`group mt-2 flex min-w-0 flex-col items-end`,children:[(0,U.jsx)(`div`,{className:E(`min-w-0 overflow-hidden px-2.5 py-1.5 text-[13px] [overflow-wrap:anywhere]`,u?`max-w-[84%] rounded-lg border border-border bg-accent/80 text-accent-foreground`:`max-w-[80%] rounded-lg border border-border bg-accent/65 text-accent-foreground`,l&&`opacity-80`),children:(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsx)(K,{content:t,layout:`human-attachments-top`,parts:i,markdownClassName:`text-sm text-accent-foreground`,preClassName:`text-accent-foreground/90`}),l?(0,U.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-accent/70 px-2 py-0.5 text-[10px] font-medium text-accent-foreground`,children:[(0,U.jsx)(w,{className:`size-3 animate-spin`}),`Sending`]}):null]})}),(0,U.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100`,children:[(0,U.jsx)(Z,{text:t}),d?(0,U.jsxs)(A,{type:`button`,variant:`ghost`,size:`xs`,onClick:r,disabled:s||a,title:o,className:E(`h-auto rounded-full border border-border px-2.5 py-1 text-[11px] text-muted-foreground hover:bg-accent/45 hover:text-foreground disabled:opacity-45`,u?`bg-accent/35`:`bg-accent/25`),children:[s?(0,U.jsx)(w,{className:`size-3 animate-spin`}):(0,U.jsx)(x,{className:`size-3`}),(0,U.jsx)(`span`,{children:s?`Retrying...`:`Retry`})]}):null]})]})}function we({content:e,parts:t,streaming:n}){return(0,U.jsxs)(`div`,{className:`group min-w-0 w-full`,children:[(0,U.jsx)(K,{content:e,parts:t,streaming:n,markdownClassName:`text-sm text-foreground`,preClassName:`text-foreground/90`}),(0,U.jsx)(`div`,{className:`mt-1 opacity-0 transition-opacity group-hover:opacity-100`,children:(0,U.jsx)(Z,{text:e})})]})}function Te({content:e,parts:t,icon:n,label:r,tone:i,streaming:a,variant:o}){let c=o===`workspace`,[l,u]=(0,H.useState)(!!a);return(0,U.jsxs)(`div`,{className:E(`min-w-0 w-full px-2 py-1.5`,c?`border-l border-border pl-3`:`rounded-lg`,i===`received`&&`border-border bg-accent/20`,i===`sent`&&`border-border bg-background/24`),children:[(0,U.jsxs)(`div`,{"aria-expanded":l,role:`button`,tabIndex:0,onClick:()=>u(e=>!e),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u(e=>!e))},className:`flex w-full items-center gap-2 text-left`,children:[(0,U.jsx)(`span`,{className:`flex size-5 shrink-0 translate-y-px items-center justify-center text-current`,children:n}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] font-semibold leading-none text-foreground/88`,children:r}),(0,U.jsx)(`span`,{className:`ml-auto`,onClick:e=>e.stopPropagation(),children:(0,U.jsx)(Z,{text:e})}),a?(0,U.jsxs)(`span`,{className:`inline-flex size-5 items-center justify-center`,children:[(0,U.jsxs)(`span`,{className:`relative flex size-2.5 items-center justify-center`,children:[(0,U.jsx)(`span`,{className:`absolute inline-flex size-2.5 animate-ping rounded-full bg-ring/28`}),(0,U.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-ring/82`})]}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Live`})]}):null,(0,U.jsx)(s,{className:E(`size-4 shrink-0 text-muted-foreground transition-transform`,l&&`rotate-90`)})]}),l?(0,U.jsx)(`div`,{className:`mt-2 min-w-0`,children:(0,U.jsx)(K,{content:e,parts:t,streaming:a,markdownClassName:`text-[12px] text-foreground/78`,preClassName:`text-foreground/74`})}):null]})}function Ee({item:e,variant:t}){return(0,U.jsx)(Ae,{label:`Thinking`,icon:(0,U.jsx)(r,{className:`size-3.5 text-foreground/72`}),tone:`thinking`,streaming:e.streaming,variant:t,defaultOpen:e.streaming??!1,children:(0,U.jsx)(K,{content:e.content,streaming:e.streaming,markdownClassName:`text-[13px] text-foreground/80`,preClassName:`text-foreground/75`})})}function De({item:e,variant:t}){let n=e.tool_name===`idle`,r=!!e.streaming&&!n,a=G(e.arguments)??``,o=G(e.result);return(0,U.jsx)(Ae,{label:je(e.tool_name),icon:(0,U.jsx)(i,{className:`size-3.5 text-muted-foreground`}),tone:`tool`,streaming:r,variant:t,defaultOpen:r,children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(`div`,{className:`text-[10px] font-medium text-muted-foreground/80`,children:`Arguments`}),(0,U.jsx)(`pre`,{className:`select-text whitespace-pre-wrap break-words rounded-xl border border-border bg-background/40 px-3.5 py-3 text-[11px] font-mono leading-relaxed text-foreground/78`,children:a})]}),e.result||!n?(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(`div`,{className:`text-[10px] font-medium text-muted-foreground/80`,children:`Result`}),e.result?(0,U.jsx)(K,{content:o??e.result,streaming:r,markdownClassName:`text-[12px] leading-relaxed text-foreground/80`,preClassName:`text-foreground/74`}):(0,U.jsx)(`div`,{className:`rounded-xl border border-border bg-accent/15 px-3.5 py-3 text-[12px] italic text-muted-foreground`,children:r?`Running...`:`No result`})]}):null]})})}function Oe({item:e,variant:t}){return(0,U.jsxs)(`div`,{className:E(`min-w-0 w-full space-y-3 px-3 py-2.5`,t===`workspace`?`border-l border-graph-status-running/30 bg-graph-status-running/[0.08]`:`rounded-xl border border-graph-status-running/18 bg-graph-status-running/[0.06]`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(f,{className:`size-4 text-graph-status-running`}),(0,U.jsx)(`span`,{className:`text-[11px] font-medium text-graph-status-running/90`,children:`Command Result`}),e.command_name?(0,U.jsx)(`span`,{className:`rounded-full border border-graph-status-running/14 bg-background/35 px-2 py-0.5 font-mono text-[10px] text-graph-status-running/80`,children:e.command_name}):null,(0,U.jsx)(`span`,{className:`ml-auto`,children:(0,U.jsx)(Z,{text:e.content??``,className:`text-graph-status-running/72 hover:bg-graph-status-running/[0.1] hover:text-graph-status-running`,iconClassName:`text-current`,copiedClassName:`text-graph-status-running`})})]}),(0,U.jsx)(K,{content:e.content,markdownClassName:`text-[13px] text-foreground`,preClassName:`text-foreground/90`})]})}function ke({content:e,variant:t}){return(0,U.jsxs)(`div`,{className:E(`min-w-0 w-full space-y-3 px-3 py-2.5`,t===`workspace`?`border-l-2 border-graph-status-error/40 bg-graph-status-error/[0.1]`:`rounded-xl border border-graph-status-error/20 bg-graph-status-error/[0.05]`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(c,{className:`size-4 text-graph-status-error`}),(0,U.jsx)(`span`,{className:`text-[11px] font-medium text-graph-status-error`,children:`Error`}),(0,U.jsx)(`span`,{className:`ml-auto`,children:(0,U.jsx)(Z,{text:e,className:`text-graph-status-error/72 hover:bg-graph-status-error/[0.1] hover:text-graph-status-error`,iconClassName:`text-current`,copiedClassName:`text-graph-status-error`})})]}),(0,U.jsx)(`p`,{className:`select-text whitespace-pre-wrap break-words text-[13px] leading-relaxed text-graph-status-error/82`,children:e})]})}function Ae({label:e,icon:t,tone:n,streaming:r,variant:i,defaultOpen:a,children:o}){let[c,l]=(0,H.useState)(a),u=i===`workspace`;return(0,U.jsxs)(`div`,{className:E(`min-w-0 w-full transition-all duration-300`,u?`border-l border-border pl-3 py-1.5`:`rounded-xl border border-border bg-accent/10 px-3 py-2`,n===`thinking`&&!u&&`hover:bg-accent/20`,n===`tool`&&!u&&`hover:bg-accent/20`),children:[(0,U.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>l(e=>!e),className:`h-auto w-full justify-start gap-2 px-0 py-0 text-left hover:bg-transparent hover:text-inherit`,children:[(0,U.jsx)(`span`,{className:`flex size-5 shrink-0 translate-y-px items-center justify-center text-muted-foreground`,children:t}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(`span`,{className:`block truncate text-[11px] font-medium text-muted-foreground`,children:e})}),r?(0,U.jsxs)(`span`,{className:`ml-auto inline-flex size-5 items-center justify-center`,children:[(0,U.jsxs)(`span`,{className:`relative flex size-2.5 items-center justify-center`,children:[(0,U.jsx)(`span`,{className:`absolute inline-flex size-2.5 animate-ping rounded-full bg-ring/30`}),(0,U.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-ring/82`})]}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Live`})]}):null,(0,U.jsx)(s,{className:E(`size-3.5 shrink-0 text-muted-foreground/70 transition-transform duration-200`,c&&`rotate-90`)})]}),c?(0,U.jsx)(`div`,{className:`mt-3 min-w-0`,children:o}):null]})}function je(e){return e?e.split(`_`).map(e=>e.length>0?`${e[0].toUpperCase()}${e.slice(1)}`:e).join(` `):`Tool Call`}function Me(e,t){return e.type===`PendingHumanMessage`?e.id:`${e.type}-${e.timestamp}-${e.message_id??``}-${e.tool_call_id??``}-${t}`}function Ne(){return(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-4`,children:(0,U.jsxs)(`div`,{className:`max-w-[220px] space-y-3 text-center`,children:[(0,U.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center`,children:(0,U.jsx)(C,{className:`size-5 text-primary`})}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`p`,{className:`text-sm font-medium`,children:`Start a conversation`}),(0,U.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Ask the Assistant to plan tasks, summarize progress, or coordinate next steps.`})]})]})})}function Pe({floating:e,page:t}){return(0,U.jsx)(`div`,{className:E(`flex h-full items-center justify-center`,t?`pb-[10vh]`:``),children:(0,U.jsxs)(`div`,{className:E(`space-y-2 text-center`,t?`max-w-md`:`max-w-[260px]`),children:[(0,U.jsx)(f,{className:E(`mx-auto`,t?`size-7 mb-4 text-muted-foreground/50`:`size-5`,e&&!t?`text-foreground/72`:`text-muted-foreground`)}),(0,U.jsx)(`p`,{className:E(`text-muted-foreground`,t?`text-base`:`text-sm`),children:`Ask the Assistant to plan tasks, summarize progress, or coordinate next steps.`})]})})}function Fe(){let e=(0,H.useRef)(null),[t,n]=(0,H.useState)(0);return(0,H.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=()=>{n(Math.ceil(t.getBoundingClientRect().height))};if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(()=>{r()});return i.observe(t),()=>{i.disconnect()}},[]),{height:t,ref:e}}function Ie(e){return e.filter(e=>e.type===`SystemEntry`||e.type===`StateEntry`)}function Le(e){return e>0xe8d4a51000?e:Math.round(e*1e3)}function Re(e){let t=``,n=``,r=new Map,i=new Map,a=new Map,o=[];for(let s of e)switch(s.type){case`ContentDelta`:t+=s.text;break;case`ThinkingDelta`:n+=s.text;break;case`ToolResultDelta`:r.set(s.tool_call_id,(r.get(s.tool_call_id)??``)+s.text);break;case`SentMessageDelta`:i.has(s.message_id)||o.push({kind:`sent`,messageId:s.message_id}),i.set(s.message_id,{toId:s.to_id,text:(i.get(s.message_id)?.text??``)+s.text});break;case`ReceivedMessageDelta`:a.has(s.message_id)||o.push({kind:`received`,messageId:s.message_id}),a.set(s.message_id,{fromId:s.from_id,text:(a.get(s.message_id)?.text??``)+s.text});break}return{content:t,thinking:n,toolResults:r,sentMessages:i,receivedMessages:a,messageOrder:o}}function ze(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Be(e){let t=Le(e.timestamp);switch(e.type){case`ReceivedMessage`:return e.message_id?`${e.type}:${e.message_id}`:[e.type,t,e.from_id??``,I(e.parts,e.content)].join(`:`);case`SentMessage`:return e.message_id?`${e.type}:${e.message_id}`:[e.type,t,e.to_id??e.to_ids?.[0]??``,I(e.parts,e.content)].join(`:`);case`ToolCall`:return e.tool_call_id?`${e.type}:${e.tool_call_id}`:[e.type,t,e.tool_name??``,ze(e.arguments),e.result??``,e.streaming?`streaming`:`final`].join(`:`);case`StateEntry`:return[e.type,t,e.state??``,e.reason??``].join(`:`);default:return[e.type,t,e.content??``].join(`:`)}}function Ve(e,t){return e.type!==`ToolCall`||t.type!==`ToolCall`?!1:e.streaming&&!t.streaming?!0:!e.result&&!!t.result}function He(e){let t=[],n=new Map;for(let r of e){let e=Be(r),i=n.get(e);if(i===void 0){n.set(e,t.length),t.push(r);continue}let a=t[i];Ve(a,r)&&(t[i]=r)}return t}function Ue({history:e,incremental:t,deltas:n,fetchedAt:r}){let i=He(t&&t.length>0?[...e,...t]:[...e]);if(!n||n.length===0)return i;let{content:a,thinking:o,toolResults:s,sentMessages:c,receivedMessages:l,messageOrder:u}=Re(n),d=r/1e3;if(o&&i.push({type:`AssistantThinking`,content:o,timestamp:d,streaming:!0}),a&&i.push({type:`AssistantText`,content:a,timestamp:d,streaming:!0}),s.size>0)for(let[e,t]of s)for(let n=i.length-1;n>=0;--n){let r=i[n];if(r.type===`ToolCall`&&r.tool_call_id===e&&r.streaming){i[n]={...r,result:t};break}}for(let e of u){if(e.kind===`sent`){let t=c.get(e.messageId);if(!t||i.some(t=>t.type===`SentMessage`&&t.message_id===e.messageId))continue;i.push({type:`SentMessage`,message_id:e.messageId,to_id:t.toId,content:t.text,parts:[{type:`text`,text:t.text}],timestamp:d,streaming:!0});continue}let t=l.get(e.messageId);t&&(i.some(t=>t.type===`ReceivedMessage`&&t.message_id===e.messageId)||i.push({type:`ReceivedMessage`,message_id:e.messageId,from_id:t.fromId,content:t.text,parts:[{type:`text`,text:t.text}],timestamp:d,streaming:!0}))}return i}var We=`flowent.chatInputHistory`,Ge=50,Ke=new Set,qe=new Map,Je=new Map;function Ye(e){return`${We}.${e}`}function Xe(e){return e.trim().length>0}function Ze(e){if(!e||typeof e!=`object`)return null;let t=typeof e.text==`string`?e.text:null,n=typeof e.timestamp==`number`?e.timestamp:null;return t===null||n===null||!Xe(t)?null:{text:t,images:[],timestamp:n}}function Qe(e){if(typeof window>`u`)return[];try{let t=window.localStorage.getItem(Ye(e));if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.map(e=>Ze(e)).filter(e=>e!==null).slice(-Ge):[]}catch{return[]}}function $e(e,t){if(!(typeof window>`u`))try{let n=t.filter(({text:e})=>Xe(e)).map(({text:e,timestamp:t})=>({text:e,timestamp:t}));window.localStorage.setItem(Ye(e),JSON.stringify(n))}catch{return}}function et(e){Ke.has(e)||(qe.set(e,Qe(e)),Ke.add(e))}function tt(e){let t=Je.get(e);if(t)for(let e of t)e()}function nt(e){return et(e),qe.get(e)??[]}function rt(e,t){et(e);let n=Je.get(e)??new Set;return n.add(t),Je.set(e,n),()=>{let n=Je.get(e);n?.delete(t),n&&n.size===0&&Je.delete(e)}}function it(e,t){et(e);let n=[...qe.get(e)??[],t].slice(-Ge);qe.set(e,n),$e(e,n),tt(e)}var at=10;function ot(e){return Math.max(0,e.scrollHeight-e.clientHeight)-e.scrollTop<=at}function st(){return globalThis.crypto?.randomUUID?.()??`draft-${Date.now()}-${Math.random()}`}function ct(e){return e.status===`ready`&&!!e.assetId}function lt(e){e.previewUrl.startsWith(`blob:`)&&URL.revokeObjectURL(e.previewUrl)}function ut(e){for(let t of e)lt(t)}function dt(e){return e.filter(ct).map(e=>({assetId:e.assetId,mimeType:e.mimeType,width:e.width,height:e.height,name:e.name}))}function ft(e){return e.images.map((t,n)=>({id:`history-${e.timestamp}-${n}`,assetId:t.assetId,previewUrl:ce(t.assetId),mimeType:t.mimeType,width:t.width,height:t.height,name:t.name,status:`ready`}))}function pt(e,t){return e.length===t.images.length?t.images.every((t,n)=>{let r=e[n];return!!r&&r?.status===`ready`&&r.assetId===t.assetId&&r.mimeType===t.mimeType&&r.width===t.width&&r.height===t.height&&r.name===t.name}):!1}function mt(e,t){let n=[];e&&n.push({type:`text`,text:e});for(let e of t)n.push({type:`image`,asset_id:e.assetId,mime_type:e.mimeType,width:e.width,height:e.height,alt:e.name});return n}function ht(e,t,n){return{id:`pending-${n}-${Math.random().toString(36).slice(2,8)}`,type:`PendingHumanMessage`,from:`human`,content:e,parts:t,timestamp:n,message_id:null}}async function gt(e){return new Promise(t=>{let n=URL.createObjectURL(e),r=new Image;r.onload=()=>{let e=r.naturalWidth,i=r.naturalHeight;URL.revokeObjectURL(n),t(e>0&&i>0?{width:e,height:i}:null)},r.onerror=()=>{URL.revokeObjectURL(n),t(null)},r.src=n})}async function _t(e){return Promise.all(e.map(async e=>{let t=await gt(e);return{id:st(),assetId:null,previewUrl:URL.createObjectURL(e),mimeType:e.type||null,width:t?.width??null,height:t?.height??null,name:e.name,status:`uploading`}}))}var vt=(0,H.memo)(function({agentLabel:e=`Agent`,history:t,nodes:n}){return(0,U.jsx)(`div`,{className:`space-y-1.5 p-2.5`,children:t.map((t,r)=>(0,U.jsx)(`div`,{className:`[content-visibility:auto] [contain-intrinsic-size:auto_100px]`,children:(0,U.jsx)(St,{agentLabel:e,entry:t,nodes:n})},`${r}-${t.timestamp}-${t.type}-${t.message_id??``}-${t.tool_call_id??``}`))})});function yt({content:e,markdownClassName:t,preClassName:n,streaming:r}){let i=G(e);return i?(0,U.jsx)(`pre`,{className:E(`select-text text-[11px] whitespace-pre-wrap break-words leading-relaxed`,n),children:(0,U.jsx)(bt,{text:i,streaming:r})}):r?(0,U.jsx)(`pre`,{className:E(`select-text text-[11px] whitespace-pre-wrap break-words leading-relaxed`,n),children:(0,U.jsx)(bt,{text:e??``,streaming:!0})}):(0,U.jsx)(W,{content:e??``,className:E(`text-[11px] leading-relaxed`,t)})}function bt({text:e,streaming:t}){return(0,U.jsxs)(U.Fragment,{children:[e,t&&(0,U.jsx)(`span`,{className:`streaming-cursor`})]})}function xt({entry:e,markdownClassName:t,preClassName:n}){let r=z(e.parts,e.content);return r.length===0?null:r.every(e=>e.type===`text`)?(0,U.jsx)(yt,{content:I(r),streaming:e.streaming,markdownClassName:t,preClassName:n}):(0,U.jsx)(`div`,{className:`space-y-2`,children:r.map((e,r)=>e.type===`text`?(0,U.jsx)(yt,{content:e.text,markdownClassName:t,preClassName:n},`${r}-${e.type}`):(0,U.jsx)(ue,{alt:e.alt,assetId:e.asset_id,compact:!0,height:e.height,mimeType:e.mime_type,width:e.width},`${r}-${e.type}-${e.asset_id}`))})}var St=(0,H.memo)(function({agentLabel:e,entry:t,nodes:n}){switch(t.type){case`SystemEntry`:return(0,U.jsx)(Q,{label:`System`,icon:(0,U.jsx)(o,{className:`size-3 text-muted-foreground`}),className:`border-border/40 bg-surface-1/24`,defaultOpen:!1,children:(0,U.jsx)(yt,{content:t.content,markdownClassName:`text-muted-foreground`,preClassName:`text-muted-foreground leading-relaxed`})});case`ReceivedMessage`:return(0,U.jsx)(Q,{label:`From ${R(t.from_id??``,n)}`,icon:(0,U.jsx)(C,{className:`size-3 text-foreground/70`}),className:`border-border bg-accent/20`,labelClassName:`text-foreground/70`,actions:(0,U.jsx)(Z,{text:I(t.parts,t.content)}),defaultOpen:t.streaming??!1,children:(0,U.jsx)(xt,{entry:t,markdownClassName:`text-foreground/90`,preClassName:`text-foreground/90 leading-relaxed`})});case`AssistantThinking`:return(0,U.jsx)(Q,{label:`Thinking`,icon:(0,U.jsx)(r,{className:`size-3 text-foreground/72`}),className:`border-border bg-surface-1/28`,labelClassName:`text-foreground/72`,defaultOpen:!1,children:(0,U.jsx)(yt,{content:t.content,streaming:t.streaming,markdownClassName:`text-foreground/82`,preClassName:`text-foreground/82 leading-relaxed`})});case`StateEntry`:return(0,U.jsx)(Q,{label:t.state?`State ${t.state.toUpperCase()}`:`State`,icon:(0,U.jsx)(d,{className:`size-3 text-foreground/62`}),className:`border-border bg-background/28`,labelClassName:`text-foreground/72`,defaultOpen:!1,children:(0,U.jsxs)(`div`,{className:`space-y-1 text-[11px] leading-relaxed text-foreground/84`,children:[(0,U.jsx)(`p`,{className:`select-text font-mono uppercase tracking-[0.08em] text-foreground/78`,children:t.state??`unknown`}),t.reason?(0,U.jsx)(`p`,{className:`select-text text-muted-foreground`,children:t.reason}):null]})});case`SentMessage`:return(0,U.jsx)(Q,{label:`To ${(t.to_id==null?(t.to_ids??[]).filter(e=>!!e):[t.to_id]).map(e=>R(e,n)).join(`, `)||`Unknown`}`,icon:(0,U.jsx)(_,{className:`size-3 text-foreground/58`}),className:`border-border bg-background/24`,labelClassName:`text-foreground/72`,actions:(0,U.jsx)(Z,{text:I(t.parts,t.content)}),defaultOpen:t.streaming??!1,children:(0,U.jsx)(xt,{entry:t,markdownClassName:`text-foreground/86`,preClassName:`text-foreground/86 leading-relaxed`})});case`AssistantText`:return(0,U.jsx)(Q,{label:e,icon:(0,U.jsx)(g,{className:`size-3 text-foreground/84`}),className:`border-border bg-surface-2/62`,labelClassName:`text-foreground/84`,actions:(0,U.jsx)(Z,{text:t.content??``}),defaultOpen:!1,children:(0,U.jsx)(xt,{entry:t,markdownClassName:`text-foreground/88`,preClassName:`text-foreground/88 leading-relaxed`})});case`ToolCall`:{let e=G(t.arguments)??``,n=G(t.result);return(0,U.jsx)(Q,{label:t.tool_name??`tool`,icon:(0,U.jsx)(i,{className:`size-3 text-foreground/66`}),className:`border-border bg-surface-1/20`,labelClassName:`text-foreground/72`,defaultOpen:!1,children:(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-[10px] text-muted-foreground mb-1`,children:`Arguments`}),(0,U.jsx)(`pre`,{className:`select-text text-[11px] whitespace-pre-wrap break-words leading-relaxed text-foreground/78`,children:e})]}),t.result&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-[10px] text-muted-foreground mb-1`,children:`Result`}),(0,U.jsx)(yt,{content:n??t.result,streaming:t.streaming,markdownClassName:`text-muted-foreground`,preClassName:`text-muted-foreground leading-relaxed`})]})]})})}case`ErrorEntry`:return(0,U.jsx)(Q,{label:`Error`,icon:(0,U.jsx)(c,{className:`size-3 text-graph-status-error/84`}),className:`border-graph-status-error/16 bg-graph-status-error/[0.038]`,labelClassName:`text-graph-status-error/78`,actions:(0,U.jsx)(Z,{text:t.content??``,className:`text-graph-status-error/84 hover:text-graph-status-error/84`,iconClassName:`text-graph-status-error/84`,copiedClassName:`text-graph-status-error/84`}),defaultOpen:!1,children:(0,U.jsx)(yt,{content:t.content,markdownClassName:`text-graph-status-error/84`,preClassName:`text-graph-status-error/84 leading-relaxed`})});default:return null}});function Q({actions:e,label:t,labelClassName:n,icon:r,className:i,contentClassName:a,defaultOpen:o=!1,children:c}){let[l,u]=(0,H.useState)(o),d=(0,H.useCallback)(()=>u(e=>!e),[]);return(0,U.jsxs)(`div`,{className:E(`rounded-xl border transition-colors hover:bg-accent/20`,i),children:[(0,U.jsxs)(`div`,{className:`flex cursor-pointer items-center gap-2 px-3 py-2 select-none`,onClick:d,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),d())},role:`button`,tabIndex:0,"aria-expanded":l,children:[(0,U.jsx)(`span`,{className:`shrink-0 flex items-center justify-center`,children:r}),(0,U.jsx)(`span`,{className:E(`flex-1 truncate text-[11px] font-medium`,n||`text-muted-foreground`),children:t}),e?(0,U.jsx)(`span`,{className:`ml-auto shrink-0 flex items-center leading-none`,onClick:e=>e.stopPropagation(),children:e}):null,(0,U.jsx)(s,{className:E(`ml-2 size-3.5 shrink-0 text-muted-foreground/70 transition-transform duration-200`,l&&`rotate-90`)})]}),(0,U.jsx)(P,{initial:!1,children:l?(0,U.jsx)(b.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:[.22,1,.36,1]},className:`overflow-hidden`,children:(0,U.jsx)(`div`,{className:E(`px-3 pb-3 pt-1`,a),children:c})}):null})]})}function Ct(e,t=!1){let[n,r]=(0,H.useState)(null),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)(0),{agents:u}=L(),{agentHistories:d,clearAgentHistory:f,clearHistorySnapshot:p,historyInvalidatedAt:m,historyClearedAt:h,historySnapshots:g,streamingDeltas:_}=te(),v=e?h.get(e)??0:0,y=e?m.get(e)??0:0,b=e?g.get(e)??null:null;return(0,H.useEffect)(()=>{v&&(r(e=>e&&{...e,history:Ie(e.history)}),l(Date.now()))},[v]),(0,H.useEffect)(()=>{!y||!b||(r(e=>e&&{...e,history:b}),l(Date.now()))},[y,b]),(0,H.useEffect)(()=>{if(!e){r(null),a(!1),s(null);return}let n=new AbortController,i=!1;return(async()=>{a(!0),s(null),t||f(e);try{let t=await M(e,n.signal);if(i)return;r(t),l(Date.now()),p(e)}catch(e){if(i||n.signal.aborted)return;r(null),s(e instanceof Error?e.message:`Failed to fetch node detail`)}finally{i||a(!1)}})(),()=>{i=!0,n.abort()}},[e,f,p,y,t]),{detail:(0,H.useMemo)(()=>{if(!n||!e)return null;let t=d.get(e),r=_.get(e),i=Ue({history:b??n.history,incremental:t,deltas:r,fetchedAt:c}),a=e?u.get(e):void 0,o={...n,history:i};return a&&(o.state=a.state,o.todos=a.todos),o},[n,e,d,b,_,u,c]),loading:i,error:o,fetchedAt:c}}function wt(e,t){return t?.leader_id?e.get(t.leader_id)??null:null}function Tt(e={}){let{bottomInset:t=0}=e,{agents:n}=L(),{tabs:r}=F(),{connected:i}=ne(),{agentHistories:a,clearAgentHistory:o,clearHistorySnapshot:s,historyInvalidatedAt:c,historyClearedAt:l,historySnapshots:d,streamingDeltas:f}=te(),{activeToolCalls:p}=re(),{activeTabId:m}=ae(),h=m?r.get(m)??null:null,g=(0,H.useMemo)(()=>wt(n,h),[h,n]),_=g?.id??h?.leader_id??null,v=m?`leader:${m}`:`leader:none`,[y,b]=(0,H.useState)(null),[x,S]=(0,H.useState)(0),[C,w]=(0,H.useState)(``),[T,E]=(0,H.useState)([]),[D,k]=(0,H.useState)(null),[A,ee]=(0,H.useState)(!1),[P,ie]=(0,H.useState)(null),[R,B]=(0,H.useState)([]),oe=(0,H.useRef)(null),se=(0,H.useRef)(!0),V=(0,H.useRef)([]),ce=g?.capabilities?.input_image??!1,U=_?l.get(_)??0:0,ue=_?c.get(_)??0:0,W=_?d.get(_)??null:null,G=T.some(e=>e.status===`uploading`),K=T.filter(ct),q=(0,H.useSyncExternalStore)(e=>rt(v,e),()=>nt(v),()=>nt(v)),J=D===null?null:q[D]??null,de=J!==null&&C===J.text&&pt(T,J),Y=(0,H.useCallback)((e,t)=>{k(t),w(e?.text??``),E(e?ft(e):[])},[]),fe=(0,H.useCallback)(e=>{k(null),w(e)},[]);(0,H.useEffect)(()=>{V.current=T},[T]),(0,H.useEffect)(()=>()=>{ut(V.current)},[]),(0,H.useEffect)(()=>{ut(V.current),w(``),E([]),k(null),B([]),ie(null)},[v]),(0,H.useEffect)(()=>{U&&(b(e=>e&&{...e,history:e.history.filter(e=>e.type===`SystemEntry`||e.type===`StateEntry`)}),S(Date.now()))},[U]),(0,H.useEffect)(()=>{!ue||!W||(b(e=>e&&{...e,history:W}),S(Date.now()))},[ue,W]),(0,H.useEffect)(()=>{if(!i||!_){b(null);return}let e=new AbortController,t=!1;return(async()=>{o(_);try{let n=await M(_,e.signal);if(t||!n)return;b(n),S(Date.now()),s(_)}catch{!t&&!e.signal.aborted&&u.error(`Failed to load Leader history`)}})(),()=>{t=!0,e.abort()}},[o,s,i,U,ue,_]);let pe=(0,H.useMemo)(()=>_?Ue({history:W??y?.history??[],incremental:a.get(_),deltas:f.get(_),fetchedAt:x||Date.now()}):[],[a,y,x,W,_,f]);(0,H.useEffect)(()=>{if(!_||R.length===0)return;let e=new Set(pe.filter(e=>e.type===`ReceivedMessage`&&e.from_id===`human`&&typeof e.message_id==`string`).map(e=>e.message_id));e.size!==0&&B(t=>t.filter(t=>!t.message_id||!e.has(t.message_id)))},[_,pe,R.length]);let X=(0,H.useMemo)(()=>[...pe,...R.map(e=>({...e}))],[pe,R]),me=(0,H.useMemo)(()=>{let e=R.length,t=_?f.get(_)??[]:[],n=i&&!!(_&&(e>0||g?.state===`running`||g?.state===`sleeping`||p.has(_)||t.length>0)),r=[...X].map((e,t)=>({item:e,index:t})).reverse().find(({item:e})=>e.type===`PendingHumanMessage`?!0:e.type===`ReceivedMessage`&&e.from_id===`human`&&z(e.parts,e.content).length>0)?.index,a=r===void 0?[]:X.slice(r+1),o=a.some(e=>e.type===`AssistantText`&&z(e.parts,e.content).length>0),s=[...a].reverse().find(e=>e.type===`ToolCall`&&e.streaming===!0),c=(_?p.get(_)??null:null)??s?.tool_name??null;return{running:n,runningHint:n&&r!==void 0&&!o?{label:c?`Running tools...`:`Thinking...`,toolName:c}:null}},[p,i,_,g?.state,R.length,f,X]);(0,H.useLayoutEffect)(()=>{let e=oe.current;!e||!se.current||(e.scrollTop=e.scrollHeight)},[t,me.runningHint?`${me.runningHint.label}:${me.runningHint.toolName??``}`:``,X]),(0,H.useLayoutEffect)(()=>{let e=oe.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{se.current&&(e.scrollTop=e.scrollHeight)});return t.observe(e),()=>{t.disconnect()}},[]);let he=e=>{se.current=ot(e.currentTarget)},ge=async()=>{if(!_)return;let e=C.trim();if(!e&&K.length===0||G||A)return;let t=mt(e,K),n=C,r=T,i=D,a=Date.now(),o=ht(e||I(t),t,a);ee(!0),B(e=>[...e,o]),k(null),w(``),E([]);try{let i=await j(_,{content:e||I(t),parts:t});B(e=>e.map(e=>e.id===o.id?{...e,message_id:i.message_id??null}:e)),it(v,{text:n,images:dt(r),timestamp:a}),ut(r)}catch(e){B(e=>e.filter(e=>e.id!==o.id)),w(n),E(r),k(i),u.error(e instanceof Error?e.message:`Failed to send message`)}finally{ee(!1)}},_e=(0,H.useCallback)(async e=>{if(k(null),!ce){u.error(`Current model does not support image input`);return}let t=Array.from(e).filter(e=>e.type.startsWith(`image/`));if(t.length===0)return;let n=await _t(t);E(e=>[...e,...n]),await Promise.all(n.map(async(e,n)=>{let r=t[n];if(r)try{let t=await le(r);E(n=>n.map(n=>n.id===e.id?{...n,assetId:t.id,mimeType:t.mime_type,width:typeof t.width==`number`?t.width:n.width,height:typeof t.height==`number`?t.height:n.height,status:`ready`}:n))}catch(t){lt(e),E(t=>t.filter(t=>t.id!==e.id)),u.error(t instanceof Error?t.message:`Failed to upload image`)}}))},[ce]),ve=(0,H.useCallback)(e=>{k(null),E(t=>{let n=t.find(t=>t.id===e);return n&<(n),t.filter(t=>t.id!==e)})},[]),ye=(0,H.useCallback)((e,t)=>{if(q.length===0)return!1;let n=t.start,r=t.end,i=C.length===0&&T.length===0,a=typeof n==`number`&&typeof r==`number`&&n===r&&(n===0||n===C.length);if(!i&&!(J!==null&&de&&a))return!1;if(D===null){if(e!==-1)return!1;let t=q.length-1;return Y(q[t]??null,t),!0}if(e===-1){let e=Math.max(D-1,0);return Y(q[e]??null,e),!0}if(D>=q.length-1)return Y(null,null),!0;let o=D+1;return Y(q[o]??null,o),!0},[J,T,D,C,q,de,Y]),Z=(0,H.useCallback)(async()=>{if(_&&!(g?.state!==`running`&&g?.state!==`sleeping`)){await N(_);for(let e=0;e<25;e+=1){let e=await M(_);if(!e)break;if(b(e),S(Date.now()),e.state!==`running`&&e.state!==`sleeping`)return;await new Promise(e=>window.setTimeout(e,120))}throw Error(`Leader did not stop in time`)}},[_,g?.state]);return{activeTab:h,addImages:_e,connected:i,draftImages:T,handleKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ge())},hasUploadingImages:G,input:C,isBrowsingInputHistory:de,leaderActivity:me,leaderNode:g,navigateInputHistory:ye,onMessagesScroll:he,removeImage:ve,retryMessage:(0,H.useCallback)(async e=>{if(!(!_||!e||P)){ie(e);try{try{await Z(),await O(_,e)}catch(e){u.error(e instanceof Error?e.message:`Failed to retry Leader message`);return}o(_);try{let e=await M(_);e&&(b(e),S(Date.now()),s(_))}catch{return}}finally{ie(null)}}},[o,s,_,P,Z]),retryingMessageId:P,scrollRef:oe,sendMessage:ge,sending:A,setInput:fe,stopLeader:Z,supportsInputImage:ce,timelineItems:X}}var Et=`rounded-md bg-accent/45 px-2 py-1 text-xs text-foreground`,Dt={running:`border-graph-status-running/18 bg-graph-status-running/[0.12] text-graph-status-running`,idle:`border-graph-status-idle/12 bg-graph-status-idle/[0.06] text-graph-status-idle/78`,sleeping:`border-graph-status-sleeping/18 bg-graph-status-sleeping/[0.12] text-graph-status-sleeping`,initializing:`border-graph-status-initializing/16 bg-graph-status-initializing/[0.08] text-graph-status-initializing/84`,error:`border-graph-status-error/20 bg-graph-status-error/[0.09] text-graph-status-error`,terminated:`border-border bg-accent/35 text-muted-foreground`};function Ot({children:e,disabled:t=!1,active:n=!1,onClick:r}){return(0,U.jsx)(A,{type:`button`,variant:`ghost`,size:`xs`,onClick:r,disabled:t,className:E(`flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md border border-transparent bg-transparent px-3 py-1.75 text-[11px] font-medium text-muted-foreground transition-[background-color,border-color,color] duration-150 hover:border-border hover:bg-accent/45 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:border-transparent disabled:text-muted-foreground/50 disabled:hover:bg-transparent`,n&&`border-border bg-accent/70 text-foreground`),children:e})}function kt(){return(0,U.jsx)(`div`,{"aria-hidden":`true`,className:`h-4 w-px shrink-0 bg-border`})}function At({children:e,tone:t=`default`}){return(0,U.jsx)(`div`,{className:E(`pointer-events-auto relative isolate flex items-center gap-1.5 rounded-full border border-border bg-surface-overlay/80 px-2.5 py-1 text-[11px] font-medium text-muted-foreground backdrop-blur-sm`,t===`primary`?`border-border bg-accent/60 text-foreground`:``),children:e})}function jt({agent:e,onClose:t}){let[n,r]=(0,H.useState)(!1),{agents:i}=L(),{tabs:a}=F(),{detail:o,error:s,loading:c}=Ct(e.id,e.node_type===`assistant`),l=o?.state??e.state,d=o?.is_leader??e.is_leader,f=o?.contacts??[],p=o?.connections??e.connections,m=o?.todos??e.todos,_=o?.history??[],v=o?.role_name??e.role_name,y=o?.tools??[],b=o?.write_dirs??[],x=o?.allow_network??!1,S=o?.tab_id??e.tab_id??null,C=S?a.get(S)??null:null,w=_.filter(e=>e.type===`StateEntry`),D=_.filter(e=>e.type!==`StateEntry`),O=V({name:e.name,roleName:e.role_name,nodeType:e.node_type,isLeader:e.is_leader}),k=p.map(e=>{let t=i.get(e);return{id:e,label:t?V({name:t.name,roleName:t.role_name,nodeType:t.node_type,isLeader:t.is_leader}):e.slice(0,8)}}),ee=f.map(e=>{let t=i.get(e);return{id:e,label:t?V({name:t.name,roleName:t.role_name,nodeType:t.node_type,isLeader:t.is_leader}):e.slice(0,8)}});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-3.5 py-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`flex size-7 items-center justify-center rounded-md bg-primary/8`,children:e.node_type===`assistant`?(0,U.jsx)(h,{className:`size-3.5 text-primary`}):(0,U.jsx)(g,{className:`size-3.5 text-primary`})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`p`,{className:`text-[13px] font-semibold`,children:O}),d?(0,U.jsx)(`span`,{className:`rounded-full border border-accent bg-accent/45 px-2 py-0.5 text-[10px] font-semibold text-accent-foreground`,children:`Leader`}):null,(0,U.jsx)(`span`,{className:`rounded-full border border-border bg-accent/35 px-2 py-0.5 font-mono text-[10px] text-muted-foreground/78`,children:e.id.slice(0,8)})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[l===`running`||l===`sleeping`?(0,U.jsx)(A,{type:`button`,size:`sm`,variant:`destructive`,disabled:n,onClick:()=>{r(!0),N(e.id).catch(()=>{u.error(`Failed to interrupt node`)}).finally(()=>{r(!1)})},children:n?`Interrupting...`:`Interrupt`}):null,(0,U.jsx)(It,{title:`Close details`,onClick:t,children:(0,U.jsx)(T,{className:`size-4`})})]})]}),(0,U.jsx)(`div`,{className:`flex-1 overflow-y-auto p-3.5`,children:(0,U.jsxs)(`div`,{className:`space-y-3.5`,children:[(0,U.jsxs)(`div`,{className:`grid gap-3.5 border-b border-border pb-3.5 sm:grid-cols-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`p`,{className:`text-[10px] font-semibold text-muted-foreground`,children:`Status`}),(0,U.jsx)(`div`,{className:`mt-2`,children:(0,U.jsx)(se,{variant:`outline`,className:Dt[l],children:l.toUpperCase()})})]}),(0,U.jsxs)(`div`,{className:`min-w-0 sm:border-l sm:border-border sm:pl-3.5`,children:[(0,U.jsx)(`p`,{className:`text-[10px] font-semibold text-muted-foreground`,children:`Contacts`}),(0,U.jsxs)(`p`,{className:`mt-2 select-text text-sm text-foreground`,children:[f.length,` reachable nodes`]})]}),(0,U.jsxs)(`div`,{className:`min-w-0 sm:border-l sm:border-border sm:pl-3.5`,children:[(0,U.jsx)(`p`,{className:`text-[10px] font-semibold text-muted-foreground`,children:`Workflow`}),(0,U.jsx)(`p`,{className:`mt-2 select-text text-sm text-foreground`,children:C?.title??S?.slice(0,8)??`None`})]})]}),(0,U.jsx)($,{title:`Workflow Context`,children:S?(0,U.jsxs)(`div`,{className:`grid gap-3 text-sm sm:grid-cols-2`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-[10px] font-semibold text-muted-foreground`,children:`ID`}),(0,U.jsx)(`p`,{className:`mt-1 select-text font-mono text-[11px] text-foreground`,children:S??`None`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-[10px] font-semibold text-muted-foreground`,children:`Title`}),(0,U.jsx)(`p`,{className:`mt-1 select-text text-foreground`,children:C?.title??`Unknown`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-[10px] font-semibold text-muted-foreground`,children:`Role`}),(0,U.jsx)(`p`,{className:`mt-1 select-text text-foreground`,children:v??`None`})]})]}):(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No workflow metadata`})}),(0,U.jsx)($,{title:`State Timeline`,children:w.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No state changes yet`}):(0,U.jsx)(`div`,{className:`space-y-2`,children:w.slice(-6).reverse().map(e=>(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-md border border-border bg-accent/25 px-3 py-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(se,{variant:`outline`,className:Dt[e.state??l],children:(e.state??l).toUpperCase()}),e.reason?(0,U.jsx)(`p`,{className:`mt-1 select-text text-xs text-muted-foreground/78`,children:e.reason}):null]}),(0,U.jsx)(`span`,{className:`shrink-0 select-text font-mono text-[10px] text-muted-foreground/64`,children:Lt(e.timestamp)})]},`${e.timestamp}-${e.state??`unknown`}`))})}),(0,U.jsx)($,{title:`Contacts`,children:ee.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No direct contacts`}):(0,U.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ee.map(e=>(0,U.jsx)(`span`,{className:E(Et,`select-text`),children:e.label},e.id))})}),(0,U.jsx)($,{title:`Agent Graph`,children:k.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No graph edges`}):(0,U.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:k.map(e=>(0,U.jsx)(`span`,{className:E(Et,`select-text`),children:e.label},e.id))})}),(0,U.jsx)($,{title:`Tools`,children:y.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tools configured`}):(0,U.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:y.map(e=>(0,U.jsx)(`span`,{className:E(Et,`select-text font-mono`),children:e},e))})}),(0,U.jsx)($,{title:`Permissions`,children:(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-[10px] font-semibold text-muted-foreground`,children:`Network`}),(0,U.jsx)(`p`,{className:`mt-1 select-text text-sm text-foreground`,children:x?`Enabled`:`Disabled`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-[10px] font-semibold text-muted-foreground`,children:`Write Dirs`}),b.length===0?(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`No write access`}):(0,U.jsx)(`div`,{className:`mt-2 space-y-1`,children:b.map(e=>(0,U.jsx)(`p`,{className:E(Et,`select-text font-mono text-[11px]`),children:e},e))})]})]})}),(0,U.jsx)($,{title:`Todos`,children:(0,U.jsx)(`div`,{className:`space-y-2`,children:m.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No todos`}):m.slice(0,6).map(e=>(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm text-foreground`,children:[(0,U.jsx)(`span`,{className:`size-2 rounded-full bg-border`}),(0,U.jsx)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:e.text})]},e.text))})}),(0,U.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,U.jsx)(`div`,{className:`px-0 pb-2`,children:(0,U.jsx)(`p`,{className:`text-[10px] font-semibold text-muted-foreground`,children:`History`})}),c?(0,U.jsx)(`div`,{className:`space-y-2`,children:[...[,,,,]].map((e,t)=>(0,U.jsx)(`div`,{className:`h-12 rounded-md skeleton-shimmer`},t))}):s?(0,U.jsx)(`div`,{className:`text-sm text-destructive`,children:s}):D.length===0?(0,U.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No history yet.`}):(0,U.jsx)(vt,{history:D,agentLabel:O,nodes:i})]})]})})]})}function Mt({onOpenDetails:e}){let{agents:t}=L(),[n,r]=(0,H.useState)(!1),{height:i,ref:a}=Fe(),{activeTab:o,addImages:s=async()=>{},connected:c,draftImages:l=[],handleKeyDown:d,hasUploadingImages:f=!1,input:p,isBrowsingInputHistory:m,leaderActivity:h,leaderNode:g,navigateInputHistory:_,onMessagesScroll:v,removeImage:y=()=>{},retryMessage:b,retryingMessageId:x,scrollRef:S,sending:C,sendMessage:w,setInput:T,stopLeader:E,supportsInputImage:D=!1,timelineItems:O}=Tt({bottomInset:i});return o?g?(0,U.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b border-border px-3.5 py-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2`,children:[(0,U.jsx)(`p`,{className:`text-[13px] font-semibold`,children:`Leader`}),(0,U.jsx)(`span`,{className:`rounded-full border border-border bg-accent/35 px-2 py-0.5 text-[10px] font-medium text-muted-foreground/78`,children:o.title}),g.role_name?(0,U.jsx)(`span`,{className:`rounded-full border border-border bg-accent/35 px-2 py-0.5 text-[10px] font-medium text-muted-foreground/78`,children:g.role_name}):null,(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground/72`,children:c?`Online`:`Connecting...`})]}),(0,U.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,U.jsx)(A,{type:`button`,size:`sm`,variant:`outline`,onClick:e,children:`Leader Details`})})]}),(0,U.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(be,{allowHumanMessageRetry:!0,bottomInset:i,items:O,nodes:t,onRetryHumanMessage:e=>void b(e),onScroll:v,retryImageInputEnabled:D,retryingMessageId:x,runningHint:h.runningHint,scrollRef:S,variant:`workspace`}),(0,U.jsx)(`div`,{ref:a,style:{paddingBottom:`calc(10px + env(safe-area-inset-bottom, 0px))`},className:`pointer-events-none absolute inset-x-0 bottom-0 z-10 bg-gradient-to-b from-transparent via-background/70 to-background/95 px-2.5 pt-8`,children:(0,U.jsx)(_e,{busy:h.running,commandsEnabled:!1,disabled:!p.trim()&&l.length===0||f||C,images:l,imageInputEnabled:D,input:p,onAddImages:e=>void s(e),onChange:T,onNavigateHistory:_,onKeyDown:d,onRemoveImage:y,onSend:()=>void w(),onStop:()=>{r(!0),E().catch(e=>{u.error(e instanceof Error?e.message:`Failed to interrupt leader`)}).finally(()=>{r(!1)})},overlay:!0,suppressCommandNavigation:m,targetLabel:`Leader`,stopping:n,variant:`workspace`})})]})]}):(0,U.jsx)(Pt,{}):(0,U.jsx)(Nt,{})}function Nt(){return(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-6`,children:(0,U.jsxs)(`div`,{className:`max-w-sm rounded-xl border border-border bg-accent/20 px-5 py-6 text-center`,children:[(0,U.jsx)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:`No workflow selected`}),(0,U.jsx)(`p`,{className:`mt-2 text-[12px] leading-6 text-muted-foreground`,children:`Create a workflow or switch to an existing one to open its Leader panel.`})]})})}function Pt(){return(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-6`,children:(0,U.jsxs)(`div`,{className:`max-w-sm rounded-xl border border-border bg-accent/20 px-5 py-6 text-center`,children:[(0,U.jsx)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:`Loading workflow context`}),(0,U.jsx)(`p`,{className:`mt-2 text-[12px] leading-6 text-muted-foreground`,children:`Restoring the current workflow Leader panel.`})]})})}function Ft({expanded:e,onClick:t,className:n}){let r=e?`Hide panel`:`Show panel`;return(0,U.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,onClick:t,title:r,"aria-label":r,className:E(`pointer-events-auto relative isolate flex size-9 items-center justify-center rounded-md border border-border bg-surface-overlay/80 text-muted-foreground shadow-sm transition-[background-color,color] duration-150 hover:bg-accent/60 hover:text-foreground [contain:paint]`,n),children:(0,U.jsx)(`span`,{className:`flex transition-transform duration-200`,children:e?(0,U.jsx)(v,{className:`size-4`}):(0,U.jsx)(y,{className:`size-4`})})})}function It({children:e,onClick:t,title:n}){return(0,U.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-xs`,onClick:t,title:n,"aria-label":n,className:`flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors duration-150 hover:bg-accent/45 hover:text-foreground`,children:e})}function $({title:e,children:t}){return(0,U.jsxs)(`section`,{className:`border-t border-border pt-3.5`,children:[(0,U.jsx)(`p`,{className:`text-[10px] font-semibold text-muted-foreground`,children:e}),(0,U.jsx)(`div`,{className:`mt-2`,children:t})]})}function Lt(e){return e?new Date(e*1e3).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}):`—`}export{Ue as C,le as D,_e as E,Ie as S,be as T,ft as _,Ot as a,nt as b,wt as c,_t as d,pt as f,ut as g,lt as h,Ft as i,mt as l,ot as m,At as n,kt as o,ct as p,Mt as r,Nt as s,jt as t,ht as u,dt as v,Fe as w,rt as x,it as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./rolldown-runtime-BYbx6iT9.js";import{d as e,l as t}from"./graph-vendor-DRq_-6fV.js";import{C as n,D as r,E as i,O as a,S as o,T as s,w as c,x as l}from"./ui-vendor-Dg9NNnWX.js";import{a as u}from"./shared-CMxbpLeQ.js";import{Y as d}from"./index-CL1ALZ3r.js";e();var f=t();function p({...e}){return(0,f.jsx)(r,{"data-slot":`alert-dialog`,...e})}function m({...e}){return(0,f.jsx)(i,{"data-slot":`alert-dialog-portal`,...e})}function h({className:e,...t}){return(0,f.jsx)(s,{"data-slot":`alert-dialog-overlay`,className:u(`bg-background/88 fixed inset-0 z-50`,`data-[state=open]:animate-in data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t})}function g({className:e,...t}){return(0,f.jsxs)(m,{children:[(0,f.jsx)(h,{}),(0,f.jsx)(n,{"data-slot":`alert-dialog-content`,className:u(`fixed top-1/2 left-1/2 z-50 w-full max-w-[calc(100%-2rem)] sm:max-w-lg -translate-x-1/2 -translate-y-1/2 grid gap-4 rounded-xl border border-border bg-popover text-popover-foreground p-6 shadow-lg`,`data-[state=open]:animate-in data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,`data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,e),...t})]})}function _({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:u(`flex flex-col gap-2 text-left`,e),...t})}function v({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:u(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function y({className:e,...t}){return(0,f.jsx)(a,{"data-slot":`alert-dialog-title`,className:u(`text-lg font-semibold`,e),...t})}function b({className:e,...t}){return(0,f.jsx)(c,{"data-slot":`alert-dialog-description`,className:u(`text-sm text-muted-foreground`,e),...t})}function x({className:e,...t}){return(0,f.jsx)(l,{"data-slot":`alert-dialog-action`,className:u(d(),e),...t})}function S({className:e,...t}){return(0,f.jsx)(o,{"data-slot":`alert-dialog-cancel`,className:u(d({variant:`outline`}),e),...t})}export{b as a,y as c,g as i,x as n,v as o,S as r,_ as s,p as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./rolldown-runtime-BYbx6iT9.js";import{d as e,l as t}from"./graph-vendor-DRq_-6fV.js";import{I as n}from"./ui-vendor-Dg9NNnWX.js";import{a as r}from"./shared-CMxbpLeQ.js";import{X as i}from"./index-CL1ALZ3r.js";e();var a=t(),o=i(`inline-flex h-5 items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function s({className:e,variant:t=`default`,asChild:i=!1,...s}){return(0,a.jsx)(i?n:`span`,{"data-slot":`badge`,"data-variant":t,className:r(o({variant:t}),e),...s})}export{s as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ut as e,Z as t,en as n,jt as r,ut as i}from"./ui-vendor-Dg9NNnWX.js";var a={assistant:t,agent:n,trigger:i,code:e,if:r,merge:n};function o({name:e,roleName:t,nodeType:n,isLeader:r=!1}){return e??t??(n===`assistant`?`Assistant`:n===`trigger`?`Trigger`:n===`code`?`Code`:n===`if`?`If`:n===`merge`?`Merge`:r?`Leader`:`Agent`)}var s={running:`bg-graph-status-running`,idle:`bg-graph-status-idle`,sleeping:`bg-graph-status-sleeping`,initializing:`bg-graph-status-initializing`,error:`bg-graph-status-error`,terminated:`bg-graph-status-terminated`},c={running:`border-graph-status-running/18 bg-graph-status-running/[0.12] text-graph-status-running`,idle:`border-graph-status-idle/10 bg-graph-status-idle/[0.04] text-graph-status-idle/72`,sleeping:`border-graph-status-sleeping/18 bg-graph-status-sleeping/[0.12] text-graph-status-sleeping`,initializing:`border-graph-status-initializing/14 bg-graph-status-initializing/[0.07] text-graph-status-initializing/84`,error:`border-graph-status-error/20 bg-graph-status-error/[0.09] text-graph-status-error`,terminated:`border-border bg-accent/35 text-muted-foreground`},l={running:`agent-state-ring-running`,idle:`agent-state-ring-idle`,sleeping:`agent-state-ring-sleeping`,initializing:`agent-state-ring-initializing`,error:`agent-state-ring-error`,terminated:`agent-state-ring-terminated`};export{l as a,s as i,a as n,c as r,o as t};
|