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,356 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import base64
|
|
4
|
-
import json
|
|
5
|
-
import struct
|
|
6
|
-
import tempfile
|
|
7
|
-
import uuid
|
|
8
|
-
from dataclasses import dataclass
|
|
9
|
-
from pathlib import Path
|
|
10
|
-
|
|
11
|
-
from flowent.state_db import (
|
|
12
|
-
get_images_dir,
|
|
13
|
-
get_legacy_image_assets_dir,
|
|
14
|
-
open_state_db,
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
ALLOWED_IMAGE_MIME_TYPES = frozenset(
|
|
18
|
-
{
|
|
19
|
-
"image/png",
|
|
20
|
-
"image/jpeg",
|
|
21
|
-
"image/gif",
|
|
22
|
-
"image/webp",
|
|
23
|
-
}
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
_IMAGE_EXTENSIONS = {
|
|
27
|
-
"image/png": ".png",
|
|
28
|
-
"image/jpeg": ".jpg",
|
|
29
|
-
"image/gif": ".gif",
|
|
30
|
-
"image/webp": ".webp",
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
@dataclass(frozen=True)
|
|
35
|
-
class ImageAsset:
|
|
36
|
-
id: str
|
|
37
|
-
stored_name: str
|
|
38
|
-
mime_type: str
|
|
39
|
-
width: int | None = None
|
|
40
|
-
height: int | None = None
|
|
41
|
-
original_name: str | None = None
|
|
42
|
-
|
|
43
|
-
@property
|
|
44
|
-
def file_path(self) -> Path:
|
|
45
|
-
return _get_assets_dir() / self.stored_name
|
|
46
|
-
|
|
47
|
-
@property
|
|
48
|
-
def url_path(self) -> str:
|
|
49
|
-
return f"/api/image-assets/{self.id}"
|
|
50
|
-
|
|
51
|
-
def serialize(self) -> dict[str, object]:
|
|
52
|
-
return {
|
|
53
|
-
"id": self.id,
|
|
54
|
-
"stored_name": self.stored_name,
|
|
55
|
-
"mime_type": self.mime_type,
|
|
56
|
-
"width": self.width,
|
|
57
|
-
"height": self.height,
|
|
58
|
-
"original_name": self.original_name,
|
|
59
|
-
"url": self.url_path,
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def _get_assets_dir() -> Path:
|
|
64
|
-
return get_images_dir()
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def _get_legacy_metadata_path(asset_id: str) -> Path:
|
|
68
|
-
return get_legacy_image_assets_dir() / f"{asset_id}.json"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
def _get_legacy_file_path(stored_name: str) -> Path:
|
|
72
|
-
return get_legacy_image_assets_dir() / stored_name
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
def _detect_mime_type(data: bytes) -> str | None:
|
|
76
|
-
if data.startswith(b"\x89PNG\r\n\x1a\n"):
|
|
77
|
-
return "image/png"
|
|
78
|
-
if data.startswith(b"\xff\xd8\xff"):
|
|
79
|
-
return "image/jpeg"
|
|
80
|
-
if data.startswith((b"GIF87a", b"GIF89a")):
|
|
81
|
-
return "image/gif"
|
|
82
|
-
if data.startswith(b"RIFF") and data[8:12] == b"WEBP":
|
|
83
|
-
return "image/webp"
|
|
84
|
-
return None
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
def _normalize_mime_type(data: bytes, mime_type: str | None) -> str:
|
|
88
|
-
normalized = mime_type.strip().lower() if isinstance(mime_type, str) else ""
|
|
89
|
-
if normalized in ALLOWED_IMAGE_MIME_TYPES:
|
|
90
|
-
return normalized
|
|
91
|
-
detected = _detect_mime_type(data)
|
|
92
|
-
if detected is not None:
|
|
93
|
-
return detected
|
|
94
|
-
raise ValueError("Unsupported image type. Allowed types: PNG, JPEG, GIF, WEBP.")
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def _read_png_size(data: bytes) -> tuple[int | None, int | None]:
|
|
98
|
-
if len(data) < 24:
|
|
99
|
-
return None, None
|
|
100
|
-
if data[12:16] != b"IHDR":
|
|
101
|
-
return None, None
|
|
102
|
-
width = struct.unpack(">I", data[16:20])[0]
|
|
103
|
-
height = struct.unpack(">I", data[20:24])[0]
|
|
104
|
-
return width, height
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
def _read_gif_size(data: bytes) -> tuple[int | None, int | None]:
|
|
108
|
-
if len(data) < 10:
|
|
109
|
-
return None, None
|
|
110
|
-
width, height = struct.unpack("<HH", data[6:10])
|
|
111
|
-
return width, height
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
def _read_jpeg_size(data: bytes) -> tuple[int | None, int | None]:
|
|
115
|
-
if len(data) < 4 or not data.startswith(b"\xff\xd8"):
|
|
116
|
-
return None, None
|
|
117
|
-
offset = 2
|
|
118
|
-
while offset + 1 < len(data):
|
|
119
|
-
if data[offset] != 0xFF:
|
|
120
|
-
offset += 1
|
|
121
|
-
continue
|
|
122
|
-
marker = data[offset + 1]
|
|
123
|
-
offset += 2
|
|
124
|
-
if marker in {0xD8, 0xD9}:
|
|
125
|
-
continue
|
|
126
|
-
if offset + 2 > len(data):
|
|
127
|
-
break
|
|
128
|
-
segment_length = struct.unpack(">H", data[offset : offset + 2])[0]
|
|
129
|
-
if segment_length < 2 or offset + segment_length > len(data):
|
|
130
|
-
break
|
|
131
|
-
if marker in {
|
|
132
|
-
0xC0,
|
|
133
|
-
0xC1,
|
|
134
|
-
0xC2,
|
|
135
|
-
0xC3,
|
|
136
|
-
0xC5,
|
|
137
|
-
0xC6,
|
|
138
|
-
0xC7,
|
|
139
|
-
0xC9,
|
|
140
|
-
0xCA,
|
|
141
|
-
0xCB,
|
|
142
|
-
0xCD,
|
|
143
|
-
0xCE,
|
|
144
|
-
0xCF,
|
|
145
|
-
}:
|
|
146
|
-
if offset + 7 > len(data):
|
|
147
|
-
break
|
|
148
|
-
height = struct.unpack(">H", data[offset + 3 : offset + 5])[0]
|
|
149
|
-
width = struct.unpack(">H", data[offset + 5 : offset + 7])[0]
|
|
150
|
-
return width, height
|
|
151
|
-
offset += segment_length
|
|
152
|
-
return None, None
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
def _read_webp_size(data: bytes) -> tuple[int | None, int | None]:
|
|
156
|
-
if len(data) < 30 or not data.startswith(b"RIFF") or data[8:12] != b"WEBP":
|
|
157
|
-
return None, None
|
|
158
|
-
chunk_type = data[12:16]
|
|
159
|
-
if chunk_type == b"VP8X" and len(data) >= 30:
|
|
160
|
-
width = 1 + int.from_bytes(data[24:27], "little")
|
|
161
|
-
height = 1 + int.from_bytes(data[27:30], "little")
|
|
162
|
-
return width, height
|
|
163
|
-
if chunk_type == b"VP8L" and len(data) >= 25:
|
|
164
|
-
value = int.from_bytes(data[21:25], "little")
|
|
165
|
-
width = (value & 0x3FFF) + 1
|
|
166
|
-
height = ((value >> 14) & 0x3FFF) + 1
|
|
167
|
-
return width, height
|
|
168
|
-
return None, None
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
def _read_image_size(data: bytes, mime_type: str) -> tuple[int | None, int | None]:
|
|
172
|
-
if mime_type == "image/png":
|
|
173
|
-
return _read_png_size(data)
|
|
174
|
-
if mime_type == "image/jpeg":
|
|
175
|
-
return _read_jpeg_size(data)
|
|
176
|
-
if mime_type == "image/gif":
|
|
177
|
-
return _read_gif_size(data)
|
|
178
|
-
if mime_type == "image/webp":
|
|
179
|
-
return _read_webp_size(data)
|
|
180
|
-
return None, None
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
def create_image_asset(
|
|
184
|
-
data: bytes,
|
|
185
|
-
*,
|
|
186
|
-
mime_type: str | None = None,
|
|
187
|
-
original_name: str | None = None,
|
|
188
|
-
) -> ImageAsset:
|
|
189
|
-
if not data:
|
|
190
|
-
raise ValueError("Image file is empty.")
|
|
191
|
-
normalized_mime_type = _normalize_mime_type(data, mime_type)
|
|
192
|
-
width, height = _read_image_size(data, normalized_mime_type)
|
|
193
|
-
asset_id = str(uuid.uuid4())
|
|
194
|
-
extension = _IMAGE_EXTENSIONS[normalized_mime_type]
|
|
195
|
-
stored_name = f"{asset_id}{extension}"
|
|
196
|
-
asset = ImageAsset(
|
|
197
|
-
id=asset_id,
|
|
198
|
-
stored_name=stored_name,
|
|
199
|
-
mime_type=normalized_mime_type,
|
|
200
|
-
width=width,
|
|
201
|
-
height=height,
|
|
202
|
-
original_name=original_name or None,
|
|
203
|
-
)
|
|
204
|
-
asset_dir = _get_assets_dir()
|
|
205
|
-
asset_dir.mkdir(parents=True, exist_ok=True)
|
|
206
|
-
|
|
207
|
-
with tempfile.NamedTemporaryFile("wb", dir=asset_dir, delete=False) as handle:
|
|
208
|
-
handle.write(data)
|
|
209
|
-
temp_file_path = Path(handle.name)
|
|
210
|
-
temp_file_path.replace(asset.file_path)
|
|
211
|
-
_persist_image_asset(asset)
|
|
212
|
-
return asset
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
def get_image_asset(asset_id: str) -> ImageAsset | None:
|
|
216
|
-
if not asset_id.strip():
|
|
217
|
-
return None
|
|
218
|
-
asset = _load_persisted_image_asset(asset_id)
|
|
219
|
-
if asset is not None:
|
|
220
|
-
if asset.file_path.is_file():
|
|
221
|
-
return asset
|
|
222
|
-
if _restore_legacy_image_file(asset):
|
|
223
|
-
return asset
|
|
224
|
-
return None
|
|
225
|
-
legacy_asset = _load_legacy_image_asset(asset_id)
|
|
226
|
-
if legacy_asset is None:
|
|
227
|
-
return None
|
|
228
|
-
_persist_image_asset(legacy_asset)
|
|
229
|
-
if _restore_legacy_image_file(legacy_asset):
|
|
230
|
-
return legacy_asset
|
|
231
|
-
return None
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
def _persist_image_asset(asset: ImageAsset) -> None:
|
|
235
|
-
connection = open_state_db(create=True)
|
|
236
|
-
assert connection is not None
|
|
237
|
-
try:
|
|
238
|
-
with connection:
|
|
239
|
-
connection.execute(
|
|
240
|
-
"""
|
|
241
|
-
INSERT OR REPLACE INTO image_assets (
|
|
242
|
-
id,
|
|
243
|
-
stored_name,
|
|
244
|
-
mime_type,
|
|
245
|
-
width,
|
|
246
|
-
height,
|
|
247
|
-
original_name
|
|
248
|
-
) VALUES (?, ?, ?, ?, ?, ?)
|
|
249
|
-
""",
|
|
250
|
-
(
|
|
251
|
-
asset.id,
|
|
252
|
-
asset.stored_name,
|
|
253
|
-
asset.mime_type,
|
|
254
|
-
asset.width,
|
|
255
|
-
asset.height,
|
|
256
|
-
asset.original_name,
|
|
257
|
-
),
|
|
258
|
-
)
|
|
259
|
-
finally:
|
|
260
|
-
connection.close()
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
def _load_persisted_image_asset(asset_id: str) -> ImageAsset | None:
|
|
264
|
-
connection = open_state_db(create=False)
|
|
265
|
-
if connection is None:
|
|
266
|
-
return None
|
|
267
|
-
try:
|
|
268
|
-
row = connection.execute(
|
|
269
|
-
"""
|
|
270
|
-
SELECT id, stored_name, mime_type, width, height, original_name
|
|
271
|
-
FROM image_assets
|
|
272
|
-
WHERE id = ?
|
|
273
|
-
""",
|
|
274
|
-
(asset_id,),
|
|
275
|
-
).fetchone()
|
|
276
|
-
finally:
|
|
277
|
-
connection.close()
|
|
278
|
-
if row is None:
|
|
279
|
-
return None
|
|
280
|
-
return ImageAsset(
|
|
281
|
-
id=row["id"],
|
|
282
|
-
stored_name=row["stored_name"],
|
|
283
|
-
mime_type=row["mime_type"],
|
|
284
|
-
width=row["width"] if isinstance(row["width"], int) else None,
|
|
285
|
-
height=row["height"] if isinstance(row["height"], int) else None,
|
|
286
|
-
original_name=(
|
|
287
|
-
row["original_name"] if isinstance(row["original_name"], str) else None
|
|
288
|
-
),
|
|
289
|
-
)
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
def _load_legacy_image_asset(asset_id: str) -> ImageAsset | None:
|
|
293
|
-
metadata_path = _get_legacy_metadata_path(asset_id)
|
|
294
|
-
if not metadata_path.is_file():
|
|
295
|
-
return None
|
|
296
|
-
raw = json.loads(metadata_path.read_text(encoding="utf-8"))
|
|
297
|
-
if not isinstance(raw, dict):
|
|
298
|
-
return None
|
|
299
|
-
stored_name = raw.get("stored_name")
|
|
300
|
-
mime_type = raw.get("mime_type")
|
|
301
|
-
if not isinstance(stored_name, str) or not isinstance(mime_type, str):
|
|
302
|
-
return None
|
|
303
|
-
if not _get_legacy_file_path(stored_name).is_file():
|
|
304
|
-
return None
|
|
305
|
-
return ImageAsset(
|
|
306
|
-
id=asset_id,
|
|
307
|
-
stored_name=stored_name,
|
|
308
|
-
mime_type=mime_type,
|
|
309
|
-
width=raw.get("width") if isinstance(raw.get("width"), int) else None,
|
|
310
|
-
height=raw.get("height") if isinstance(raw.get("height"), int) else None,
|
|
311
|
-
original_name=(
|
|
312
|
-
raw.get("original_name")
|
|
313
|
-
if isinstance(raw.get("original_name"), str)
|
|
314
|
-
else None
|
|
315
|
-
),
|
|
316
|
-
)
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
def _restore_legacy_image_file(asset: ImageAsset) -> bool:
|
|
320
|
-
target_path = asset.file_path
|
|
321
|
-
if target_path.is_file():
|
|
322
|
-
return True
|
|
323
|
-
legacy_file_path = _get_legacy_file_path(asset.stored_name)
|
|
324
|
-
if not legacy_file_path.is_file():
|
|
325
|
-
return False
|
|
326
|
-
asset_dir = _get_assets_dir()
|
|
327
|
-
asset_dir.mkdir(parents=True, exist_ok=True)
|
|
328
|
-
with tempfile.NamedTemporaryFile("wb", dir=asset_dir, delete=False) as handle:
|
|
329
|
-
handle.write(legacy_file_path.read_bytes())
|
|
330
|
-
temp_file_path = Path(handle.name)
|
|
331
|
-
temp_file_path.replace(target_path)
|
|
332
|
-
return True
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
def require_image_asset(asset_id: str) -> ImageAsset:
|
|
336
|
-
asset = get_image_asset(asset_id)
|
|
337
|
-
if asset is None:
|
|
338
|
-
raise ValueError(f"Unknown image asset `{asset_id}`.")
|
|
339
|
-
return asset
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
def read_image_asset_bytes(asset_id: str) -> tuple[ImageAsset, bytes]:
|
|
343
|
-
asset = require_image_asset(asset_id)
|
|
344
|
-
return asset, asset.file_path.read_bytes()
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
def encode_image_asset_as_data_url(asset_id: str) -> tuple[ImageAsset, str]:
|
|
348
|
-
asset, data = read_image_asset_bytes(asset_id)
|
|
349
|
-
encoded = base64.b64encode(data).decode("ascii")
|
|
350
|
-
return asset, f"data:{asset.mime_type};base64,{encoded}"
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
def encode_image_asset_as_base64(asset_id: str) -> tuple[ImageAsset, str]:
|
|
354
|
-
asset, data = read_image_asset_bytes(asset_id)
|
|
355
|
-
encoded = base64.b64encode(data).decode("ascii")
|
|
356
|
-
return asset, encoded
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from flowent.models import ModelCapabilities, ModelInfo
|
|
4
|
-
|
|
5
|
-
_STATIC_CONTEXT_WINDOWS: tuple[tuple[tuple[str, ...], int], ...] = (
|
|
6
|
-
(("gpt-5", "gpt-4.1", "gpt-4o", "o1", "o3"), 128_000),
|
|
7
|
-
(("claude-3", "claude-sonnet-4", "claude-opus-4"), 200_000),
|
|
8
|
-
(("gemini-2.5", "gemini-2.0"), 1_000_000),
|
|
9
|
-
)
|
|
10
|
-
_STATIC_INPUT_IMAGE_PREFIXES: tuple[str, ...] = (
|
|
11
|
-
"gpt-5",
|
|
12
|
-
"gpt-4.1",
|
|
13
|
-
"gpt-4o",
|
|
14
|
-
"claude-3",
|
|
15
|
-
"claude-sonnet-4",
|
|
16
|
-
"claude-opus-4",
|
|
17
|
-
"gemini-2.5",
|
|
18
|
-
"gemini-2.0",
|
|
19
|
-
)
|
|
20
|
-
_STATIC_OPENAI_RESPONSES_OUTPUT_IMAGE_PREFIXES: tuple[str, ...] = (
|
|
21
|
-
"gpt-5",
|
|
22
|
-
"gpt-4.1",
|
|
23
|
-
"gpt-4o",
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def _normalize_model_id(model_id: str) -> str:
|
|
28
|
-
return model_id.strip().lower()
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def infer_model_capabilities(
|
|
32
|
-
*,
|
|
33
|
-
provider_type: str,
|
|
34
|
-
model_id: str,
|
|
35
|
-
input_image: bool | None = None,
|
|
36
|
-
output_image: bool | None = None,
|
|
37
|
-
structured_output: bool | None = None,
|
|
38
|
-
) -> ModelCapabilities:
|
|
39
|
-
normalized_model_id = _normalize_model_id(model_id)
|
|
40
|
-
inferred_input_image = any(
|
|
41
|
-
normalized_model_id.startswith(prefix)
|
|
42
|
-
for prefix in _STATIC_INPUT_IMAGE_PREFIXES
|
|
43
|
-
)
|
|
44
|
-
if provider_type == "gemini":
|
|
45
|
-
inferred_input_image = True
|
|
46
|
-
inferred_output_image = False
|
|
47
|
-
if provider_type == "openai_responses":
|
|
48
|
-
inferred_output_image = any(
|
|
49
|
-
normalized_model_id.startswith(prefix)
|
|
50
|
-
for prefix in _STATIC_OPENAI_RESPONSES_OUTPUT_IMAGE_PREFIXES
|
|
51
|
-
)
|
|
52
|
-
elif provider_type == "gemini":
|
|
53
|
-
inferred_output_image = "image" in normalized_model_id
|
|
54
|
-
return ModelCapabilities(
|
|
55
|
-
input_image=inferred_input_image if input_image is None else input_image,
|
|
56
|
-
output_image=(inferred_output_image if output_image is None else output_image),
|
|
57
|
-
structured_output=False if structured_output is None else structured_output,
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def infer_context_window_tokens(
|
|
62
|
-
*,
|
|
63
|
-
provider_type: str,
|
|
64
|
-
model_id: str,
|
|
65
|
-
context_window_tokens: int | None = None,
|
|
66
|
-
) -> int | None:
|
|
67
|
-
if isinstance(context_window_tokens, int) and context_window_tokens > 0:
|
|
68
|
-
return context_window_tokens
|
|
69
|
-
|
|
70
|
-
normalized_model_id = _normalize_model_id(model_id)
|
|
71
|
-
for prefixes, inferred_limit in _STATIC_CONTEXT_WINDOWS:
|
|
72
|
-
if any(normalized_model_id.startswith(prefix) for prefix in prefixes):
|
|
73
|
-
return inferred_limit
|
|
74
|
-
if provider_type == "gemini" and normalized_model_id:
|
|
75
|
-
return 1_000_000
|
|
76
|
-
return None
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
def build_model_info(
|
|
80
|
-
*,
|
|
81
|
-
provider_type: str,
|
|
82
|
-
model_id: str,
|
|
83
|
-
input_image: bool | None = None,
|
|
84
|
-
output_image: bool | None = None,
|
|
85
|
-
structured_output: bool | None = None,
|
|
86
|
-
context_window_tokens: int | None = None,
|
|
87
|
-
) -> ModelInfo:
|
|
88
|
-
return ModelInfo(
|
|
89
|
-
id=model_id,
|
|
90
|
-
capabilities=infer_model_capabilities(
|
|
91
|
-
provider_type=provider_type,
|
|
92
|
-
model_id=model_id,
|
|
93
|
-
input_image=input_image,
|
|
94
|
-
output_image=output_image,
|
|
95
|
-
structured_output=structured_output,
|
|
96
|
-
),
|
|
97
|
-
context_window_tokens=infer_context_window_tokens(
|
|
98
|
-
provider_type=provider_type,
|
|
99
|
-
model_id=model_id,
|
|
100
|
-
context_window_tokens=context_window_tokens,
|
|
101
|
-
),
|
|
102
|
-
)
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
from flowent.models.agent import AgentState, NodeConfig, NodeType
|
|
2
|
-
from flowent.models.base import Serializable
|
|
3
|
-
from flowent.models.blueprint import (
|
|
4
|
-
AgentBlueprint,
|
|
5
|
-
BlueprintEdge,
|
|
6
|
-
BlueprintSlot,
|
|
7
|
-
BlueprintVersionSummary,
|
|
8
|
-
)
|
|
9
|
-
from flowent.models.content import (
|
|
10
|
-
ContentPart,
|
|
11
|
-
ImagePart,
|
|
12
|
-
TextPart,
|
|
13
|
-
content_parts_to_text,
|
|
14
|
-
deserialize_content_parts,
|
|
15
|
-
has_image_parts,
|
|
16
|
-
parse_content_parts_payload,
|
|
17
|
-
)
|
|
18
|
-
from flowent.models.delta import (
|
|
19
|
-
ContentDelta,
|
|
20
|
-
ReceivedMessageDelta,
|
|
21
|
-
SentMessageDelta,
|
|
22
|
-
StreamingDelta,
|
|
23
|
-
ThinkingDelta,
|
|
24
|
-
ToolResultDelta,
|
|
25
|
-
)
|
|
26
|
-
from flowent.models.event import DISPLAY_EVENTS, Event, EventType
|
|
27
|
-
from flowent.models.graph import (
|
|
28
|
-
EdgeKind,
|
|
29
|
-
GraphEdge,
|
|
30
|
-
GraphNodeRecord,
|
|
31
|
-
NodePosition,
|
|
32
|
-
PortDirection,
|
|
33
|
-
PortType,
|
|
34
|
-
WorkflowActivationState,
|
|
35
|
-
WorkflowDefinition,
|
|
36
|
-
WorkflowNodeDefinition,
|
|
37
|
-
WorkflowNodeKind,
|
|
38
|
-
WorkflowPort,
|
|
39
|
-
WorkflowViewDefinition,
|
|
40
|
-
)
|
|
41
|
-
from flowent.models.history import (
|
|
42
|
-
AssistantText,
|
|
43
|
-
AssistantThinking,
|
|
44
|
-
CommandResultEntry,
|
|
45
|
-
ErrorEntry,
|
|
46
|
-
HistoryEntry,
|
|
47
|
-
PortInboundEntry,
|
|
48
|
-
ReceivedMessage,
|
|
49
|
-
SentMessage,
|
|
50
|
-
SystemEntry,
|
|
51
|
-
ToolCall,
|
|
52
|
-
)
|
|
53
|
-
from flowent.models.llm import (
|
|
54
|
-
LLMOutputImagePart,
|
|
55
|
-
LLMOutputPart,
|
|
56
|
-
LLMOutputTextPart,
|
|
57
|
-
LLMResponse,
|
|
58
|
-
LLMUsage,
|
|
59
|
-
ModelCapabilities,
|
|
60
|
-
ModelInfo,
|
|
61
|
-
ToolCallResult,
|
|
62
|
-
)
|
|
63
|
-
from flowent.models.message import Message
|
|
64
|
-
from flowent.models.tab import Tab
|
|
65
|
-
from flowent.models.todo import TodoItem
|
|
66
|
-
|
|
67
|
-
__all__ = [
|
|
68
|
-
"DISPLAY_EVENTS",
|
|
69
|
-
"AgentBlueprint",
|
|
70
|
-
"AgentState",
|
|
71
|
-
"AssistantText",
|
|
72
|
-
"AssistantThinking",
|
|
73
|
-
"BlueprintEdge",
|
|
74
|
-
"BlueprintSlot",
|
|
75
|
-
"BlueprintVersionSummary",
|
|
76
|
-
"CommandResultEntry",
|
|
77
|
-
"ContentDelta",
|
|
78
|
-
"ContentPart",
|
|
79
|
-
"EdgeKind",
|
|
80
|
-
"ErrorEntry",
|
|
81
|
-
"Event",
|
|
82
|
-
"EventType",
|
|
83
|
-
"GraphEdge",
|
|
84
|
-
"GraphNodeRecord",
|
|
85
|
-
"HistoryEntry",
|
|
86
|
-
"ImagePart",
|
|
87
|
-
"LLMOutputImagePart",
|
|
88
|
-
"LLMOutputPart",
|
|
89
|
-
"LLMOutputTextPart",
|
|
90
|
-
"LLMResponse",
|
|
91
|
-
"LLMUsage",
|
|
92
|
-
"Message",
|
|
93
|
-
"ModelCapabilities",
|
|
94
|
-
"ModelInfo",
|
|
95
|
-
"NodeConfig",
|
|
96
|
-
"NodePosition",
|
|
97
|
-
"NodeType",
|
|
98
|
-
"PortDirection",
|
|
99
|
-
"PortInboundEntry",
|
|
100
|
-
"PortType",
|
|
101
|
-
"ReceivedMessage",
|
|
102
|
-
"ReceivedMessageDelta",
|
|
103
|
-
"SentMessage",
|
|
104
|
-
"SentMessageDelta",
|
|
105
|
-
"Serializable",
|
|
106
|
-
"StreamingDelta",
|
|
107
|
-
"SystemEntry",
|
|
108
|
-
"Tab",
|
|
109
|
-
"TextPart",
|
|
110
|
-
"ThinkingDelta",
|
|
111
|
-
"TodoItem",
|
|
112
|
-
"ToolCall",
|
|
113
|
-
"ToolCallResult",
|
|
114
|
-
"ToolResultDelta",
|
|
115
|
-
"WorkflowActivationState",
|
|
116
|
-
"WorkflowDefinition",
|
|
117
|
-
"WorkflowNodeDefinition",
|
|
118
|
-
"WorkflowNodeKind",
|
|
119
|
-
"WorkflowPort",
|
|
120
|
-
"WorkflowViewDefinition",
|
|
121
|
-
"content_parts_to_text",
|
|
122
|
-
"deserialize_content_parts",
|
|
123
|
-
"has_image_parts",
|
|
124
|
-
"parse_content_parts_payload",
|
|
125
|
-
]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from dataclasses import dataclass, field
|
|
4
|
-
from enum import StrEnum
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class NodeType(StrEnum):
|
|
8
|
-
ASSISTANT = "assistant"
|
|
9
|
-
AGENT = "agent"
|
|
10
|
-
LLM = "llm"
|
|
11
|
-
TRIGGER = "trigger"
|
|
12
|
-
CODE = "code"
|
|
13
|
-
IF = "if"
|
|
14
|
-
MERGE = "merge"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class AgentState(StrEnum):
|
|
18
|
-
INITIALIZING = "initializing"
|
|
19
|
-
IDLE = "idle"
|
|
20
|
-
SLEEPING = "sleeping"
|
|
21
|
-
RUNNING = "running"
|
|
22
|
-
ERROR = "error"
|
|
23
|
-
TERMINATED = "terminated"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
@dataclass
|
|
27
|
-
class NodeConfig:
|
|
28
|
-
node_type: NodeType
|
|
29
|
-
role_name: str | None = None
|
|
30
|
-
tab_id: str | None = None
|
|
31
|
-
name: str | None = None
|
|
32
|
-
tools: list[str] = field(default_factory=list)
|
|
33
|
-
write_dirs: list[str] = field(default_factory=list)
|
|
34
|
-
allow_network: bool = False
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from dataclasses import dataclass
|
|
4
|
-
from typing import Any
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@dataclass
|
|
8
|
-
class Serializable:
|
|
9
|
-
def serialize(self) -> dict[str, Any]:
|
|
10
|
-
fields: dict[str, Any] = {}
|
|
11
|
-
for k, v in self.__dict__.items():
|
|
12
|
-
if k.startswith("_"):
|
|
13
|
-
continue
|
|
14
|
-
if isinstance(v, Serializable):
|
|
15
|
-
fields[k] = v.serialize()
|
|
16
|
-
elif isinstance(v, list):
|
|
17
|
-
fields[k] = [
|
|
18
|
-
item.serialize() if isinstance(item, Serializable) else item
|
|
19
|
-
for item in v
|
|
20
|
-
]
|
|
21
|
-
else:
|
|
22
|
-
fields[k] = v
|
|
23
|
-
fields["type"] = self.__class__.__name__
|
|
24
|
-
return fields
|