flowent 0.0.1 → 0.0.5
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 +20 -9
- package/backend/.python-version +1 -0
- package/backend/README.md +74 -0
- package/backend/pyproject.toml +58 -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__/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/_version.py +7 -0
- package/backend/src/flowent/access.py +247 -0
- package/backend/src/flowent/agent.py +3120 -0
- package/backend/src/flowent/assistant_commands.py +115 -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 +2508 -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 +1918 -0
- package/backend/src/flowent/model_metadata.py +102 -0
- package/backend/src/flowent/models/__init__.py +125 -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 +34 -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 +472 -0
- package/backend/src/flowent/models/history.py +272 -0
- package/backend/src/flowent/models/llm.py +62 -0
- package/backend/src/flowent/models/message.py +33 -0
- package/backend/src/flowent/models/tab.py +85 -0
- package/backend/src/flowent/models/todo.py +10 -0
- package/backend/src/flowent/network.py +146 -0
- package/backend/src/flowent/observability_service.py +218 -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 +189 -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 +267 -0
- package/backend/src/flowent/routes/__init__.py +28 -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__/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 +413 -0
- package/backend/src/flowent/routes/prompts.py +46 -0
- package/backend/src/flowent/routes/providers_route.py +365 -0
- package/backend/src/flowent/routes/roles.py +207 -0
- package/backend/src/flowent/routes/settings.py +328 -0
- package/backend/src/flowent/routes/tabs.py +310 -0
- package/backend/src/flowent/routes/ws.py +33 -0
- package/backend/src/flowent/runtime.py +165 -0
- package/backend/src/flowent/sandbox.py +45 -0
- package/backend/src/flowent/security.py +57 -0
- package/backend/src/flowent/settings.py +2518 -0
- package/backend/src/flowent/settings_management.py +298 -0
- package/backend/src/flowent/state_db.py +120 -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/datetime-eJqd0V2S.js +1 -0
- package/backend/src/flowent/static/assets/dialog-BOvHIBrg.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-Biio-CoI.js +10 -0
- package/backend/src/flowent/static/assets/index-CmQvO7sl.css +1 -0
- package/backend/src/flowent/static/assets/layout.worker-jMHqAFbP.js +24 -0
- package/backend/src/flowent/static/assets/markdown-vendor-C9RtvaJh.js +29 -0
- package/backend/src/flowent/static/assets/modelParams-DcEhGnu0.js +1 -0
- package/backend/src/flowent/static/assets/react-vendor-mEs_JJxa.js +9 -0
- package/backend/src/flowent/static/assets/roles-BbIEIMeG.js +1 -0
- package/backend/src/flowent/static/assets/rolldown-runtime-BYbx6iT9.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/triState-DgLlKdRR.js +1 -0
- package/backend/src/flowent/static/assets/ui-vendor-UazN8rcv.js +51 -0
- package/backend/src/flowent/static/index.html +35 -0
- package/backend/src/flowent/tools/__init__.py +275 -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 +100 -0
- package/backend/src/flowent/tools/contacts.py +22 -0
- package/backend/src/flowent/tools/create_agent.py +191 -0
- package/backend/src/flowent/tools/create_tab.py +61 -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 +118 -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 +75 -0
- package/backend/src/flowent/tools/list_tabs.py +100 -0
- package/backend/src/flowent/tools/list_tools.py +28 -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 +364 -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 +68 -0
- package/backend/src/flowent/tools/set_permissions.py +99 -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 +722 -0
- package/backend/tests/integration/api/test_prompts_api.py +47 -0
- package/backend/tests/integration/api/test_roles_api.py +228 -0
- package/backend/tests/integration/api/test_tabs_api.py +802 -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 +837 -0
- package/backend/tests/unit/agent/test_agent_runtime.py +2942 -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 +570 -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/test_prompts_routes.py +104 -0
- package/backend/tests/unit/routes/test_providers_route.py +370 -0
- package/backend/tests/unit/routes/test_roles_routes.py +535 -0
- package/backend/tests/unit/routes/test_settings_routes.py +1142 -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 +1002 -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 +124 -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 +751 -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 +159 -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 +228 -0
- package/backend/tests/unit/tools/test_create_agent_tool.py +436 -0
- package/backend/tests/unit/tools/test_delete_tab_tool.py +116 -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 +460 -0
- package/backend/tests/unit/tools/test_manage_roles_tool.py +411 -0
- package/backend/tests/unit/tools/test_manage_settings_tool.py +611 -0
- package/backend/tests/unit/tools/test_read_tool.py +33 -0
- package/backend/tests/unit/tools/test_set_permissions_tool.py +595 -0
- package/backend/tests/unit/tools/test_todo_tool.py +37 -0
- package/backend/tests/unit/tools/test_tool_registry.py +194 -0
- package/backend/uv.lock +1144 -0
- package/bin/flowent.mjs +62 -36
- 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/datetime-eJqd0V2S.js +1 -0
- package/dist/frontend/assets/dialog-BOvHIBrg.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-Biio-CoI.js +10 -0
- package/dist/frontend/assets/index-CmQvO7sl.css +1 -0
- package/dist/frontend/assets/layout.worker-jMHqAFbP.js +24 -0
- package/dist/frontend/assets/markdown-vendor-C9RtvaJh.js +29 -0
- package/dist/frontend/assets/modelParams-DcEhGnu0.js +1 -0
- package/dist/frontend/assets/react-vendor-mEs_JJxa.js +9 -0
- package/dist/frontend/assets/roles-BbIEIMeG.js +1 -0
- package/dist/frontend/assets/rolldown-runtime-BYbx6iT9.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/triState-DgLlKdRR.js +1 -0
- package/dist/frontend/assets/ui-vendor-UazN8rcv.js +51 -0
- package/dist/frontend/index.html +35 -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,272 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import time
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from flowent.models.base import Serializable
|
|
8
|
+
from flowent.models.content import (
|
|
9
|
+
ContentPart,
|
|
10
|
+
content_parts_to_text,
|
|
11
|
+
deserialize_content_parts,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass
|
|
16
|
+
class SystemEntry(Serializable):
|
|
17
|
+
content: str
|
|
18
|
+
timestamp: float = field(default_factory=time.time)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass
|
|
22
|
+
class ReceivedMessage(Serializable):
|
|
23
|
+
from_id: str
|
|
24
|
+
parts: list[ContentPart] = field(default_factory=list)
|
|
25
|
+
content: str = ""
|
|
26
|
+
message_id: str | None = None
|
|
27
|
+
from_output_port_key: str | None = None
|
|
28
|
+
to_input_port_key: str | None = None
|
|
29
|
+
value_summary: str | None = None
|
|
30
|
+
timestamp: float = field(default_factory=time.time)
|
|
31
|
+
|
|
32
|
+
def __post_init__(self) -> None:
|
|
33
|
+
if self.parts and not self.content:
|
|
34
|
+
self.content = content_parts_to_text(self.parts)
|
|
35
|
+
elif self.content and not self.parts:
|
|
36
|
+
self.parts = deserialize_content_parts(None, fallback_text=self.content)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@dataclass
|
|
40
|
+
class AssistantText(Serializable):
|
|
41
|
+
parts: list[ContentPart] = field(default_factory=list)
|
|
42
|
+
content: str = ""
|
|
43
|
+
timestamp: float = field(default_factory=time.time)
|
|
44
|
+
|
|
45
|
+
def __post_init__(self) -> None:
|
|
46
|
+
if self.parts and not self.content:
|
|
47
|
+
self.content = content_parts_to_text(self.parts)
|
|
48
|
+
elif self.content and not self.parts:
|
|
49
|
+
self.parts = deserialize_content_parts(None, fallback_text=self.content)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@dataclass
|
|
53
|
+
class SentMessage(Serializable):
|
|
54
|
+
to_id: str
|
|
55
|
+
parts: list[ContentPart] = field(default_factory=list)
|
|
56
|
+
content: str = ""
|
|
57
|
+
message_id: str | None = None
|
|
58
|
+
from_output_port_key: str | None = None
|
|
59
|
+
to_input_port_key: str | None = None
|
|
60
|
+
value_summary: str | None = None
|
|
61
|
+
timestamp: float = field(default_factory=time.time)
|
|
62
|
+
|
|
63
|
+
def __post_init__(self) -> None:
|
|
64
|
+
if self.parts and not self.content:
|
|
65
|
+
self.content = content_parts_to_text(self.parts)
|
|
66
|
+
elif self.content and not self.parts:
|
|
67
|
+
self.parts = deserialize_content_parts(None, fallback_text=self.content)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@dataclass
|
|
71
|
+
class AssistantThinking(Serializable):
|
|
72
|
+
content: str
|
|
73
|
+
timestamp: float = field(default_factory=time.time)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@dataclass
|
|
77
|
+
class ToolCall(Serializable):
|
|
78
|
+
tool_name: str
|
|
79
|
+
tool_call_id: str
|
|
80
|
+
arguments: dict[str, Any]
|
|
81
|
+
result: str | None = None
|
|
82
|
+
streaming: bool = False
|
|
83
|
+
timestamp: float = field(default_factory=time.time)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@dataclass
|
|
87
|
+
class ErrorEntry(Serializable):
|
|
88
|
+
content: str
|
|
89
|
+
timestamp: float = field(default_factory=time.time)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@dataclass
|
|
93
|
+
class CommandResultEntry(Serializable):
|
|
94
|
+
command_name: str
|
|
95
|
+
content: str
|
|
96
|
+
include_in_context: bool = False
|
|
97
|
+
timestamp: float = field(default_factory=time.time)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@dataclass
|
|
101
|
+
class PortInboundEntry(Serializable):
|
|
102
|
+
from_id: str
|
|
103
|
+
from_output_port_key: str
|
|
104
|
+
to_input_port_key: str
|
|
105
|
+
port_type: str
|
|
106
|
+
value: Any
|
|
107
|
+
source_label: str | None = None
|
|
108
|
+
value_summary: str | None = None
|
|
109
|
+
timestamp: float = field(default_factory=time.time)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
HistoryEntry = (
|
|
113
|
+
SystemEntry
|
|
114
|
+
| ReceivedMessage
|
|
115
|
+
| AssistantText
|
|
116
|
+
| SentMessage
|
|
117
|
+
| AssistantThinking
|
|
118
|
+
| ToolCall
|
|
119
|
+
| ErrorEntry
|
|
120
|
+
| CommandResultEntry
|
|
121
|
+
| PortInboundEntry
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def deserialize_history_entry(data: dict[str, Any]) -> HistoryEntry:
|
|
126
|
+
entry_type = data.get("type")
|
|
127
|
+
timestamp = data.get("timestamp")
|
|
128
|
+
timestamp_value = timestamp if isinstance(timestamp, (int, float)) else time.time()
|
|
129
|
+
|
|
130
|
+
if entry_type == "SystemEntry":
|
|
131
|
+
return SystemEntry(
|
|
132
|
+
content=str(data.get("content", "")),
|
|
133
|
+
timestamp=timestamp_value,
|
|
134
|
+
)
|
|
135
|
+
if entry_type == "ReceivedMessage":
|
|
136
|
+
parts = deserialize_content_parts(
|
|
137
|
+
data.get("parts"),
|
|
138
|
+
fallback_text=str(data.get("content", "")),
|
|
139
|
+
)
|
|
140
|
+
return ReceivedMessage(
|
|
141
|
+
from_id=str(data.get("from_id", "")),
|
|
142
|
+
parts=parts,
|
|
143
|
+
content=content_parts_to_text(parts),
|
|
144
|
+
message_id=(
|
|
145
|
+
str(data["message_id"])
|
|
146
|
+
if isinstance(data.get("message_id"), str)
|
|
147
|
+
else None
|
|
148
|
+
),
|
|
149
|
+
from_output_port_key=(
|
|
150
|
+
str(data["from_output_port_key"])
|
|
151
|
+
if isinstance(data.get("from_output_port_key"), str)
|
|
152
|
+
else None
|
|
153
|
+
),
|
|
154
|
+
to_input_port_key=(
|
|
155
|
+
str(data["to_input_port_key"])
|
|
156
|
+
if isinstance(data.get("to_input_port_key"), str)
|
|
157
|
+
else None
|
|
158
|
+
),
|
|
159
|
+
value_summary=(
|
|
160
|
+
str(data["value_summary"])
|
|
161
|
+
if isinstance(data.get("value_summary"), str)
|
|
162
|
+
else None
|
|
163
|
+
),
|
|
164
|
+
timestamp=timestamp_value,
|
|
165
|
+
)
|
|
166
|
+
if entry_type == "AssistantText":
|
|
167
|
+
parts = deserialize_content_parts(
|
|
168
|
+
data.get("parts"),
|
|
169
|
+
fallback_text=str(data.get("content", "")),
|
|
170
|
+
)
|
|
171
|
+
return AssistantText(
|
|
172
|
+
parts=parts,
|
|
173
|
+
content=content_parts_to_text(parts),
|
|
174
|
+
timestamp=timestamp_value,
|
|
175
|
+
)
|
|
176
|
+
if entry_type == "SentMessage":
|
|
177
|
+
parts = deserialize_content_parts(
|
|
178
|
+
data.get("parts"),
|
|
179
|
+
fallback_text=str(data.get("content", "")),
|
|
180
|
+
)
|
|
181
|
+
to_id = (
|
|
182
|
+
str(data["to_id"])
|
|
183
|
+
if isinstance(data.get("to_id"), str)
|
|
184
|
+
else (
|
|
185
|
+
str(data["to_ids"][0])
|
|
186
|
+
if isinstance(data.get("to_ids"), list)
|
|
187
|
+
and data["to_ids"]
|
|
188
|
+
and isinstance(data["to_ids"][0], str)
|
|
189
|
+
else ""
|
|
190
|
+
)
|
|
191
|
+
)
|
|
192
|
+
return SentMessage(
|
|
193
|
+
to_id=to_id,
|
|
194
|
+
parts=parts,
|
|
195
|
+
content=content_parts_to_text(parts),
|
|
196
|
+
message_id=(
|
|
197
|
+
str(data["message_id"])
|
|
198
|
+
if isinstance(data.get("message_id"), str)
|
|
199
|
+
else None
|
|
200
|
+
),
|
|
201
|
+
from_output_port_key=(
|
|
202
|
+
str(data["from_output_port_key"])
|
|
203
|
+
if isinstance(data.get("from_output_port_key"), str)
|
|
204
|
+
else None
|
|
205
|
+
),
|
|
206
|
+
to_input_port_key=(
|
|
207
|
+
str(data["to_input_port_key"])
|
|
208
|
+
if isinstance(data.get("to_input_port_key"), str)
|
|
209
|
+
else None
|
|
210
|
+
),
|
|
211
|
+
value_summary=(
|
|
212
|
+
str(data["value_summary"])
|
|
213
|
+
if isinstance(data.get("value_summary"), str)
|
|
214
|
+
else None
|
|
215
|
+
),
|
|
216
|
+
timestamp=timestamp_value,
|
|
217
|
+
)
|
|
218
|
+
if entry_type == "AssistantThinking":
|
|
219
|
+
return AssistantThinking(
|
|
220
|
+
content=str(data.get("content", "")),
|
|
221
|
+
timestamp=timestamp_value,
|
|
222
|
+
)
|
|
223
|
+
if entry_type == "ToolCall":
|
|
224
|
+
arguments = data.get("arguments")
|
|
225
|
+
return ToolCall(
|
|
226
|
+
tool_name=str(data.get("tool_name", "")),
|
|
227
|
+
tool_call_id=str(data.get("tool_call_id", "")),
|
|
228
|
+
arguments=arguments if isinstance(arguments, dict) else {},
|
|
229
|
+
result=str(data["result"]) if isinstance(data.get("result"), str) else None,
|
|
230
|
+
streaming=bool(data.get("streaming", False)),
|
|
231
|
+
timestamp=timestamp_value,
|
|
232
|
+
)
|
|
233
|
+
if entry_type == "ErrorEntry":
|
|
234
|
+
return ErrorEntry(
|
|
235
|
+
content=str(data.get("content", "")),
|
|
236
|
+
timestamp=timestamp_value,
|
|
237
|
+
)
|
|
238
|
+
if entry_type == "CommandResultEntry":
|
|
239
|
+
return CommandResultEntry(
|
|
240
|
+
command_name=str(data.get("command_name", "")),
|
|
241
|
+
content=str(data.get("content", "")),
|
|
242
|
+
include_in_context=bool(data.get("include_in_context", False)),
|
|
243
|
+
timestamp=timestamp_value,
|
|
244
|
+
)
|
|
245
|
+
if entry_type == "PortInboundEntry":
|
|
246
|
+
return PortInboundEntry(
|
|
247
|
+
from_id=str(data.get("from_id", "")),
|
|
248
|
+
from_output_port_key=str(data.get("from_output_port_key", "")),
|
|
249
|
+
to_input_port_key=str(data.get("to_input_port_key", "")),
|
|
250
|
+
port_type=str(data.get("port_type", "")),
|
|
251
|
+
value=data.get("value"),
|
|
252
|
+
source_label=(
|
|
253
|
+
str(data["source_label"])
|
|
254
|
+
if isinstance(data.get("source_label"), str)
|
|
255
|
+
else None
|
|
256
|
+
),
|
|
257
|
+
value_summary=(
|
|
258
|
+
str(data["value_summary"])
|
|
259
|
+
if isinstance(data.get("value_summary"), str)
|
|
260
|
+
else None
|
|
261
|
+
),
|
|
262
|
+
timestamp=timestamp_value,
|
|
263
|
+
)
|
|
264
|
+
raise ValueError(f"Unknown history entry type: {entry_type}")
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
def deserialize_history_entries(items: list[dict[str, Any]]) -> list[HistoryEntry]:
|
|
268
|
+
return [
|
|
269
|
+
deserialize_history_entry(item)
|
|
270
|
+
for item in items
|
|
271
|
+
if item.get("type") != "StateEntry"
|
|
272
|
+
]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass, field
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class ModelCapabilities:
|
|
9
|
+
input_image: bool = False
|
|
10
|
+
output_image: bool = False
|
|
11
|
+
structured_output: bool = False
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass
|
|
15
|
+
class ModelInfo:
|
|
16
|
+
id: str
|
|
17
|
+
capabilities: ModelCapabilities = field(default_factory=ModelCapabilities)
|
|
18
|
+
context_window_tokens: int | None = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass
|
|
22
|
+
class LLMUsage:
|
|
23
|
+
total_tokens: int
|
|
24
|
+
input_tokens: int | None = None
|
|
25
|
+
output_tokens: int | None = None
|
|
26
|
+
cached_input_tokens: int | None = None
|
|
27
|
+
cache_read_tokens: int | None = None
|
|
28
|
+
cache_write_tokens: int | None = None
|
|
29
|
+
details: dict[str, int] = field(default_factory=dict)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass
|
|
33
|
+
class ToolCallResult:
|
|
34
|
+
id: str
|
|
35
|
+
name: str
|
|
36
|
+
arguments: dict[str, Any]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@dataclass
|
|
40
|
+
class LLMOutputTextPart:
|
|
41
|
+
text: str
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass
|
|
45
|
+
class LLMOutputImagePart:
|
|
46
|
+
data: bytes
|
|
47
|
+
mime_type: str
|
|
48
|
+
width: int | None = None
|
|
49
|
+
height: int | None = None
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
LLMOutputPart = LLMOutputTextPart | LLMOutputImagePart
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass
|
|
56
|
+
class LLMResponse:
|
|
57
|
+
content: str | None = None
|
|
58
|
+
parts: list[LLMOutputPart] | None = None
|
|
59
|
+
tool_calls: list[ToolCallResult] | None = None
|
|
60
|
+
thinking: str | None = None
|
|
61
|
+
usage: LLMUsage | None = None
|
|
62
|
+
raw_usage: dict[str, Any] | None = None
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import time
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
|
|
6
|
+
from flowent.models.content import (
|
|
7
|
+
ContentPart,
|
|
8
|
+
content_parts_to_text,
|
|
9
|
+
deserialize_content_parts,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass
|
|
14
|
+
class Message:
|
|
15
|
+
from_id: str
|
|
16
|
+
to_id: str
|
|
17
|
+
parts: list[ContentPart] = field(default_factory=list)
|
|
18
|
+
content: str = ""
|
|
19
|
+
message_id: str | None = None
|
|
20
|
+
history_recorded: bool = False
|
|
21
|
+
from_output_port_key: str | None = None
|
|
22
|
+
to_input_port_key: str | None = None
|
|
23
|
+
port_type: str | None = None
|
|
24
|
+
value: object | None = None
|
|
25
|
+
value_summary: str | None = None
|
|
26
|
+
port_inbound_recorded: bool = False
|
|
27
|
+
timestamp: float = field(default_factory=time.time)
|
|
28
|
+
|
|
29
|
+
def __post_init__(self) -> None:
|
|
30
|
+
if self.parts and not self.content:
|
|
31
|
+
self.content = content_parts_to_text(self.parts)
|
|
32
|
+
elif self.content and not self.parts:
|
|
33
|
+
self.parts = deserialize_content_parts(None, fallback_text=self.content)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import time
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
|
|
6
|
+
from flowent.models.graph import WorkflowActivationState, WorkflowDefinition
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class Tab:
|
|
11
|
+
id: str
|
|
12
|
+
title: str
|
|
13
|
+
leader_id: str | None = None
|
|
14
|
+
definition: WorkflowDefinition = field(default_factory=WorkflowDefinition)
|
|
15
|
+
activation_state: WorkflowActivationState = WorkflowActivationState.INACTIVE
|
|
16
|
+
allow_network: bool = False
|
|
17
|
+
write_dirs: list[str] = field(default_factory=list)
|
|
18
|
+
permissions_initialized: bool = False
|
|
19
|
+
created_at: float = field(default_factory=time.time)
|
|
20
|
+
updated_at: float = field(default_factory=time.time)
|
|
21
|
+
|
|
22
|
+
def serialize(self) -> dict[str, object]:
|
|
23
|
+
return {
|
|
24
|
+
"id": self.id,
|
|
25
|
+
"title": self.title,
|
|
26
|
+
"leader_id": self.leader_id,
|
|
27
|
+
"definition": self.definition.serialize(),
|
|
28
|
+
"activation_state": self.activation_state.value,
|
|
29
|
+
"allow_network": self.allow_network,
|
|
30
|
+
"write_dirs": list(self.write_dirs),
|
|
31
|
+
"permissions_initialized": self.permissions_initialized,
|
|
32
|
+
"created_at": self.created_at,
|
|
33
|
+
"updated_at": self.updated_at,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def from_mapping(cls, data: dict[str, object]) -> Tab:
|
|
38
|
+
from flowent.settings import build_assistant_write_dirs
|
|
39
|
+
|
|
40
|
+
created_at = data.get("created_at")
|
|
41
|
+
updated_at = data.get("updated_at")
|
|
42
|
+
raw_definition = data.get("definition")
|
|
43
|
+
raw_activation_state = data.get("activation_state")
|
|
44
|
+
raw_permissions_initialized = data.get("permissions_initialized")
|
|
45
|
+
raw_write_dirs_value = data.get("write_dirs")
|
|
46
|
+
raw_write_dirs = (
|
|
47
|
+
[item for item in raw_write_dirs_value if isinstance(item, str)]
|
|
48
|
+
if isinstance(raw_write_dirs_value, list)
|
|
49
|
+
else []
|
|
50
|
+
)
|
|
51
|
+
try:
|
|
52
|
+
write_dirs = build_assistant_write_dirs(
|
|
53
|
+
raw_write_dirs,
|
|
54
|
+
field_name="write_dirs",
|
|
55
|
+
)
|
|
56
|
+
except ValueError:
|
|
57
|
+
write_dirs = []
|
|
58
|
+
try:
|
|
59
|
+
activation_state = WorkflowActivationState(str(raw_activation_state))
|
|
60
|
+
except ValueError:
|
|
61
|
+
activation_state = WorkflowActivationState.INACTIVE
|
|
62
|
+
return cls(
|
|
63
|
+
id=str(data.get("id", "")),
|
|
64
|
+
title=str(data.get("title", "")),
|
|
65
|
+
leader_id=str(data["leader_id"])
|
|
66
|
+
if isinstance(data.get("leader_id"), str)
|
|
67
|
+
else None,
|
|
68
|
+
definition=WorkflowDefinition.from_mapping(
|
|
69
|
+
raw_definition if isinstance(raw_definition, dict) else None
|
|
70
|
+
),
|
|
71
|
+
activation_state=activation_state,
|
|
72
|
+
allow_network=bool(data.get("allow_network", False)),
|
|
73
|
+
write_dirs=write_dirs,
|
|
74
|
+
permissions_initialized=(
|
|
75
|
+
bool(raw_permissions_initialized)
|
|
76
|
+
or "allow_network" in data
|
|
77
|
+
or "write_dirs" in data
|
|
78
|
+
),
|
|
79
|
+
created_at=created_at
|
|
80
|
+
if isinstance(created_at, (int, float))
|
|
81
|
+
else time.time(),
|
|
82
|
+
updated_at=updated_at
|
|
83
|
+
if isinstance(updated_at, (int, float))
|
|
84
|
+
else time.time(),
|
|
85
|
+
)
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Iterator
|
|
4
|
+
from typing import Any, Literal
|
|
5
|
+
|
|
6
|
+
from curl_cffi.requests import AsyncSession, Session
|
|
7
|
+
from curl_cffi.requests.exceptions import RequestException
|
|
8
|
+
|
|
9
|
+
DEFAULT_BROWSER_IMPERSONATE: Literal["chrome"] = "chrome"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def create_http_session(
|
|
13
|
+
*,
|
|
14
|
+
timeout: float,
|
|
15
|
+
impersonate_browser: bool = False,
|
|
16
|
+
) -> Session:
|
|
17
|
+
kwargs: dict[str, Any] = {"timeout": timeout}
|
|
18
|
+
if impersonate_browser:
|
|
19
|
+
kwargs["impersonate"] = DEFAULT_BROWSER_IMPERSONATE
|
|
20
|
+
return Session(**kwargs)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def create_async_http_session(
|
|
24
|
+
*,
|
|
25
|
+
timeout: float,
|
|
26
|
+
impersonate_browser: bool = False,
|
|
27
|
+
) -> AsyncSession:
|
|
28
|
+
kwargs: dict[str, Any] = {"timeout": timeout}
|
|
29
|
+
if impersonate_browser:
|
|
30
|
+
kwargs["impersonate"] = DEFAULT_BROWSER_IMPERSONATE
|
|
31
|
+
return AsyncSession(**kwargs)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def is_success_status(status_code: int) -> bool:
|
|
35
|
+
return 200 <= status_code < 300
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def iter_response_lines(response: Any) -> Iterator[str]:
|
|
39
|
+
for line in response.iter_lines():
|
|
40
|
+
normalized = _decode_to_text(line)
|
|
41
|
+
if normalized:
|
|
42
|
+
yield normalized
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def iter_response_text(response: Any) -> Iterator[str]:
|
|
46
|
+
iter_text = getattr(response, "iter_text", None)
|
|
47
|
+
if callable(iter_text):
|
|
48
|
+
for chunk in iter_text():
|
|
49
|
+
normalized = _decode_to_text(chunk)
|
|
50
|
+
if normalized:
|
|
51
|
+
yield normalized
|
|
52
|
+
return
|
|
53
|
+
|
|
54
|
+
for chunk in response.iter_content():
|
|
55
|
+
normalized = _decode_to_text(chunk)
|
|
56
|
+
if normalized:
|
|
57
|
+
yield normalized
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def read_response_text(response: Any) -> str:
|
|
61
|
+
text = getattr(response, "text", None)
|
|
62
|
+
if isinstance(text, str) and text:
|
|
63
|
+
return text
|
|
64
|
+
|
|
65
|
+
content = getattr(response, "content", None)
|
|
66
|
+
if isinstance(content, str) and content:
|
|
67
|
+
return content
|
|
68
|
+
if isinstance(content, (bytes, bytearray)) and content:
|
|
69
|
+
return bytes(content).decode("utf-8", errors="replace")
|
|
70
|
+
|
|
71
|
+
iter_text = getattr(response, "iter_text", None)
|
|
72
|
+
if callable(iter_text):
|
|
73
|
+
chunks = [_decode_to_text(chunk) for chunk in iter_text()]
|
|
74
|
+
if chunks:
|
|
75
|
+
return "".join(chunks)
|
|
76
|
+
|
|
77
|
+
iter_content = getattr(response, "iter_content", None)
|
|
78
|
+
if callable(iter_content):
|
|
79
|
+
chunks = [_decode_to_text(chunk) for chunk in iter_content()]
|
|
80
|
+
if chunks:
|
|
81
|
+
return "".join(chunks)
|
|
82
|
+
|
|
83
|
+
read = getattr(response, "read", None)
|
|
84
|
+
if callable(read):
|
|
85
|
+
payload = read()
|
|
86
|
+
if isinstance(payload, str):
|
|
87
|
+
return payload
|
|
88
|
+
if isinstance(payload, (bytes, bytearray)):
|
|
89
|
+
return bytes(payload).decode("utf-8", errors="replace")
|
|
90
|
+
|
|
91
|
+
return ""
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def get_response_header(response: Any, header_name: str) -> str | None:
|
|
95
|
+
headers = getattr(response, "headers", None)
|
|
96
|
+
if headers is None:
|
|
97
|
+
return None
|
|
98
|
+
getter = getattr(headers, "get", None)
|
|
99
|
+
if callable(getter):
|
|
100
|
+
value = getter(header_name)
|
|
101
|
+
if isinstance(value, str):
|
|
102
|
+
return value
|
|
103
|
+
if isinstance(headers, dict):
|
|
104
|
+
value = headers.get(header_name) or headers.get(header_name.lower())
|
|
105
|
+
if isinstance(value, str):
|
|
106
|
+
return value
|
|
107
|
+
return None
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def response_looks_like_html(response: Any) -> bool:
|
|
111
|
+
content_type = get_response_header(response, "content-type")
|
|
112
|
+
if not isinstance(content_type, str):
|
|
113
|
+
return False
|
|
114
|
+
normalized = content_type.lower()
|
|
115
|
+
return "text/html" in normalized or "application/xhtml+xml" in normalized
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def truncate_text(text: str, limit: int = 500) -> str:
|
|
119
|
+
if len(text) <= limit:
|
|
120
|
+
return text
|
|
121
|
+
return text[:limit]
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def _decode_to_text(value: Any) -> str:
|
|
125
|
+
if isinstance(value, str):
|
|
126
|
+
return value
|
|
127
|
+
if isinstance(value, (bytes, bytearray)):
|
|
128
|
+
return bytes(value).decode("utf-8", errors="replace")
|
|
129
|
+
return str(value)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
__all__ = [
|
|
133
|
+
"DEFAULT_BROWSER_IMPERSONATE",
|
|
134
|
+
"AsyncSession",
|
|
135
|
+
"RequestException",
|
|
136
|
+
"Session",
|
|
137
|
+
"create_async_http_session",
|
|
138
|
+
"create_http_session",
|
|
139
|
+
"get_response_header",
|
|
140
|
+
"is_success_status",
|
|
141
|
+
"iter_response_lines",
|
|
142
|
+
"iter_response_text",
|
|
143
|
+
"read_response_text",
|
|
144
|
+
"response_looks_like_html",
|
|
145
|
+
"truncate_text",
|
|
146
|
+
]
|