Skip to content

feat: add AgentController support to standalone Runner#413

Open
jerryliang64 wants to merge 1 commit into
masterfrom
feat/add-agent-controller-standalone
Open

feat: add AgentController support to standalone Runner#413
jerryliang64 wants to merge 1 commit into
masterfrom
feat/add-agent-controller-standalone

Conversation

@jerryliang64
Copy link
Copy Markdown
Contributor

@jerryliang64 jerryliang64 commented Mar 19, 2026

Summary

  • Register AgentControllerProto.createProto and AgentControllerObject.createObject in the standalone Runner constructor, mirroring the registration done in @eggjs/tegg-controller-plugin/app.ts
  • Add @eggjs/tegg-controller-plugin and @eggjs/tegg-types as dependencies of @eggjs/tegg-standalone
  • This enables @AgentController decorated classes to work in standalone mode (without the egg plugin lifecycle)

Test plan

  • Verify existing standalone tests still pass
  • Create a standalone Runner with an @AgentController class and confirm it initializes correctly
  • Verify that AgentRuntime delegate methods are properly installed on the controller instance

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated project dependencies to improve framework support and stability.
    • Enhanced internal initialization process for better component registration and management.

The standalone Runner bypasses egg plugin lifecycle, so
AgentControllerProto/Object registration needs to be done
manually, similar to how it's done in the controller plugin's app.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

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 enhances the @eggjs/tegg-standalone package by integrating AgentController support directly into its Runner component. This crucial update allows applications utilizing @AgentController decorators to operate seamlessly in a standalone environment, independent of the full Egg.js plugin lifecycle. The change ensures greater flexibility and feature parity for standalone deployments.

Highlights

  • AgentController Support: Registered AgentControllerProto.createProto and AgentControllerObject.createObject within the standalone Runner constructor, enabling @AgentController decorated classes to function outside the traditional Egg.js plugin lifecycle.
  • Dependency Updates: Added @eggjs/tegg-controller-plugin and @eggjs/tegg-types as new dependencies to the @eggjs/tegg-standalone package to support the new AgentController functionality.
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.

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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3f6529c8-e7e0-434c-9654-78b50c27a9c8

📥 Commits

Reviewing files that changed from the base of the PR and between d4d0006 and cee6357.

📒 Files selected for processing (2)
  • standalone/standalone/package.json
  • standalone/standalone/src/Runner.ts

📝 Walkthrough

Walkthrough

The pull request adds egg framework controller plugin support by introducing two new dependencies (@eggjs/tegg-controller-plugin and @eggjs/tegg-types) and initializing AgentController metadata registration within the Runner constructor using egg's prototype creator and object factory mechanisms.

Changes

Cohort / File(s) Summary
Dependency Updates
standalone/standalone/package.json
Added @eggjs/tegg-controller-plugin and @eggjs/tegg-types at ^3.72.0 to support egg controller framework integration.
Runner Initialization
standalone/standalone/src/Runner.ts
Extended Runner constructor to register AgentController-related egg metadata, including prototype creator factory, object factory, logger assignment, and object creation method registration.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A dash of controller magic, we bring,
Egg framework plugins make systems sing,
AgentController now takes its flight,
With metadata registered oh so right,
The Runner hops forward, shiny and bright! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add AgentController support to standalone Runner' accurately summarizes the main change: adding AgentController support to the standalone Runner with new dependency additions and constructor registration logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-agent-controller-standalone
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can disable the changed files summary in the walkthrough.

Disable the reviews.changed_files_summary setting to disable the changed files summary in the walkthrough.

Copy link
Copy Markdown
Contributor

@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 adds support for @AgentController in the standalone Runner. This is achieved by adding the necessary dependencies and registering the prototype creator and object factory for agent controllers. The changes are logical and follow the intended goal. However, I've identified a couple of areas for improvement: one is a maintainability issue in package.json regarding dependency sorting, and the other is a more significant correctness concern in Runner.ts where a type assertion as any is used to pass a logger of an incompatible type, which could lead to runtime errors.

// AgentController support
EggPrototypeCreatorFactory.registerPrototypeCreator(
AGENT_CONTROLLER_PROTO_IMPL_TYPE, AgentControllerProto.createProto);
AgentControllerObject.setLogger(logger as any);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The type assertion as any hides a potential type mismatch and should be avoided. The logger variable is of type Logger (from @eggjs/tegg) or console, but AgentControllerObject.setLogger expects an EggLogger (from egg). This could lead to runtime errors if agent-runtime (which receives this logger) calls methods specific to EggLogger that are not present on the provided logger object. Please resolve this type incompatibility properly instead of suppressing the type error.

"@eggjs/tegg-dynamic-inject-runtime": "^3.72.0",
"@eggjs/tegg-lifecycle": "^3.72.0",
"@eggjs/tegg-loader": "^3.72.0",
"@eggjs/tegg-controller-plugin": "^3.72.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For better maintainability and to follow common conventions, dependencies in package.json should be sorted alphabetically. The newly added @eggjs/tegg-controller-plugin is out of order. It should be placed before @eggjs/tegg-dal-plugin.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant