flowent 0.0.1 → 0.0.4
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 +19 -8
- package/backend/.python-version +1 -0
- package/backend/pyproject.toml +57 -0
- package/backend/src/flowent/__init__.py +3 -0
- 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__/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__/stats_service.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/workspace_store.cpython-313.pyc +0 -0
- package/backend/src/flowent/_version.py +7 -0
- package/backend/src/flowent/access.py +247 -0
- package/backend/src/flowent/agent.py +2808 -0
- package/backend/src/flowent/assistant_commands.py +106 -0
- package/backend/src/flowent/channels/__init__.py +3 -0
- 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 +615 -0
- package/backend/src/flowent/cli.py +85 -0
- package/backend/src/flowent/config.py +14 -0
- package/backend/src/flowent/dev.py +3 -0
- package/backend/src/flowent/events.py +157 -0
- package/backend/src/flowent/graph_runtime.py +60 -0
- package/backend/src/flowent/graph_service.py +1346 -0
- package/backend/src/flowent/image_assets.py +356 -0
- package/backend/src/flowent/logging.py +155 -0
- package/backend/src/flowent/main.py +124 -0
- package/backend/src/flowent/mcp_service.py +1904 -0
- package/backend/src/flowent/model_metadata.py +98 -0
- package/backend/src/flowent/models/__init__.py +121 -0
- 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 +33 -0
- package/backend/src/flowent/models/base.py +24 -0
- package/backend/src/flowent/models/blueprint.py +176 -0
- package/backend/src/flowent/models/content.py +164 -0
- package/backend/src/flowent/models/delta.py +44 -0
- package/backend/src/flowent/models/event.py +51 -0
- package/backend/src/flowent/models/graph.py +437 -0
- package/backend/src/flowent/models/history.py +214 -0
- package/backend/src/flowent/models/llm.py +61 -0
- package/backend/src/flowent/models/message.py +27 -0
- package/backend/src/flowent/models/tab.py +48 -0
- package/backend/src/flowent/models/todo.py +10 -0
- package/backend/src/flowent/network.py +146 -0
- package/backend/src/flowent/prompts/__init__.py +67 -0
- 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 +250 -0
- package/backend/src/flowent/prompts/steward.py +64 -0
- package/backend/src/flowent/providers/__init__.py +23 -0
- 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/anthropic.py +468 -0
- package/backend/src/flowent/providers/base_url.py +60 -0
- package/backend/src/flowent/providers/configuration.py +182 -0
- package/backend/src/flowent/providers/content.py +122 -0
- package/backend/src/flowent/providers/errors.py +223 -0
- package/backend/src/flowent/providers/gateway.py +169 -0
- package/backend/src/flowent/providers/gemini.py +447 -0
- package/backend/src/flowent/providers/headers.py +20 -0
- package/backend/src/flowent/providers/management.py +96 -0
- package/backend/src/flowent/providers/ollama.py +293 -0
- package/backend/src/flowent/providers/openai.py +422 -0
- package/backend/src/flowent/providers/openai_responses.py +655 -0
- package/backend/src/flowent/providers/registry.py +144 -0
- package/backend/src/flowent/providers/sse.py +31 -0
- package/backend/src/flowent/providers/thinking.py +79 -0
- package/backend/src/flowent/registry.py +73 -0
- package/backend/src/flowent/role_management.py +255 -0
- package/backend/src/flowent/routes/__init__.py +30 -0
- 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__/stats.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/access.py +48 -0
- package/backend/src/flowent/routes/assistant.py +155 -0
- package/backend/src/flowent/routes/image_assets.py +33 -0
- package/backend/src/flowent/routes/mcp.py +125 -0
- package/backend/src/flowent/routes/meta.py +28 -0
- package/backend/src/flowent/routes/nodes.py +365 -0
- package/backend/src/flowent/routes/prompts.py +46 -0
- package/backend/src/flowent/routes/providers_route.py +364 -0
- package/backend/src/flowent/routes/roles.py +207 -0
- package/backend/src/flowent/routes/settings.py +324 -0
- package/backend/src/flowent/routes/stats.py +229 -0
- package/backend/src/flowent/routes/tabs.py +292 -0
- package/backend/src/flowent/routes/ws.py +33 -0
- package/backend/src/flowent/runtime.py +188 -0
- package/backend/src/flowent/sandbox.py +45 -0
- package/backend/src/flowent/security.py +42 -0
- package/backend/src/flowent/settings.py +2467 -0
- package/backend/src/flowent/settings_management.py +286 -0
- package/backend/src/flowent/state_db.py +120 -0
- package/backend/src/flowent/static/assets/AssistantPage-B3Xc08AS.js +1 -0
- package/backend/src/flowent/static/assets/ChannelsPage-ByLd28xk.js +1 -0
- package/backend/src/flowent/static/assets/HomePage-C0hAx9_l.js +3 -0
- package/backend/src/flowent/static/assets/McpPage-DkrYLvBv.js +7 -0
- package/backend/src/flowent/static/assets/PageScaffold-D4jO9ooX.js +1 -0
- package/backend/src/flowent/static/assets/PromptsPage-DWA7rRJd.js +1 -0
- package/backend/src/flowent/static/assets/ProvidersPage-PUWT8seJ.js +3 -0
- package/backend/src/flowent/static/assets/RolesPage-CqcclGRw.js +1 -0
- package/backend/src/flowent/static/assets/SettingsPage-8tS2cJgX.js +3 -0
- package/backend/src/flowent/static/assets/StatsPage-BX9khYzu.js +1 -0
- package/backend/src/flowent/static/assets/ToolsPage-9Tl9FdeD.js +1 -0
- package/backend/src/flowent/static/assets/WorkspaceCommandDialog-CCXxjDL8.js +1 -0
- package/backend/src/flowent/static/assets/WorkspacePanels-aMdJ7ZH7.js +1 -0
- package/backend/src/flowent/static/assets/alert-dialog-kFYVQ7oX.js +1 -0
- package/backend/src/flowent/static/assets/badge-74-3jsCg.js +1 -0
- package/backend/src/flowent/static/assets/constants-XUzFf6i1.js +1 -0
- package/backend/src/flowent/static/assets/datetime-m6_O_Ci9.js +1 -0
- package/backend/src/flowent/static/assets/dialog-BeGSweF6.js +1 -0
- package/backend/src/flowent/static/assets/elk-worker.min-C9JGDOE-.js +6312 -0
- package/backend/src/flowent/static/assets/graph-vendor-CHpVij2M.css +1 -0
- package/backend/src/flowent/static/assets/graph-vendor-DRq_-6fV.js +7 -0
- package/backend/src/flowent/static/assets/index-BHC1Vhy8.css +1 -0
- package/backend/src/flowent/static/assets/index-CL1ALZ3r.js +10 -0
- package/backend/src/flowent/static/assets/layout.worker-jMHqAFbP.js +24 -0
- package/backend/src/flowent/static/assets/markdown-vendor-DVdy_w12.js +29 -0
- package/backend/src/flowent/static/assets/modelParams-CaHd0903.js +1 -0
- package/backend/src/flowent/static/assets/react-vendor-mEs_JJxa.js +9 -0
- package/backend/src/flowent/static/assets/roles-2OLDeTc5.js +1 -0
- package/backend/src/flowent/static/assets/rolldown-runtime-BYbx6iT9.js +1 -0
- package/backend/src/flowent/static/assets/select-DL_LPeDj.js +1 -0
- package/backend/src/flowent/static/assets/shared-CMxbpLeQ.js +1 -0
- package/backend/src/flowent/static/assets/triState-DEr3NkXV.js +1 -0
- package/backend/src/flowent/static/assets/ui-vendor-Dg9NNnWX.js +51 -0
- package/backend/src/flowent/static/index.html +36 -0
- package/backend/src/flowent/stats_service.py +218 -0
- package/backend/src/flowent/tools/__init__.py +201 -0
- 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 +156 -0
- package/backend/src/flowent/tools/contacts.py +22 -0
- package/backend/src/flowent/tools/create_agent.py +270 -0
- package/backend/src/flowent/tools/create_tab.py +59 -0
- package/backend/src/flowent/tools/delete_tab.py +39 -0
- package/backend/src/flowent/tools/edit.py +142 -0
- package/backend/src/flowent/tools/exec.py +117 -0
- package/backend/src/flowent/tools/fetch.py +85 -0
- package/backend/src/flowent/tools/idle.py +27 -0
- package/backend/src/flowent/tools/list_roles.py +50 -0
- package/backend/src/flowent/tools/list_tabs.py +96 -0
- package/backend/src/flowent/tools/list_tools.py +24 -0
- package/backend/src/flowent/tools/manage_prompts.py +102 -0
- package/backend/src/flowent/tools/manage_providers.py +220 -0
- package/backend/src/flowent/tools/manage_roles.py +275 -0
- package/backend/src/flowent/tools/manage_settings.py +346 -0
- package/backend/src/flowent/tools/mcp.py +199 -0
- package/backend/src/flowent/tools/read.py +152 -0
- package/backend/src/flowent/tools/send.py +50 -0
- package/backend/src/flowent/tools/set_permissions.py +84 -0
- package/backend/src/flowent/tools/sleep.py +41 -0
- package/backend/src/flowent/tools/todo.py +51 -0
- package/backend/src/flowent/workspace_store.py +479 -0
- package/backend/tests/__init__.py +0 -0
- 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/conftest.py +6 -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/conftest.py +29 -0
- package/backend/tests/integration/api/test_access_api.py +182 -0
- package/backend/tests/integration/api/test_assistant_api.py +354 -0
- package/backend/tests/integration/api/test_frontend_mounting.py +61 -0
- package/backend/tests/integration/api/test_mcp_api.py +116 -0
- package/backend/tests/integration/api/test_meta_api.py +33 -0
- package/backend/tests/integration/api/test_nodes_api.py +486 -0
- package/backend/tests/integration/api/test_prompts_api.py +47 -0
- package/backend/tests/integration/api/test_roles_api.py +227 -0
- package/backend/tests/integration/api/test_tabs_api.py +501 -0
- 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 +746 -0
- package/backend/tests/unit/agent/test_agent_runtime.py +2726 -0
- package/backend/tests/unit/channels/__pycache__/test_telegram_channel.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/channels/test_telegram_channel.py +552 -0
- package/backend/tests/unit/logging/__pycache__/test_logging.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/logging/test_logging.py +132 -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 +569 -0
- 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/providers/test_anthropic_provider.py +185 -0
- package/backend/tests/unit/providers/test_errors.py +68 -0
- package/backend/tests/unit/providers/test_extract_delta_parts.py +22 -0
- package/backend/tests/unit/providers/test_openai_provider.py +139 -0
- package/backend/tests/unit/providers/test_openai_responses.py +402 -0
- package/backend/tests/unit/providers/test_provider_gateway.py +359 -0
- package/backend/tests/unit/providers/test_think_tag_parser.py +36 -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/__pycache__/test_stats_routes.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/routes/test_prompts_routes.py +104 -0
- package/backend/tests/unit/routes/test_providers_route.py +368 -0
- package/backend/tests/unit/routes/test_roles_routes.py +426 -0
- package/backend/tests/unit/routes/test_settings_routes.py +1138 -0
- package/backend/tests/unit/routes/test_stats_routes.py +149 -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 +1012 -0
- package/backend/tests/unit/sandbox/__pycache__/test_sandbox_tools.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/unit/sandbox/test_sandbox_tools.py +78 -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 +110 -0
- 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 +711 -0
- package/backend/tests/unit/test_access.py +45 -0
- package/backend/tests/unit/test_cli.py +124 -0
- package/backend/tests/unit/test_graph_runtime.py +72 -0
- package/backend/tests/unit/test_network.py +51 -0
- package/backend/tests/unit/test_state_sqlite_storage.py +93 -0
- package/backend/tests/unit/test_workspace_store.py +231 -0
- 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 +229 -0
- package/backend/tests/unit/tools/test_create_agent_tool.py +524 -0
- package/backend/tests/unit/tools/test_delete_tab_tool.py +83 -0
- package/backend/tests/unit/tools/test_edit_tool.py +115 -0
- package/backend/tests/unit/tools/test_exec_tool.py +81 -0
- package/backend/tests/unit/tools/test_fetch_tool.py +65 -0
- package/backend/tests/unit/tools/test_manage_prompts_tool.py +117 -0
- package/backend/tests/unit/tools/test_manage_providers_tool.py +458 -0
- package/backend/tests/unit/tools/test_manage_roles_tool.py +411 -0
- package/backend/tests/unit/tools/test_manage_settings_tool.py +608 -0
- package/backend/tests/unit/tools/test_read_tool.py +33 -0
- package/backend/tests/unit/tools/test_set_permissions_tool.py +391 -0
- package/backend/tests/unit/tools/test_todo_tool.py +37 -0
- package/backend/tests/unit/tools/test_tool_registry.py +91 -0
- package/backend/uv.lock +1144 -0
- package/bin/flowent.mjs +62 -36
- package/dist/frontend/assets/AssistantPage-B3Xc08AS.js +1 -0
- package/dist/frontend/assets/ChannelsPage-ByLd28xk.js +1 -0
- package/dist/frontend/assets/HomePage-C0hAx9_l.js +3 -0
- package/dist/frontend/assets/McpPage-DkrYLvBv.js +7 -0
- package/dist/frontend/assets/PageScaffold-D4jO9ooX.js +1 -0
- package/dist/frontend/assets/PromptsPage-DWA7rRJd.js +1 -0
- package/dist/frontend/assets/ProvidersPage-PUWT8seJ.js +3 -0
- package/dist/frontend/assets/RolesPage-CqcclGRw.js +1 -0
- package/dist/frontend/assets/SettingsPage-8tS2cJgX.js +3 -0
- package/dist/frontend/assets/StatsPage-BX9khYzu.js +1 -0
- package/dist/frontend/assets/ToolsPage-9Tl9FdeD.js +1 -0
- package/dist/frontend/assets/WorkspaceCommandDialog-CCXxjDL8.js +1 -0
- package/dist/frontend/assets/WorkspacePanels-aMdJ7ZH7.js +1 -0
- package/dist/frontend/assets/alert-dialog-kFYVQ7oX.js +1 -0
- package/dist/frontend/assets/badge-74-3jsCg.js +1 -0
- package/dist/frontend/assets/constants-XUzFf6i1.js +1 -0
- package/dist/frontend/assets/datetime-m6_O_Ci9.js +1 -0
- package/dist/frontend/assets/dialog-BeGSweF6.js +1 -0
- package/dist/frontend/assets/elk-worker.min-C9JGDOE-.js +6312 -0
- package/dist/frontend/assets/graph-vendor-CHpVij2M.css +1 -0
- package/dist/frontend/assets/graph-vendor-DRq_-6fV.js +7 -0
- package/dist/frontend/assets/index-BHC1Vhy8.css +1 -0
- package/dist/frontend/assets/index-CL1ALZ3r.js +10 -0
- package/dist/frontend/assets/layout.worker-jMHqAFbP.js +24 -0
- package/dist/frontend/assets/markdown-vendor-DVdy_w12.js +29 -0
- package/dist/frontend/assets/modelParams-CaHd0903.js +1 -0
- package/dist/frontend/assets/react-vendor-mEs_JJxa.js +9 -0
- package/dist/frontend/assets/roles-2OLDeTc5.js +1 -0
- package/dist/frontend/assets/rolldown-runtime-BYbx6iT9.js +1 -0
- package/dist/frontend/assets/select-DL_LPeDj.js +1 -0
- package/dist/frontend/assets/shared-CMxbpLeQ.js +1 -0
- package/dist/frontend/assets/triState-DEr3NkXV.js +1 -0
- package/dist/frontend/assets/ui-vendor-Dg9NNnWX.js +51 -0
- package/dist/frontend/index.html +36 -0
- package/package.json +27 -41
- package/dist/.next/BUILD_ID +0 -1
- package/dist/.next/app-path-routes-manifest.json +0 -6
- package/dist/.next/build-manifest.json +0 -20
- package/dist/.next/package.json +0 -1
- package/dist/.next/prerender-manifest.json +0 -114
- package/dist/.next/required-server-files.json +0 -333
- package/dist/.next/routes-manifest.json +0 -69
- package/dist/.next/server/app/_global-error/page/app-paths-manifest.json +0 -3
- package/dist/.next/server/app/_global-error/page/build-manifest.json +0 -16
- package/dist/.next/server/app/_global-error/page/next-font-manifest.json +0 -6
- package/dist/.next/server/app/_global-error/page/react-loadable-manifest.json +0 -1
- package/dist/.next/server/app/_global-error/page/server-reference-manifest.json +0 -4
- package/dist/.next/server/app/_global-error/page.js +0 -9
- package/dist/.next/server/app/_global-error/page.js.map +0 -5
- package/dist/.next/server/app/_global-error/page.js.nft.json +0 -1
- package/dist/.next/server/app/_global-error/page_client-reference-manifest.js +0 -3
- package/dist/.next/server/app/_global-error.html +0 -1
- package/dist/.next/server/app/_global-error.meta +0 -15
- package/dist/.next/server/app/_global-error.rsc +0 -14
- package/dist/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +0 -5
- package/dist/.next/server/app/_global-error.segments/_full.segment.rsc +0 -14
- package/dist/.next/server/app/_global-error.segments/_head.segment.rsc +0 -5
- package/dist/.next/server/app/_global-error.segments/_index.segment.rsc +0 -5
- package/dist/.next/server/app/_global-error.segments/_tree.segment.rsc +0 -1
- package/dist/.next/server/app/_not-found/page/app-paths-manifest.json +0 -3
- package/dist/.next/server/app/_not-found/page/build-manifest.json +0 -16
- package/dist/.next/server/app/_not-found/page/next-font-manifest.json +0 -10
- package/dist/.next/server/app/_not-found/page/react-loadable-manifest.json +0 -1
- package/dist/.next/server/app/_not-found/page/server-reference-manifest.json +0 -4
- package/dist/.next/server/app/_not-found/page.js +0 -13
- package/dist/.next/server/app/_not-found/page.js.map +0 -5
- package/dist/.next/server/app/_not-found/page.js.nft.json +0 -1
- package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +0 -3
- package/dist/.next/server/app/_not-found.html +0 -1
- package/dist/.next/server/app/_not-found.meta +0 -16
- package/dist/.next/server/app/_not-found.rsc +0 -16
- package/dist/.next/server/app/_not-found.segments/_full.segment.rsc +0 -16
- package/dist/.next/server/app/_not-found.segments/_head.segment.rsc +0 -6
- package/dist/.next/server/app/_not-found.segments/_index.segment.rsc +0 -5
- package/dist/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +0 -5
- package/dist/.next/server/app/_not-found.segments/_not-found.segment.rsc +0 -5
- package/dist/.next/server/app/_not-found.segments/_tree.segment.rsc +0 -2
- package/dist/.next/server/app/icon.svg/route/app-paths-manifest.json +0 -3
- package/dist/.next/server/app/icon.svg/route/build-manifest.json +0 -9
- package/dist/.next/server/app/icon.svg/route.js +0 -6
- package/dist/.next/server/app/icon.svg/route.js.map +0 -5
- package/dist/.next/server/app/icon.svg/route.js.nft.json +0 -1
- package/dist/.next/server/app/icon.svg.meta +0 -1
- package/dist/.next/server/app/index.html +0 -1
- package/dist/.next/server/app/index.meta +0 -14
- package/dist/.next/server/app/index.rsc +0 -15
- package/dist/.next/server/app/index.segments/__PAGE__.segment.rsc +0 -5
- package/dist/.next/server/app/index.segments/_full.segment.rsc +0 -15
- package/dist/.next/server/app/index.segments/_head.segment.rsc +0 -6
- package/dist/.next/server/app/index.segments/_index.segment.rsc +0 -5
- package/dist/.next/server/app/index.segments/_tree.segment.rsc +0 -3
- package/dist/.next/server/app/page/app-paths-manifest.json +0 -3
- package/dist/.next/server/app/page/build-manifest.json +0 -16
- package/dist/.next/server/app/page/next-font-manifest.json +0 -10
- package/dist/.next/server/app/page/react-loadable-manifest.json +0 -1
- package/dist/.next/server/app/page/server-reference-manifest.json +0 -4
- package/dist/.next/server/app/page.js +0 -14
- package/dist/.next/server/app/page.js.map +0 -5
- package/dist/.next/server/app/page.js.nft.json +0 -1
- package/dist/.next/server/app/page_client-reference-manifest.js +0 -3
- package/dist/.next/server/app-paths-manifest.json +0 -6
- package/dist/.next/server/chunks/[externals]_next_dist_0arv.vj._.js +0 -3
- package/dist/.next/server/chunks/[root-of-the-server]__0vcj1q1._.js +0 -13
- package/dist/.next/server/chunks/[turbopack]_runtime.js +0 -903
- package/dist/.next/server/chunks/_next-internal_server_app_icon_svg_route_actions_0-0ehc~.js +0 -3
- package/dist/.next/server/chunks/ssr/05w9_next_dist_0ihu0u9._.js +0 -6
- package/dist/.next/server/chunks/ssr/05w9_next_dist_client_components_12u3mib._.js +0 -3
- package/dist/.next/server/chunks/ssr/05w9_next_dist_client_components_builtin_forbidden_04fbe_..js +0 -3
- package/dist/.next/server/chunks/ssr/05w9_next_dist_client_components_builtin_global-error_0brpl_..js +0 -3
- package/dist/.next/server/chunks/ssr/05w9_next_dist_client_components_builtin_unauthorized_0~2g66g.js +0 -3
- package/dist/.next/server/chunks/ssr/05w9_next_dist_esm_build_templates_app-page_0~cyr1_.js +0 -4
- package/dist/.next/server/chunks/ssr/05w9_next_dist_esm_build_templates_app-page_1105emf.js +0 -4
- package/dist/.next/server/chunks/ssr/05w9_next_dist_esm_build_templates_app-page_11uhyqv.js +0 -4
- package/dist/.next/server/chunks/ssr/[root-of-the-server]__0.t9_75._.js +0 -33
- package/dist/.next/server/chunks/ssr/[root-of-the-server]__0c0ud_z._.js +0 -3
- package/dist/.next/server/chunks/ssr/[root-of-the-server]__0f9_8d4._.js +0 -3
- package/dist/.next/server/chunks/ssr/[root-of-the-server]__0l5ko41._.js +0 -19
- package/dist/.next/server/chunks/ssr/[root-of-the-server]__0mn6z7i._.js +0 -3
- package/dist/.next/server/chunks/ssr/[root-of-the-server]__0npxxst._.js +0 -33
- package/dist/.next/server/chunks/ssr/[root-of-the-server]__0qjhaca._.js +0 -3
- package/dist/.next/server/chunks/ssr/[root-of-the-server]__0rwgw3s._.js +0 -3
- package/dist/.next/server/chunks/ssr/[turbopack]_runtime.js +0 -903
- package/dist/.next/server/chunks/ssr/_next-internal_server_app__global-error_page_actions_0k77kol.js +0 -3
- package/dist/.next/server/chunks/ssr/_next-internal_server_app__not-found_page_actions_0eq97pa.js +0 -3
- package/dist/.next/server/chunks/ssr/_next-internal_server_app_page_actions_09-gtaw.js +0 -3
- package/dist/.next/server/chunks/ssr/node_modules__pnpm_056~6.6._.js +0 -3
- package/dist/.next/server/chunks/ssr/node_modules__pnpm_0~j0k.e._.js +0 -33
- package/dist/.next/server/functions-config-manifest.json +0 -4
- package/dist/.next/server/middleware-build-manifest.js +0 -20
- package/dist/.next/server/middleware-manifest.json +0 -6
- package/dist/.next/server/next-font-manifest.js +0 -1
- package/dist/.next/server/next-font-manifest.json +0 -13
- package/dist/.next/server/pages/404.html +0 -1
- package/dist/.next/server/pages/500.html +0 -1
- package/dist/.next/server/pages-manifest.json +0 -4
- package/dist/.next/server/prefetch-hints.json +0 -1
- package/dist/.next/server/server-reference-manifest.js +0 -1
- package/dist/.next/server/server-reference-manifest.json +0 -5
- package/dist/.next/static/SMWpxFVvkpYFxY7uuFvGB/_buildManifest.js +0 -11
- package/dist/.next/static/SMWpxFVvkpYFxY7uuFvGB/_clientMiddlewareManifest.js +0 -1
- package/dist/.next/static/SMWpxFVvkpYFxY7uuFvGB/_ssgManifest.js +0 -1
- package/dist/.next/static/chunks/01qk2~bgf76vu.js +0 -1
- package/dist/.next/static/chunks/03~yq9q893hmn.js +0 -1
- package/dist/.next/static/chunks/080queev.r2uy.js +0 -31
- package/dist/.next/static/chunks/0v3lyuj75aq50.js +0 -1
- package/dist/.next/static/chunks/10b~xdx5c-i7s.js +0 -5
- package/dist/.next/static/chunks/14gla2ascffgv.css +0 -2
- package/dist/.next/static/chunks/turbopack-0m-970~qvs7sc.js +0 -1
- package/dist/.next/static/media/7178b3e590c64307-s.11.cyxs5p-0z~.woff2 +0 -0
- package/dist/.next/static/media/8a480f0b521d4e75-s.06d3mdzz5bre_.woff2 +0 -0
- package/dist/.next/static/media/caa3a2e1cccd8315-s.p.16t1db8_9y2o~.woff2 +0 -0
- package/dist/package.json +0 -88
- package/dist/server.js +0 -38
- /package/{dist/.next/server/app/icon.svg.body → backend/src/flowent/static/favicon.svg} +0 -0
- /package/dist/{.next/static/media/icon.0.r~afrtrocz9.svg → frontend/favicon.svg} +0 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from typing import TYPE_CHECKING, Any, ClassVar
|
|
5
|
+
|
|
6
|
+
from flowent.mcp_service import MCPToolDescriptor, mcp_service
|
|
7
|
+
from flowent.tools import Tool
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from flowent.agent import Agent
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class DynamicMCPTool(Tool):
|
|
14
|
+
agent_visible = True
|
|
15
|
+
llm_visible = True
|
|
16
|
+
parameters: ClassVar[dict[str, Any]] = {
|
|
17
|
+
"type": "object",
|
|
18
|
+
"properties": {},
|
|
19
|
+
"required": [],
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
def __init__(self, descriptor: MCPToolDescriptor) -> None:
|
|
23
|
+
self._descriptor = descriptor
|
|
24
|
+
self.name = descriptor.fully_qualified_id
|
|
25
|
+
self.description = descriptor.description or f"MCP tool {descriptor.tool_name}"
|
|
26
|
+
self._parameters = descriptor.input_schema or {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"properties": {},
|
|
29
|
+
"required": [],
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
def to_schema(self) -> dict[str, Any]:
|
|
33
|
+
return {
|
|
34
|
+
"type": "function",
|
|
35
|
+
"function": {
|
|
36
|
+
"name": self.name,
|
|
37
|
+
"description": self.description,
|
|
38
|
+
"parameters": self._parameters,
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
def execute(self, agent: Agent, args: dict[str, Any], **_kwargs: Any) -> str:
|
|
43
|
+
result = mcp_service.call_agent_tool(
|
|
44
|
+
agent,
|
|
45
|
+
fully_qualified_id=self._descriptor.fully_qualified_id,
|
|
46
|
+
arguments=args,
|
|
47
|
+
)
|
|
48
|
+
return json.dumps(result, ensure_ascii=False)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class ListMCPResourcesTool(Tool):
|
|
52
|
+
name = "list_mcp_resources"
|
|
53
|
+
description = "List MCP resources visible in the current execution boundary."
|
|
54
|
+
parameters: ClassVar[dict[str, Any]] = {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"properties": {
|
|
57
|
+
"server_name": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"description": "Optional globally available MCP server name filter",
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"required": [],
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
def execute(self, agent: Agent, args: dict[str, Any], **_kwargs: Any) -> str:
|
|
66
|
+
server_name = args.get("server_name")
|
|
67
|
+
resources = mcp_service.list_agent_resources(
|
|
68
|
+
agent,
|
|
69
|
+
server_name=server_name
|
|
70
|
+
if isinstance(server_name, str) and server_name.strip()
|
|
71
|
+
else None,
|
|
72
|
+
)
|
|
73
|
+
return json.dumps(resources, ensure_ascii=False)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class ListMCPResourceTemplatesTool(Tool):
|
|
77
|
+
name = "list_mcp_resource_templates"
|
|
78
|
+
description = (
|
|
79
|
+
"List MCP resource templates visible in the current execution boundary."
|
|
80
|
+
)
|
|
81
|
+
parameters: ClassVar[dict[str, Any]] = {
|
|
82
|
+
"type": "object",
|
|
83
|
+
"properties": {
|
|
84
|
+
"server_name": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"description": "Optional globally available MCP server name filter",
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"required": [],
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
def execute(self, agent: Agent, args: dict[str, Any], **_kwargs: Any) -> str:
|
|
93
|
+
server_name = args.get("server_name")
|
|
94
|
+
templates = mcp_service.list_agent_resource_templates(
|
|
95
|
+
agent,
|
|
96
|
+
server_name=server_name
|
|
97
|
+
if isinstance(server_name, str) and server_name.strip()
|
|
98
|
+
else None,
|
|
99
|
+
)
|
|
100
|
+
return json.dumps(templates, ensure_ascii=False)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class ReadMCPResourceTool(Tool):
|
|
104
|
+
name = "read_mcp_resource"
|
|
105
|
+
description = "Read an MCP resource from a globally available server."
|
|
106
|
+
parameters: ClassVar[dict[str, Any]] = {
|
|
107
|
+
"type": "object",
|
|
108
|
+
"properties": {
|
|
109
|
+
"server_name": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"description": "Globally available MCP server name",
|
|
112
|
+
},
|
|
113
|
+
"uri": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"description": "Target MCP resource URI",
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
"required": ["server_name", "uri"],
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
def execute(self, agent: Agent, args: dict[str, Any], **_kwargs: Any) -> str:
|
|
122
|
+
server_name = args.get("server_name")
|
|
123
|
+
uri = args.get("uri")
|
|
124
|
+
if not isinstance(server_name, str) or not server_name.strip():
|
|
125
|
+
return json.dumps({"error": "server_name is required"})
|
|
126
|
+
if not isinstance(uri, str) or not uri.strip():
|
|
127
|
+
return json.dumps({"error": "uri is required"})
|
|
128
|
+
result = mcp_service.read_agent_resource(
|
|
129
|
+
agent,
|
|
130
|
+
server_name=server_name.strip(),
|
|
131
|
+
uri=uri.strip(),
|
|
132
|
+
)
|
|
133
|
+
return json.dumps(result, ensure_ascii=False)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class ListMCPPromptsTool(Tool):
|
|
137
|
+
name = "list_mcp_prompts"
|
|
138
|
+
description = "List MCP prompts visible in the current execution boundary."
|
|
139
|
+
parameters: ClassVar[dict[str, Any]] = {
|
|
140
|
+
"type": "object",
|
|
141
|
+
"properties": {
|
|
142
|
+
"server_name": {
|
|
143
|
+
"type": "string",
|
|
144
|
+
"description": "Optional globally available MCP server name filter",
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"required": [],
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
def execute(self, agent: Agent, args: dict[str, Any], **_kwargs: Any) -> str:
|
|
151
|
+
server_name = args.get("server_name")
|
|
152
|
+
prompts = mcp_service.list_agent_prompts(
|
|
153
|
+
agent,
|
|
154
|
+
server_name=server_name
|
|
155
|
+
if isinstance(server_name, str) and server_name.strip()
|
|
156
|
+
else None,
|
|
157
|
+
)
|
|
158
|
+
return json.dumps(prompts, ensure_ascii=False)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
class GetMCPPromptTool(Tool):
|
|
162
|
+
name = "get_mcp_prompt"
|
|
163
|
+
description = "Get an MCP prompt from a globally available server."
|
|
164
|
+
parameters: ClassVar[dict[str, Any]] = {
|
|
165
|
+
"type": "object",
|
|
166
|
+
"properties": {
|
|
167
|
+
"server_name": {
|
|
168
|
+
"type": "string",
|
|
169
|
+
"description": "Globally available MCP server name",
|
|
170
|
+
},
|
|
171
|
+
"name": {
|
|
172
|
+
"type": "string",
|
|
173
|
+
"description": "Prompt name",
|
|
174
|
+
},
|
|
175
|
+
"arguments": {
|
|
176
|
+
"type": "object",
|
|
177
|
+
"description": "Optional prompt arguments",
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
"required": ["server_name", "name"],
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
def execute(self, agent: Agent, args: dict[str, Any], **_kwargs: Any) -> str:
|
|
184
|
+
server_name = args.get("server_name")
|
|
185
|
+
name = args.get("name")
|
|
186
|
+
arguments = args.get("arguments")
|
|
187
|
+
if not isinstance(server_name, str) or not server_name.strip():
|
|
188
|
+
return json.dumps({"error": "server_name is required"})
|
|
189
|
+
if not isinstance(name, str) or not name.strip():
|
|
190
|
+
return json.dumps({"error": "name is required"})
|
|
191
|
+
if arguments is not None and not isinstance(arguments, dict):
|
|
192
|
+
return json.dumps({"error": "arguments must be an object"})
|
|
193
|
+
result = mcp_service.get_agent_prompt(
|
|
194
|
+
agent,
|
|
195
|
+
server_name=server_name.strip(),
|
|
196
|
+
name=name.strip(),
|
|
197
|
+
arguments=arguments if isinstance(arguments, dict) else None,
|
|
198
|
+
)
|
|
199
|
+
return json.dumps(result, ensure_ascii=False)
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
from collections.abc import Callable
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import TYPE_CHECKING, Any, ClassVar
|
|
8
|
+
|
|
9
|
+
from loguru import logger
|
|
10
|
+
|
|
11
|
+
from flowent.tools import Tool, re_raise_interrupt
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from flowent.agent import Agent
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _append_stream_chunk(
|
|
18
|
+
buffer: list[str],
|
|
19
|
+
size: int,
|
|
20
|
+
text: str,
|
|
21
|
+
on_output: Callable[[str], None] | None,
|
|
22
|
+
) -> int:
|
|
23
|
+
if on_output is None or not text:
|
|
24
|
+
return size
|
|
25
|
+
buffer.append(text)
|
|
26
|
+
size += len(text)
|
|
27
|
+
if size >= 2048:
|
|
28
|
+
on_output("".join(buffer))
|
|
29
|
+
buffer.clear()
|
|
30
|
+
return 0
|
|
31
|
+
return size
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _flush_stream_chunk(
|
|
35
|
+
buffer: list[str], on_output: Callable[[str], None] | None
|
|
36
|
+
) -> None:
|
|
37
|
+
if on_output is None or not buffer:
|
|
38
|
+
return
|
|
39
|
+
on_output("".join(buffer))
|
|
40
|
+
buffer.clear()
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class ReadTool(Tool):
|
|
44
|
+
name = "read"
|
|
45
|
+
description = (
|
|
46
|
+
"Read a file with line numbers, or list a directory. "
|
|
47
|
+
"Use start_line and end_line to read a specific range (1-indexed, inclusive). "
|
|
48
|
+
"Line numbers in the output are used as input to the edit tool."
|
|
49
|
+
)
|
|
50
|
+
parameters: ClassVar[dict[str, Any]] = {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"properties": {
|
|
53
|
+
"path": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"description": "Absolute path to the file or directory to read",
|
|
56
|
+
},
|
|
57
|
+
"start_line": {
|
|
58
|
+
"type": "integer",
|
|
59
|
+
"description": "First line to read (1-indexed, inclusive). Defaults to 1.",
|
|
60
|
+
},
|
|
61
|
+
"end_line": {
|
|
62
|
+
"type": "integer",
|
|
63
|
+
"description": "Last line to read (1-indexed, inclusive). Defaults to end of file.",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
"required": ["path"],
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
def execute(self, agent: Agent, args: dict[str, Any], **kwargs: Any) -> str:
|
|
70
|
+
path_str = args["path"]
|
|
71
|
+
real_path = Path(path_str)
|
|
72
|
+
on_output: Callable[[str], None] | None = kwargs.get("on_output")
|
|
73
|
+
|
|
74
|
+
if real_path.is_dir():
|
|
75
|
+
try:
|
|
76
|
+
entries = []
|
|
77
|
+
stream_buffer: list[str] = []
|
|
78
|
+
stream_size = 0
|
|
79
|
+
for entry in sorted(os.listdir(real_path)):
|
|
80
|
+
full = real_path / entry
|
|
81
|
+
kind = "dir" if full.is_dir() else "file"
|
|
82
|
+
size = full.stat().st_size if kind == "file" else None
|
|
83
|
+
entries.append({"name": entry, "type": kind, "size": size})
|
|
84
|
+
label = f"{kind}\t{entry}"
|
|
85
|
+
if size is not None:
|
|
86
|
+
label = f"{label}\t{size}"
|
|
87
|
+
stream_size = _append_stream_chunk(
|
|
88
|
+
stream_buffer,
|
|
89
|
+
stream_size,
|
|
90
|
+
f"{label}\n",
|
|
91
|
+
on_output,
|
|
92
|
+
)
|
|
93
|
+
_flush_stream_chunk(stream_buffer, on_output)
|
|
94
|
+
logger.debug(
|
|
95
|
+
"Listed directory: {} ({} entries)", path_str, len(entries)
|
|
96
|
+
)
|
|
97
|
+
return json.dumps({"path": path_str, "entries": entries})
|
|
98
|
+
except Exception as e:
|
|
99
|
+
re_raise_interrupt(agent, e)
|
|
100
|
+
return json.dumps({"error": str(e)})
|
|
101
|
+
|
|
102
|
+
if real_path.is_file():
|
|
103
|
+
try:
|
|
104
|
+
with open(real_path, encoding="utf-8") as f:
|
|
105
|
+
total_lines = sum(1 for _ in f)
|
|
106
|
+
|
|
107
|
+
start = max(1, int(args.get("start_line", 1)))
|
|
108
|
+
end = min(total_lines, int(args.get("end_line", total_lines)))
|
|
109
|
+
width = max(6, len(str(total_lines)))
|
|
110
|
+
selected_parts: list[str] = []
|
|
111
|
+
stream_buffer = []
|
|
112
|
+
stream_size = 0
|
|
113
|
+
|
|
114
|
+
with open(real_path, encoding="utf-8") as f:
|
|
115
|
+
for line_number, line in enumerate(f, start=1):
|
|
116
|
+
if line_number < start:
|
|
117
|
+
continue
|
|
118
|
+
if line_number > end:
|
|
119
|
+
break
|
|
120
|
+
numbered_line = f"{line_number:{width}d}\t{line}"
|
|
121
|
+
selected_parts.append(numbered_line)
|
|
122
|
+
stream_size = _append_stream_chunk(
|
|
123
|
+
stream_buffer,
|
|
124
|
+
stream_size,
|
|
125
|
+
numbered_line,
|
|
126
|
+
on_output,
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
_flush_stream_chunk(stream_buffer, on_output)
|
|
130
|
+
numbered = "".join(selected_parts)
|
|
131
|
+
|
|
132
|
+
logger.debug(
|
|
133
|
+
"Read file: {} (lines {}-{} of {})",
|
|
134
|
+
path_str,
|
|
135
|
+
start,
|
|
136
|
+
end,
|
|
137
|
+
total_lines,
|
|
138
|
+
)
|
|
139
|
+
return json.dumps(
|
|
140
|
+
{
|
|
141
|
+
"path": path_str,
|
|
142
|
+
"total_lines": total_lines,
|
|
143
|
+
"start_line": start,
|
|
144
|
+
"end_line": end,
|
|
145
|
+
"content": numbered,
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
except Exception as e:
|
|
149
|
+
re_raise_interrupt(agent, e)
|
|
150
|
+
return json.dumps({"error": str(e)})
|
|
151
|
+
|
|
152
|
+
return json.dumps({"error": f"Not found: {path_str}"})
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING, Any, ClassVar
|
|
4
|
+
|
|
5
|
+
from flowent.tools import Tool
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from flowent.agent import Agent
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SendTool(Tool):
|
|
12
|
+
name = "send"
|
|
13
|
+
description = "Send a formal message to one current contact."
|
|
14
|
+
parameters: ClassVar[dict[str, Any]] = {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"properties": {
|
|
17
|
+
"target": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "One target id, name, or unique short id from contacts.",
|
|
20
|
+
},
|
|
21
|
+
"parts": {
|
|
22
|
+
"type": "array",
|
|
23
|
+
"description": "Ordered message parts to send.",
|
|
24
|
+
"items": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"properties": {
|
|
27
|
+
"type": {"type": "string", "enum": ["text", "image"]},
|
|
28
|
+
"text": {"type": "string"},
|
|
29
|
+
"asset_id": {"type": "string"},
|
|
30
|
+
"mime_type": {"type": "string"},
|
|
31
|
+
"width": {"type": "integer"},
|
|
32
|
+
"height": {"type": "integer"},
|
|
33
|
+
"alt": {"type": "string"},
|
|
34
|
+
},
|
|
35
|
+
"required": ["type"],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
"required": ["target", "parts"],
|
|
40
|
+
"additionalProperties": False,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
def execute(self, agent: Agent, args: dict[str, Any], **_kwargs: Any) -> str:
|
|
44
|
+
target = args.get("target")
|
|
45
|
+
if not isinstance(target, str) or not target.strip():
|
|
46
|
+
raise ValueError("send.target must be a non-empty string")
|
|
47
|
+
return agent.send_message(
|
|
48
|
+
target_ref=target.strip(),
|
|
49
|
+
raw_parts=args.get("parts"),
|
|
50
|
+
)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from typing import TYPE_CHECKING, Any, ClassVar
|
|
5
|
+
|
|
6
|
+
from flowent.tools import Tool
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from flowent.agent import Agent
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class SetPermissionsTool(Tool):
|
|
13
|
+
name = "set_permissions"
|
|
14
|
+
description = (
|
|
15
|
+
"Update a workflow's permission boundary by patching its bound Leader's "
|
|
16
|
+
"allow_network and write_dirs."
|
|
17
|
+
)
|
|
18
|
+
parameters: ClassVar[dict[str, Any]] = {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"properties": {
|
|
21
|
+
"workflow_id": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "ID of the workflow whose permission boundary should be updated",
|
|
24
|
+
},
|
|
25
|
+
"allow_network": {
|
|
26
|
+
"type": "boolean",
|
|
27
|
+
"description": "Optional patched network permission for the workflow boundary",
|
|
28
|
+
},
|
|
29
|
+
"write_dirs": {
|
|
30
|
+
"type": "array",
|
|
31
|
+
"items": {"type": "string"},
|
|
32
|
+
"description": "Optional patched writable directory boundary for the workflow",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
"required": ["workflow_id"],
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
def execute(self, agent: Agent, args: dict[str, Any], **_kwargs: Any) -> str:
|
|
39
|
+
from flowent.graph_service import set_tab_permissions
|
|
40
|
+
from flowent.settings import (
|
|
41
|
+
build_assistant_allow_network,
|
|
42
|
+
build_assistant_write_dirs,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
workflow_id = args.get("workflow_id")
|
|
46
|
+
raw_allow_network = args.get("allow_network")
|
|
47
|
+
raw_write_dirs = args.get("write_dirs")
|
|
48
|
+
|
|
49
|
+
if not isinstance(workflow_id, str) or not workflow_id.strip():
|
|
50
|
+
return json.dumps({"error": "workflow_id must be a non-empty string"})
|
|
51
|
+
|
|
52
|
+
allow_network: bool | None = None
|
|
53
|
+
if "allow_network" in args:
|
|
54
|
+
try:
|
|
55
|
+
allow_network = build_assistant_allow_network(
|
|
56
|
+
raw_allow_network,
|
|
57
|
+
field_name="allow_network",
|
|
58
|
+
)
|
|
59
|
+
except ValueError as exc:
|
|
60
|
+
return json.dumps({"error": str(exc)})
|
|
61
|
+
|
|
62
|
+
write_dirs: list[str] | None = None
|
|
63
|
+
if "write_dirs" in args:
|
|
64
|
+
try:
|
|
65
|
+
write_dirs = build_assistant_write_dirs(
|
|
66
|
+
raw_write_dirs,
|
|
67
|
+
field_name="write_dirs",
|
|
68
|
+
)
|
|
69
|
+
except ValueError as exc:
|
|
70
|
+
return json.dumps({"error": str(exc)})
|
|
71
|
+
|
|
72
|
+
result, error = set_tab_permissions(
|
|
73
|
+
tab_id=workflow_id.strip(),
|
|
74
|
+
allow_network=allow_network,
|
|
75
|
+
write_dirs=write_dirs,
|
|
76
|
+
caller_allow_network=agent.config.allow_network,
|
|
77
|
+
caller_write_dirs=list(agent.config.write_dirs),
|
|
78
|
+
actor_id=agent.uuid,
|
|
79
|
+
)
|
|
80
|
+
if error is not None or result is None:
|
|
81
|
+
return json.dumps(
|
|
82
|
+
{"error": error or "Failed to update workflow permissions"}
|
|
83
|
+
)
|
|
84
|
+
return json.dumps(result)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from math import isfinite
|
|
5
|
+
from typing import TYPE_CHECKING, Any, ClassVar
|
|
6
|
+
|
|
7
|
+
from flowent.tools import Tool
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from flowent.agent import Agent
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class SleepTool(Tool):
|
|
14
|
+
name = "sleep"
|
|
15
|
+
description = (
|
|
16
|
+
"Enter a timed wait that resumes on whichever happens first: a new input "
|
|
17
|
+
"arrives or the requested duration elapses. Use this when you want to wait "
|
|
18
|
+
"until a deadline without missing messages."
|
|
19
|
+
)
|
|
20
|
+
parameters: ClassVar[dict[str, Any]] = {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"seconds": {
|
|
24
|
+
"type": "number",
|
|
25
|
+
"description": "How many seconds to wait before resuming execution. Supports fractional seconds.",
|
|
26
|
+
"minimum": 0,
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"required": ["seconds"],
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
def execute(self, agent: Agent, args: dict[str, Any], **_kwargs: Any) -> str:
|
|
33
|
+
seconds = args.get("seconds")
|
|
34
|
+
if isinstance(seconds, bool) or not isinstance(seconds, int | float):
|
|
35
|
+
return json.dumps({"error": "seconds must be a non-negative number"})
|
|
36
|
+
|
|
37
|
+
duration = float(seconds)
|
|
38
|
+
if not isfinite(duration) or duration < 0:
|
|
39
|
+
return json.dumps({"error": "seconds must be a non-negative number"})
|
|
40
|
+
|
|
41
|
+
return agent.request_sleep(seconds=duration)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from typing import TYPE_CHECKING, Any, ClassVar
|
|
5
|
+
|
|
6
|
+
from flowent.events import event_bus
|
|
7
|
+
from flowent.models import Event, EventType, TodoItem
|
|
8
|
+
from flowent.tools import Tool
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from flowent.agent import Agent
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class TodoTool(Tool):
|
|
15
|
+
name = "todo"
|
|
16
|
+
description = "Replace the full todo list with a new ordered list of task strings."
|
|
17
|
+
parameters: ClassVar[dict[str, Any]] = {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"properties": {
|
|
20
|
+
"todos": {
|
|
21
|
+
"type": "array",
|
|
22
|
+
"items": {"type": "string"},
|
|
23
|
+
"description": "Complete replacement todo list. Pass an empty array to clear all todos.",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
"required": ["todos"],
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
def execute(self, agent: Agent, args: dict[str, Any], **_kwargs: Any) -> str:
|
|
30
|
+
raw_todos = args["todos"]
|
|
31
|
+
if not isinstance(raw_todos, list) or not all(
|
|
32
|
+
isinstance(item, str) for item in raw_todos
|
|
33
|
+
):
|
|
34
|
+
return json.dumps({"error": "todos must be an array of strings"})
|
|
35
|
+
|
|
36
|
+
next_todos = [TodoItem(text=item) for item in raw_todos]
|
|
37
|
+
agent.set_todos(next_todos)
|
|
38
|
+
self._emit_todo_event(agent)
|
|
39
|
+
return json.dumps({"status": "updated"})
|
|
40
|
+
|
|
41
|
+
@staticmethod
|
|
42
|
+
def _emit_todo_event(agent: Agent) -> None:
|
|
43
|
+
event_bus.emit(
|
|
44
|
+
Event(
|
|
45
|
+
type=EventType.NODE_TODOS_CHANGED,
|
|
46
|
+
agent_id=agent.uuid,
|
|
47
|
+
data={
|
|
48
|
+
"todos": [t.serialize() for t in agent.get_todos_snapshot()],
|
|
49
|
+
},
|
|
50
|
+
),
|
|
51
|
+
)
|