flowent 0.0.7 → 0.0.10
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 +0 -3
- package/backend/README.md +0 -3
- package/backend/pyproject.toml +2 -8
- package/backend/src/flowent/__pycache__/__init__.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/agent.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/cli.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/context.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/llm.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__/patch.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/paths.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/sandbox.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/storage.cpython-313.pyc +0 -0
- package/backend/src/flowent/__pycache__/tools.cpython-313.pyc +0 -0
- package/backend/src/flowent/agent.py +213 -3173
- package/backend/src/flowent/cli.py +19 -24
- package/backend/src/flowent/context.py +127 -0
- package/backend/src/flowent/llm.py +256 -0
- package/backend/src/flowent/logging.py +170 -129
- package/backend/src/flowent/main.py +321 -70
- package/backend/src/flowent/patch.py +182 -0
- package/backend/src/flowent/paths.py +11 -0
- package/backend/src/flowent/sandbox.py +214 -40
- package/backend/src/flowent/static/assets/geist-cyrillic-wght-normal-CHSlOQsW.woff2 +0 -0
- package/backend/src/flowent/static/assets/geist-latin-ext-wght-normal-DMtmJ5ZE.woff2 +0 -0
- package/backend/src/flowent/static/assets/geist-latin-wght-normal-Dm3htQBi.woff2 +0 -0
- package/backend/src/flowent/static/assets/index-C76K95ty.js +81 -0
- package/backend/src/flowent/static/assets/index-iUMNKvlU.css +2 -0
- package/backend/src/flowent/static/flowent.png +0 -0
- package/backend/src/flowent/static/index.html +5 -25
- package/backend/src/flowent/storage.py +302 -0
- package/backend/src/flowent/tools.py +364 -0
- package/backend/tests/__pycache__/test_agent_tools.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/__pycache__/test_health.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/__pycache__/test_llm_providers.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/__pycache__/test_logging.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/__pycache__/test_persistence.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/__pycache__/test_workspace_chat.cpython-313-pytest-9.0.3.pyc +0 -0
- package/backend/tests/test_agent_tools.py +449 -0
- package/backend/tests/test_health.py +12 -0
- package/backend/tests/test_llm_providers.py +113 -0
- package/backend/tests/test_logging.py +182 -0
- package/backend/tests/test_persistence.py +125 -0
- package/backend/tests/test_workspace_chat.py +578 -0
- package/backend/uv.lock +803 -99
- package/dist/frontend/assets/geist-cyrillic-wght-normal-CHSlOQsW.woff2 +0 -0
- package/dist/frontend/assets/geist-latin-ext-wght-normal-DMtmJ5ZE.woff2 +0 -0
- package/dist/frontend/assets/geist-latin-wght-normal-Dm3htQBi.woff2 +0 -0
- package/dist/frontend/assets/index-C76K95ty.js +81 -0
- package/dist/frontend/assets/index-iUMNKvlU.css +2 -0
- package/dist/frontend/flowent.png +0 -0
- package/dist/frontend/index.html +5 -25
- package/package.json +1 -2
- 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__/assistant_commands.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__/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__/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/access.py +0 -247
- package/backend/src/flowent/assistant_commands.py +0 -115
- package/backend/src/flowent/channels/__init__.py +0 -3
- 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 +0 -615
- package/backend/src/flowent/config.py +0 -14
- package/backend/src/flowent/dev.py +0 -3
- package/backend/src/flowent/events.py +0 -157
- package/backend/src/flowent/graph_runtime.py +0 -60
- package/backend/src/flowent/graph_service.py +0 -2401
- package/backend/src/flowent/image_assets.py +0 -356
- package/backend/src/flowent/model_metadata.py +0 -102
- package/backend/src/flowent/models/__init__.py +0 -125
- 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 +0 -34
- package/backend/src/flowent/models/base.py +0 -24
- package/backend/src/flowent/models/blueprint.py +0 -176
- package/backend/src/flowent/models/content.py +0 -164
- package/backend/src/flowent/models/delta.py +0 -44
- package/backend/src/flowent/models/event.py +0 -51
- package/backend/src/flowent/models/graph.py +0 -472
- package/backend/src/flowent/models/history.py +0 -272
- package/backend/src/flowent/models/llm.py +0 -62
- package/backend/src/flowent/models/message.py +0 -33
- package/backend/src/flowent/models/tab.py +0 -85
- package/backend/src/flowent/models/todo.py +0 -10
- package/backend/src/flowent/network.py +0 -146
- package/backend/src/flowent/observability_service.py +0 -218
- package/backend/src/flowent/prompts/__init__.py +0 -67
- 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 +0 -250
- package/backend/src/flowent/prompts/steward.py +0 -64
- package/backend/src/flowent/providers/__init__.py +0 -23
- 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 +0 -468
- package/backend/src/flowent/providers/base_url.py +0 -60
- package/backend/src/flowent/providers/configuration.py +0 -189
- package/backend/src/flowent/providers/content.py +0 -122
- package/backend/src/flowent/providers/errors.py +0 -223
- package/backend/src/flowent/providers/gateway.py +0 -169
- package/backend/src/flowent/providers/gemini.py +0 -447
- package/backend/src/flowent/providers/headers.py +0 -20
- package/backend/src/flowent/providers/management.py +0 -96
- package/backend/src/flowent/providers/ollama.py +0 -293
- package/backend/src/flowent/providers/openai.py +0 -422
- package/backend/src/flowent/providers/openai_responses.py +0 -655
- package/backend/src/flowent/providers/registry.py +0 -144
- package/backend/src/flowent/providers/sse.py +0 -31
- package/backend/src/flowent/providers/thinking.py +0 -79
- package/backend/src/flowent/registry.py +0 -73
- package/backend/src/flowent/role_management.py +0 -270
- package/backend/src/flowent/routes/__init__.py +0 -26
- 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__/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 +0 -48
- package/backend/src/flowent/routes/assistant.py +0 -158
- package/backend/src/flowent/routes/image_assets.py +0 -33
- package/backend/src/flowent/routes/meta.py +0 -28
- package/backend/src/flowent/routes/nodes.py +0 -423
- package/backend/src/flowent/routes/prompts.py +0 -46
- package/backend/src/flowent/routes/providers_route.py +0 -365
- package/backend/src/flowent/routes/roles.py +0 -207
- package/backend/src/flowent/routes/settings.py +0 -379
- package/backend/src/flowent/routes/tabs.py +0 -298
- package/backend/src/flowent/routes/ws.py +0 -33
- package/backend/src/flowent/runtime.py +0 -160
- package/backend/src/flowent/security.py +0 -37
- package/backend/src/flowent/settings.py +0 -2112
- package/backend/src/flowent/settings_management.py +0 -394
- package/backend/src/flowent/state_db.py +0 -108
- package/backend/src/flowent/static/assets/AssistantPage-BW7XAd9I.js +0 -1
- package/backend/src/flowent/static/assets/ChannelsPage-tCJHgt6m.js +0 -1
- package/backend/src/flowent/static/assets/PageScaffold-f6g2l7XN.js +0 -1
- package/backend/src/flowent/static/assets/PromptsPage-C3Sxn2D7.js +0 -1
- package/backend/src/flowent/static/assets/ProvidersPage-BfmdXmNt.js +0 -3
- package/backend/src/flowent/static/assets/RolesPage-DET8wO4r.js +0 -1
- package/backend/src/flowent/static/assets/SettingsPage-D-g3deMm.js +0 -3
- package/backend/src/flowent/static/assets/ToolsPage-CDmtE2g4.js +0 -1
- package/backend/src/flowent/static/assets/WorkspacePage-AZsJ0sD0.js +0 -3
- package/backend/src/flowent/static/assets/WorkspacePanels-CteCjolX.js +0 -1
- package/backend/src/flowent/static/assets/alert-dialog-Duorp_S-.js +0 -1
- package/backend/src/flowent/static/assets/dialog-C3ixjGjN.js +0 -1
- package/backend/src/flowent/static/assets/elk-worker.min-C9JGDOE-.js +0 -6312
- package/backend/src/flowent/static/assets/graph-vendor-CHpVij2M.css +0 -1
- package/backend/src/flowent/static/assets/graph-vendor-DRq_-6fV.js +0 -7
- package/backend/src/flowent/static/assets/index--o_0fv0N.css +0 -1
- package/backend/src/flowent/static/assets/index-C9HuekJm.js +0 -10
- package/backend/src/flowent/static/assets/layout.worker-jMHqAFbP.js +0 -24
- package/backend/src/flowent/static/assets/markdown-vendor-C9RtvaJh.js +0 -29
- package/backend/src/flowent/static/assets/modelParams-DmnF2hwR.js +0 -1
- package/backend/src/flowent/static/assets/providerTypes-DT3Ahwl_.js +0 -1
- package/backend/src/flowent/static/assets/react-vendor-mEs_JJxa.js +0 -9
- package/backend/src/flowent/static/assets/roles-CuRT_chR.js +0 -1
- package/backend/src/flowent/static/assets/rolldown-runtime-BYbx6iT9.js +0 -1
- package/backend/src/flowent/static/assets/select-DCfeNu-F.js +0 -1
- package/backend/src/flowent/static/assets/surface-pWwG5ogx.js +0 -1
- package/backend/src/flowent/static/assets/ui-vendor-C5pJa8N7.js +0 -51
- package/backend/src/flowent/static/assets/useAppRoute-FgSHBKhV.js +0 -1
- package/backend/src/flowent/static/favicon.svg +0 -4
- package/backend/src/flowent/tools/__init__.py +0 -176
- 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__/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 +0 -100
- package/backend/src/flowent/tools/contacts.py +0 -22
- package/backend/src/flowent/tools/create_agent.py +0 -191
- package/backend/src/flowent/tools/create_tab.py +0 -61
- package/backend/src/flowent/tools/delete_tab.py +0 -39
- package/backend/src/flowent/tools/edit.py +0 -142
- package/backend/src/flowent/tools/exec.py +0 -118
- package/backend/src/flowent/tools/fetch.py +0 -85
- package/backend/src/flowent/tools/idle.py +0 -27
- package/backend/src/flowent/tools/list_roles.py +0 -68
- package/backend/src/flowent/tools/list_tabs.py +0 -100
- package/backend/src/flowent/tools/list_tools.py +0 -28
- package/backend/src/flowent/tools/manage_prompts.py +0 -102
- package/backend/src/flowent/tools/manage_providers.py +0 -220
- package/backend/src/flowent/tools/manage_roles.py +0 -275
- package/backend/src/flowent/tools/manage_settings.py +0 -326
- package/backend/src/flowent/tools/read.py +0 -152
- package/backend/src/flowent/tools/send.py +0 -68
- package/backend/src/flowent/tools/set_permissions.py +0 -99
- package/backend/src/flowent/tools/sleep.py +0 -41
- package/backend/src/flowent/tools/todo.py +0 -51
- package/backend/src/flowent/workspace_store.py +0 -479
- 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 +0 -6
- 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_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 +0 -29
- package/backend/tests/integration/api/test_access_api.py +0 -182
- package/backend/tests/integration/api/test_assistant_api.py +0 -422
- package/backend/tests/integration/api/test_frontend_mounting.py +0 -61
- package/backend/tests/integration/api/test_meta_api.py +0 -32
- package/backend/tests/integration/api/test_nodes_api.py +0 -787
- package/backend/tests/integration/api/test_prompts_api.py +0 -47
- package/backend/tests/integration/api/test_roles_api.py +0 -228
- package/backend/tests/integration/api/test_tabs_api.py +0 -688
- 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 +0 -822
- package/backend/tests/unit/agent/test_agent_runtime.py +0 -3088
- 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 +0 -552
- 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 +0 -132
- 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 +0 -570
- 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 +0 -185
- package/backend/tests/unit/providers/test_errors.py +0 -68
- package/backend/tests/unit/providers/test_extract_delta_parts.py +0 -22
- package/backend/tests/unit/providers/test_openai_provider.py +0 -139
- package/backend/tests/unit/providers/test_openai_responses.py +0 -402
- package/backend/tests/unit/providers/test_provider_gateway.py +0 -359
- package/backend/tests/unit/providers/test_think_tag_parser.py +0 -36
- 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 +0 -82
- package/backend/tests/unit/routes/test_providers_route.py +0 -370
- package/backend/tests/unit/routes/test_roles_routes.py +0 -539
- package/backend/tests/unit/routes/test_settings_routes.py +0 -1123
- 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 +0 -1002
- 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 +0 -78
- 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 +0 -124
- 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 +0 -703
- package/backend/tests/unit/test_access.py +0 -45
- package/backend/tests/unit/test_cli.py +0 -102
- package/backend/tests/unit/test_graph_runtime.py +0 -72
- package/backend/tests/unit/test_network.py +0 -51
- package/backend/tests/unit/test_state_sqlite_storage.py +0 -87
- package/backend/tests/unit/test_workspace_store.py +0 -228
- 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 +0 -228
- package/backend/tests/unit/tools/test_create_agent_tool.py +0 -404
- package/backend/tests/unit/tools/test_delete_tab_tool.py +0 -116
- package/backend/tests/unit/tools/test_edit_tool.py +0 -115
- package/backend/tests/unit/tools/test_exec_tool.py +0 -81
- package/backend/tests/unit/tools/test_fetch_tool.py +0 -65
- package/backend/tests/unit/tools/test_manage_prompts_tool.py +0 -92
- package/backend/tests/unit/tools/test_manage_providers_tool.py +0 -460
- package/backend/tests/unit/tools/test_manage_roles_tool.py +0 -411
- package/backend/tests/unit/tools/test_manage_settings_tool.py +0 -611
- package/backend/tests/unit/tools/test_read_tool.py +0 -33
- package/backend/tests/unit/tools/test_set_permissions_tool.py +0 -595
- package/backend/tests/unit/tools/test_todo_tool.py +0 -37
- package/backend/tests/unit/tools/test_tool_registry.py +0 -199
- package/dist/frontend/assets/AssistantPage-BW7XAd9I.js +0 -1
- package/dist/frontend/assets/ChannelsPage-tCJHgt6m.js +0 -1
- package/dist/frontend/assets/PageScaffold-f6g2l7XN.js +0 -1
- package/dist/frontend/assets/PromptsPage-C3Sxn2D7.js +0 -1
- package/dist/frontend/assets/ProvidersPage-BfmdXmNt.js +0 -3
- package/dist/frontend/assets/RolesPage-DET8wO4r.js +0 -1
- package/dist/frontend/assets/SettingsPage-D-g3deMm.js +0 -3
- package/dist/frontend/assets/ToolsPage-CDmtE2g4.js +0 -1
- package/dist/frontend/assets/WorkspacePage-AZsJ0sD0.js +0 -3
- package/dist/frontend/assets/WorkspacePanels-CteCjolX.js +0 -1
- package/dist/frontend/assets/alert-dialog-Duorp_S-.js +0 -1
- package/dist/frontend/assets/dialog-C3ixjGjN.js +0 -1
- package/dist/frontend/assets/elk-worker.min-C9JGDOE-.js +0 -6312
- package/dist/frontend/assets/graph-vendor-CHpVij2M.css +0 -1
- package/dist/frontend/assets/graph-vendor-DRq_-6fV.js +0 -7
- package/dist/frontend/assets/index--o_0fv0N.css +0 -1
- package/dist/frontend/assets/index-C9HuekJm.js +0 -10
- package/dist/frontend/assets/layout.worker-jMHqAFbP.js +0 -24
- package/dist/frontend/assets/markdown-vendor-C9RtvaJh.js +0 -29
- package/dist/frontend/assets/modelParams-DmnF2hwR.js +0 -1
- package/dist/frontend/assets/providerTypes-DT3Ahwl_.js +0 -1
- package/dist/frontend/assets/react-vendor-mEs_JJxa.js +0 -9
- package/dist/frontend/assets/roles-CuRT_chR.js +0 -1
- package/dist/frontend/assets/rolldown-runtime-BYbx6iT9.js +0 -1
- package/dist/frontend/assets/select-DCfeNu-F.js +0 -1
- package/dist/frontend/assets/surface-pWwG5ogx.js +0 -1
- package/dist/frontend/assets/ui-vendor-C5pJa8N7.js +0 -51
- package/dist/frontend/assets/useAppRoute-FgSHBKhV.js +0 -1
- package/dist/frontend/favicon.svg +0 -4
|
@@ -1,272 +0,0 @@
|
|
|
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
|
-
]
|
|
@@ -1,62 +0,0 @@
|
|
|
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
|
|
@@ -1,33 +0,0 @@
|
|
|
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)
|
|
@@ -1,85 +0,0 @@
|
|
|
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
|
-
)
|
|
@@ -1,146 +0,0 @@
|
|
|
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
|
-
]
|