Skip to content

feat(agent): Enable task planning and management capabilities for Friday.#128

Open
hongxicheng wants to merge 3 commits intoagentscope-ai:mainfrom
hongxicheng:plan
Open

feat(agent): Enable task planning and management capabilities for Friday.#128
hongxicheng wants to merge 3 commits intoagentscope-ai:mainfrom
hongxicheng:plan

Conversation

@hongxicheng
Copy link
Collaborator

Description

image image

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with npm run format command in the root directory
  • Docstrings/comments are in appropriate style (TSDoc/JSDoc for TypeScript/JavaScript, Google style for Python)
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

@hongxicheng hongxicheng requested a review from zhijianma March 3, 2026 09:06
@hongxicheng hongxicheng added the enhancement New feature or request label Mar 3, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Friday agent by equipping it with advanced task planning and management functionalities. The agent can now autonomously break down complex problems into structured plans, which are then persisted and made visible to the user through a new, interactive sidebar. This allows for greater transparency and control over the agent's problem-solving process, enabling users to directly intervene, modify, and track the progress of individual subtasks, thereby improving the overall user experience and agent effectiveness.

Highlights

  • Task Planning and Management: Introduced comprehensive task planning and management capabilities for the Friday agent, allowing it to create and execute multi-step plans for complex problems.
  • Persistent Plan Storage: Implemented PlanNotebook and JSONPlanStorage in the Python backend to manage and persist agent-generated plans and subtasks across sessions.
  • Interactive Frontend UI: Developed a new interactive sidebar in the frontend to display current and historical task plans, enabling users to add, edit, delete, reorder, and update the status of individual subtasks.
  • Real-time Plan Updates: Integrated real-time plan updates using WebSockets and tRPC, ensuring the frontend reflects the agent's planning progress and user modifications instantly.
  • API Endpoints: Added new tRPC API endpoints to facilitate communication between the frontend and the Python backend for all plan-related operations, such as fetching, revising, and updating subtask states.
  • Documentation: Updated documentation with new English and Chinese guides explaining how to use and interact with Friday's task planning features.
Changelog
  • docs/.vitepress/config.mts
    • Updated navigation menus to include 'Planning' under the 'Agent' section for both English and Chinese documentation.
  • docs/tutorial/en/agent/Planning.md
    • Added new English documentation detailing Friday's task planning features, including subtask editing, status modification, and reordering.
  • docs/tutorial/zh_CN/agent/Planning.md
    • Added new Chinese documentation for Friday's task planning features, mirroring the English content.
  • packages/app/friday/clean_invalid_plans.py
    • Added a new Python script to remove plans with non-completed states from storage, ensuring data consistency.
  • packages/app/friday/hook.py
    • Imported Plan and PlanNotebook classes.
    • Added push_plan_hook to send plan updates to the Studio frontend via HTTP requests on plan changes.
  • packages/app/friday/main.py
    • Imported PlanNotebook, Plan, SubTask, and push_plan_hook.
    • Integrated save_studio_url to persist the Studio URL for API access.
    • Initialized PlanNotebook with JSONPlanStorage and registered push_plan_hook for real-time updates.
    • Modified ReActAgent and session management to include plan_notebook for state persistence.
  • packages/app/friday/plan_manager/init.py
    • Added a new __init__.py file to define the plan_manager module, exposing JSONPlanStorage and get_plans_from_storage.
  • packages/app/friday/plan_manager/api.py
    • Added a new Python API file providing functions for frontend interaction with plans, including get_plans_from_storage, revise_plan (add, revise, delete subtasks), update_subtask_state, and finish_subtask.
  • packages/app/friday/plan_manager/storage.py
    • Added a new JSONPlanStorage class, an implementation of PlanStorageBase for in-memory plan storage with persistence handled by PlanNotebook's JSONSession.
  • packages/app/friday/utils/common.py
    • Imported the json module.
    • Added save_studio_url and get_studio_url functions to manage the Studio URL in a configuration file.
  • packages/client/src/components/plan/EditSubtaskDialog.tsx
    • Added a new React component for editing or adding subtasks, including input fields for name, description, and expected outcome.
  • packages/client/src/components/plan/FinishSubtaskDialog.tsx
    • Added a new React component for finishing a subtask, prompting the user for the actual outcome.
  • packages/client/src/components/plan/PlanSidebar.tsx
    • Added a new React component for displaying the task plan sidebar, showing current and historical plans, subtasks, and providing UI for editing, status updates, adding, reordering, and deleting subtasks.
  • packages/client/src/components/plan/PlanStepItem.tsx
    • Added a new React component to render individual subtask items within the plan sidebar, including status icons, action buttons, and drag-and-drop functionality for reordering.
  • packages/client/src/components/plan/SubtaskDialog.tsx
    • Added a new React component for adding or editing subtasks, providing input fields for details.
  • packages/client/src/components/plan/index.ts
    • Added an index file to export PlanSidebar and PlanStepItem components.
  • packages/client/src/context/FridayAppRoomContext.tsx
    • Imported Plan, SubTask, SubTaskStatus, and trpc types and utilities.
    • Added new state variables for currentPlan and historicalPlans.
    • Integrated tRPC queries and mutations for plan management (getFridayPlans, reviseFridayPlan, updateSubtaskState, finishFridaySubtask).
    • Added new context functions for updatePlan, updateSubtaskStatus, updateSubtask, addSubtask, reorderSubtasks, and deleteSubtask.
    • Added a new socket event listener for pushCurrentPlan to receive real-time plan updates from the backend.
  • packages/client/src/i18n/en.json
    • Added new English translation keys for plan-related UI elements and actions.
  • packages/client/src/i18n/zh.json
    • Added new Chinese translation keys for plan-related UI elements and actions.
  • packages/client/src/pages/FridayPage/ChatPage/index.tsx
    • Imported new plan-related components (PlanSidebar, EditSubtaskDialog, FinishSubtaskDialog).
    • Integrated PlanSidebar into the chat page layout.
    • Added state and handlers for managing subtask editing, adding, finishing, and reordering, utilizing the FridayAppRoomContext functions.
    • Added a button to toggle plan sidebar visibility.
  • packages/client/src/pages/FridayPage/index.tsx
    • Wrapped ChatPage with FridaySettingRoomContextProvider to ensure proper context for settings.
  • packages/server/src/trpc/router.ts
    • Added new tRPC procedures: pushCurrentPlanToFridayApp (for broadcasting plan updates), getFridayPlans (to fetch plans from Python backend), reviseFridayPlan (to add, revise, or delete subtasks via Python), updateFridaySubtaskState (to change subtask status via Python), and finishFridaySubtask (to mark subtasks as done with an outcome via Python).
  • packages/server/src/trpc/socket.ts
    • Imported Plan type.
    • Modified cleanCurrentHistory to broadcast a clear plan message to the frontend.
    • Added broadcastCurrentPlanToFridayAppRoom and broadcastPlanToFridayAppRoom methods to send plan updates to clients.
  • packages/shared/src/types/index.ts
    • Exported new plan types.
  • packages/shared/src/types/plan.ts
    • Added new TypeScript types for SubTaskStatus, SubTask, PlanStatus, and Plan to define the data structures for task planning.
  • packages/shared/src/types/trpc.ts
    • Added new socket events pushCurrentPlan and pushPlan for real-time plan updates.
Activity
  • The pull request introduces a significant new feature, enabling task planning and management for the Friday agent.
  • It involves extensive changes across both the backend (Python) and frontend (TypeScript/React) components, along with corresponding documentation updates.
  • The backend now includes a PlanNotebook for managing plans and a JSONPlanStorage for persistent storage of these plans.
  • A new API layer in Python facilitates interaction between the frontend and the plan management system.
  • The frontend provides a rich user interface for users to view, modify, and interact with the agent's task plans in real-time.
  • Real-time updates of plans are handled efficiently through WebSockets and tRPC, ensuring a responsive user experience.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant and valuable feature for task planning and management within the Friday agent. However, the implementation contains critical security vulnerabilities, specifically Remote Code Execution (RCE) due to user-supplied data being insecurely embedded into temporary Python scripts executed on the server. Furthermore, the use of fixed filenames for these temporary scripts creates race conditions, which can lead to data corruption or unintended behavior. The backend also suffers from critical architectural issues, relying on inefficient and insecure spawning of Python processes for each API call. Additionally, the frontend uses fragile patterns like setTimeout for state synchronization that need to be addressed.

@hongxicheng
Copy link
Collaborator Author

/gemini review

@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@hongxicheng
Copy link
Collaborator Author

/gemini review

@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant