Commit Graph

32 Commits

Author SHA1 Message Date
朝夕 3a96f287c7
[Feature] Add frontend authentication page and 401 error interceptor (#21)
* feat: add frontend authentication page and 401 interceptor

Adds a new AuthPage component for user login and registration, integrates it into App.tsx to protect routes, and sets up an Axios interceptor to handle 401 Unauthorized responses by clearing local storage and reloading. Also fixes a missing logger attribute in WorkflowEngine for backend tests.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

* fix: gracefully handle closed websockets

Updates the websocket endpoints in `pretor/api/cluster.py` and `pretor/api/workflow.py` to catch `RuntimeError` alongside `WebSocketDisconnect`. This prevents the application from crashing and spamming error logs when the frontend client unexpectedly closes the connection and the underlying TCP transport is closed.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

* feat: add worker form and update global settings

Adds a new form in the Worker Individual Settings page to create custom worker individuals via the `/api/v1/agent/worker` endpoint. Also updates the System Settings page to remove the obsolete "Max Concurrent Workflows" setting and makes the system language and theme toggles functional by persisting to local storage and updating the document root class.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>
2026-04-24 18:22:39 +08:00
朝夕 dcf53524b2 wip: 修复了serve的部分bug 2026-04-24 12:48:17 +08:00
朝夕 27a71c9e49
Feature/frontend dashboard integration 11563952984595832647 (#20)
* fix(backend): initialize async queue properly and fix auth login error handling (#18)

- Moved `self.workflow_queue = asyncio.Queue()` to the top of `WorkflowRunningEngine.run` to ensure the queue exists before coroutines start polling it, resolving initialization race conditions.
- Handled `user` object nullability check correctly in `/api/v1/auth/login` to raise `UserNotExistError` instead of crashing on attribute access.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

* feat: Integrate frontend dashboard and wire up settings endpoints

- Imported and moved the pretor_dashboard dev branch into `frontend/`.
- Configured FastAPI `PretorGateway` to mount `frontend/dist` out of the box and serve it effectively.
- Fixed `global_state_machine` Ray Actor hook references in `pretor/api/resource.py`.
- Added missing GET `/api/v1/auth/list` endpoint to list all users.
- Added missing DELETE `/api/v1/auth/{user_id}` endpoint to remove users.
- Plumbed API calls in the frontend's `UsersSettings.tsx` to get, delete, and alter the authority roles.
- Wired up provider deletion API endpoints within `ProvidersSettings.tsx`.
- Ran `npm run build` so `frontend/dist` is current.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

* feat: Integrate frontend dashboard and wire up settings endpoints

- Imported and moved the pretor_dashboard dev branch into `frontend/`.
- Configured FastAPI `PretorGateway` to mount `frontend/dist` out of the box and serve it effectively.
- Fixed `global_state_machine` Ray Actor hook references in `pretor/api/resource.py`.
- Added missing GET `/api/v1/auth/list` endpoint to list all users.
- Added missing DELETE `/api/v1/auth/{user_id}` endpoint to remove users.
- Plumbed API calls in the frontend's `UsersSettings.tsx` to get, delete, and alter the authority roles.
- Wired up provider deletion API endpoints within `ProvidersSettings.tsx`.
- Ran `npm run build` so `frontend/dist` is current.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

* fix(backend): Remove __call__ from PretorGateway and assign first user as SUPER_ADMINISTRATOR

- Removed `__call__` from `PretorGateway` in `pretor/core/api/__init__.py` to fix Ray Serve `ValueError` during initialization.
- Modified `AuthDatabase.add_user` in `pretor/core/database/module/user.py` to check for existing users. The first registered user now receives `UserAuthority.SUPER_ADMINISTRATOR` access while subsequent users get `USER` access.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

* fix(backend): Remove __call__ from PretorGateway and assign first user as SUPER_ADMINISTRATOR

- Removed `__call__` from `PretorGateway` in `pretor/core/api/__init__.py` to fix Ray Serve `ValueError` during initialization.
- Added connection error handling in `PostgresDatabase.init_db()` to prevent startup crashes when PostgreSQL is unavailable.
- Updated `AuthDatabase.add_user` to automatically grant `SUPER_ADMINISTRATOR` privileges to the first registered user.
- Fixed unit tests in `user_test.py` that were improperly mocking `session.execute`, removing confusing stack traces during testing.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

* fix(backend): Remove __call__ from PretorGateway and assign first user as SUPER_ADMINISTRATOR

- Removed `__call__` from `PretorGateway` in `pretor/core/api/__init__.py` to fix Ray Serve `ValueError` during initialization.
- Added connection error handling in `PostgresDatabase.init_db()` to prevent startup crashes when PostgreSQL is unavailable.
- Updated `AuthDatabase.add_user` to automatically grant `SUPER_ADMINISTRATOR` privileges to the first registered user.
- Fixed unit tests in `user_test.py` that were improperly mocking `session.execute`, removing confusing stack traces during testing.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>
2026-04-24 11:46:47 +08:00
朝夕 66306ffd01
[feature integration] frontend dashboard and API endpoints (#19)
* fix(backend): initialize async queue properly and fix auth login error handling (#18)

- Moved `self.workflow_queue = asyncio.Queue()` to the top of `WorkflowRunningEngine.run` to ensure the queue exists before coroutines start polling it, resolving initialization race conditions.
- Handled `user` object nullability check correctly in `/api/v1/auth/login` to raise `UserNotExistError` instead of crashing on attribute access.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

* feat: Integrate frontend dashboard and wire up settings endpoints

- Imported and moved the pretor_dashboard dev branch into `frontend/`.
- Configured FastAPI `PretorGateway` to mount `frontend/dist` out of the box and serve it effectively.
- Fixed `global_state_machine` Ray Actor hook references in `pretor/api/resource.py`.
- Added missing GET `/api/v1/auth/list` endpoint to list all users.
- Added missing DELETE `/api/v1/auth/{user_id}` endpoint to remove users.
- Plumbed API calls in the frontend's `UsersSettings.tsx` to get, delete, and alter the authority roles.
- Wired up provider deletion API endpoints within `ProvidersSettings.tsx`.
- Ran `npm run build` so `frontend/dist` is current.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>
2026-04-24 09:12:12 +08:00
朝夕 6055606e2c wip: 完善了worker_individual和workflow_running_engine的逻辑 2026-04-22 21:16:43 +08:00
朝夕 c6025732c6 wip: 修复问题 2026-04-22 15:02:42 +08:00
朝夕 be0d78c855 wip: 增加了api的简单权限校验,使用反射对于actor进行重构 2026-04-22 11:36:59 +08:00
朝夕 81da2e9f81 wip: 对于用户模型进行了优化,增加了权限模型和权限校验 2026-04-21 23:00:59 +08:00
朝夕 446e208193 wip: 初步增加了worker_individual,修改了trace_id 2026-04-21 15:06:50 +08:00
朝夕 f59ac27782 wip: 修改错误 2026-04-20 22:57:20 +08:00
朝夕 1a8277ad88 wip: 优化调度逻辑,增加了工具管理 2026-04-20 20:00:15 +08:00
朝夕 fe49340106 wip: 优化了control_node consciousness_node和supervisory_node 2026-04-20 16:20:38 +08:00
朝夕 43135e47c8 wip: 增加了一些文档 2026-04-19 20:07:39 +08:00
朝夕 7573ce4ea7
Add react frontend 15346720174401384863 (#7)
wip:简单的前端业务
2026-04-19 18:59:56 +08:00
朝夕 3cf2411c4a wip: 修改了大量漏洞 2026-04-17 22:07:49 +08:00
朝夕 3a8b1e4054 wip: 优化bug 2026-04-17 19:43:32 +08:00
朝夕 cf0117ae2f wip: 增加了skill_manager 2026-04-17 12:36:36 +08:00
朝夕 95ec019b5a wip: 增加了workflow_template_generate的api接口 2026-04-13 22:44:20 +08:00
朝夕 2432bc9e3b wip: 增加测试 2026-04-12 23:04:46 +08:00
朝夕 a04fc08735 wip: 增加插件 2026-04-12 14:18:03 +08:00
朝夕 929cf0e2f2 wip: 优化了部分代码,修改了部分致命漏洞,完善了README.md 2026-04-11 22:04:37 +08:00
朝夕 1715b64d17 wip: 优化 2026-04-11 18:14:07 +08:00
朝夕 2796c20f5e wip:完善workflow_runner 2026-04-11 15:53:03 +08:00
朝夕 6c5849f3d0 wip:增加control_node 2026-04-11 14:00:37 +08:00
朝夕 dc857cbff7 wip:优化individual,加了基本的启动页面 2026-04-10 23:17:06 +08:00
朝夕 2e5b2bce3a wip:更新版权 2026-04-10 10:50:25 +08:00
朝夕 a7bd7f786e wip:改进 2026-04-09 23:06:01 +08:00
朝夕 2552017ea7 wip:对于api接口进行了完善,完善了global_state_machine(全局状态机),进行了大规模重构 2026-04-08 22:09:54 +08:00
朝夕 1bf3aaf154
Add workflow agent nodes, memory RAG, and tool plugin outlines (#1)
* Add workflow agent nodes, memory RAG, and tool plugin outlines

- Add MemoryRAG class integrated with PostgresDatabase.
- Rewrite SupervisoryNode, ConsciousnessNode, and ControlNode as ray remote actors with an injected pydantic_ai Agent.
- Create initial tool plugin scaffolding for RAG, web_crawler, and docker_sandbox.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

* Flesh out workflow agent nodes, memory RAG, and tool plugins

- Added concrete SQLModel implementations for WorkflowRecord and MemoryRecord with pgvector support.
- Defined a `Workflow` Pydantic model for protocol communication.
- Implemented core agent run logic in SupervisoryNode, ConsciousnessNode, and ControlNode.
- Implemented actual basic httpx and docker-py logic for the tool plugins.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

* Refactor node logic to use existing PretorWorkflow

- Deleted redundant `workflow.py` created earlier under `protocol/`.
- Updated `SupervisoryNode`, `ConsciousnessNode`, and `ControlNode` to correctly import and handle the existing `PretorWorkflow`, `WorkerGroup`, and `WorkStep` models from `pretor.core.workflow_manager.workflow`.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

* Add UserEvent routing and fix SQLAlchemy execute syntax

- Added `UserEvent` class to `pretor.core.workflow_manager.workflow` to represent user interactions.
- Updated `SupervisoryNode.process_event` to receive the event, analyze complexity with the LLM, and either directly reply or dispatch a `ConsciousnessNode` workflow generation.
- Fixed SQLAlchemy AsyncSession methods in `memory.py` from `.exec()` to `.execute()`.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

* Rename UserEvent to PretorEvent

- Renamed `UserEvent` to `PretorEvent` in `pretor/core/workflow_manager/workflow.py`.
- Updated references in `pretor/individual_plugin/supervisory_node/supervisory_node.py` to use `PretorEvent`.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>
2026-03-31 22:08:51 +08:00
朝夕 46937fbc10 feat:使用pytanticAI再次重构,增加了对于api的接口管理 2026-03-31 18:15:18 +08:00
朝夕 c672c60af6 feat:使用pytantic重写了大部分逻辑 2026-03-25 20:23:48 +08:00
朝夕 7a5170b518 feat:项目初始化,实现了workflow_manager 2026-03-22 18:01:05 +08:00