-
Notifications
You must be signed in to change notification settings - Fork 9
Implemented a scheduler based on agenda and modified the Tool execute interface to adapt #150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Implements an Agenda-backed job scheduler in packages/ema (including server integration) and refactors the tool/skill execution interface to support structured args plus optional execution context.
Changes:
- Add
AgendaSchedulerwith job handler registry, plus comprehensive scheduler tests. - Introduce
ToolContext/ActorScopeand switch tool execution from positional args to{...args}payloads. - Patch
@hokify/agendato work alongside MongoDB v7 by using an aliased MongoDB v4 dependency (mongodb-agenda).
Reviewed changes
Copilot reviewed 33 out of 34 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-workspace.yaml | Adds pnpm patchedDependencies entry for Agenda patching. |
| pnpm-lock.yaml | Locks new dependencies for Agenda + MongoDB aliasing and updated transitive graph. |
| patches/@hokify__agenda@6.3.0.patch | Patches Agenda to import from mongodb-agenda instead of mongodb. |
| packages/ema/src/tools/mini_agent/skill_tool.ts | Removes legacy mini-agent skill tool implementation. |
| packages/ema/src/tools/mini_agent/skill_loader.ts | Removes legacy mini-agent skill loading implementation. |
| packages/ema/src/tools/mini_agent/note_tool.ts | Removes legacy mini-agent note tools. |
| packages/ema/src/tools/mini_agent/mcp_loader.ts | Removes legacy MCP tool loader implementation. |
| packages/ema/src/tools/mini_agent/file_tools.ts | Removes legacy file tools implementation. |
| packages/ema/src/tools/mini_agent/bash_tool.ts | Removes legacy bash tool implementation. |
| packages/ema/src/tools/get_skill_tool.ts | Updates tool execute signature to (args, context?) and validates args via zod. |
| packages/ema/src/tools/exec_skill_tool.ts | Updates tool execute signature and renames payload field to skill_args. |
| packages/ema/src/tools/ema_reply_tool.ts | Updates tool execute signature to accept a single args object. |
| packages/ema/src/tools/base.ts | Adds ToolContext and changes Tool.execute contract to (args, context?). |
| packages/ema/src/tests/tools/get_skill_tool.spec.ts | Updates tests to call tools with args objects. |
| packages/ema/src/tests/tools/exec_skill_tool.spec.ts | Updates tests for new args shape and execution signature. |
| packages/ema/src/tests/tools/ema_reply_tool.spec.ts | Updates tests to call EmaReplyTool with a single args object. |
| packages/ema/src/tests/scheduler.spec.ts | Adds test coverage for schedule/cancel/reschedule and recurring jobs. |
| packages/ema/src/skills/demo-skill/index.ts | Updates skill execute signature to (args, context?). |
| packages/ema/src/skills/base.ts | Updates base skill execute signature (and adds context types). |
| packages/ema/src/server.ts | Creates and starts the scheduler; includes its collection in snapshots. |
| packages/ema/src/scheduler/scheduler.ts | Implements AgendaScheduler (start/stop/schedule/cancel/reschedule). |
| packages/ema/src/scheduler/jobs/test.job.ts | Adds a demo job handler and typed job payload. |
| packages/ema/src/scheduler/jobs/index.ts | Introduces JobDataMap and the jobHandlers mapping. |
| packages/ema/src/scheduler/index.ts | Exports scheduler modules. |
| packages/ema/src/scheduler/base.ts | Defines scheduler domain types and the Scheduler interface. |
| packages/ema/src/db/mongo/remote.ts | Adds getUri() to support Agenda database connection setup. |
| packages/ema/src/db/mongo/memory.ts | Adds getUri() and adjusts memory server creation options. |
| packages/ema/src/db/mongo.ts | Adds abstract getUri() contract to Mongo base class. |
| packages/ema/src/agent.ts | Switches tool execution to pass (callArgs, toolContext) instead of positional args. |
| packages/ema/src/actor.ts | Adds ActorScope and injects it into toolContext for agent runs. |
| packages/ema/package.json | Adds @hokify/agenda and mongodb-agenda dependencies. |
| packages/ema-ui/src/app/chat/page.tsx | Adds initialization gating + in-module caching for initial history load, and a unified notice banner. |
| packages/ema-ui/src/app/chat/page.module.css | Updates notice styling to a fixed “toast” banner. |
| packages/ema-ui/package.json | Adds mongodb-agenda dependency. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 33 out of 34 changed files in this pull request and generated 7 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…and update ToolContext to include Server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 33 out of 34 changed files in this pull request and generated 5 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Closes #112 #113 #114 #115 #116 #117
This pull request introduces a new Agenda-backed job scheduling system to the EMA codebase, along with improvements to the chat UI and various supporting updates. The main changes include the addition of typed scheduler interfaces and job definitions, refactoring of the chat page to improve status handling and initialization, and enhancements to MongoDB connection handling. Below are the most important changes grouped by theme:
Scheduler System Integration
src/scheduler/base.ts. This establishes a stable API for scheduling and managing jobs.src/scheduler/jobs/index.ts, including a demo job and handler insrc/scheduler/jobs/test.job.ts. [1] [2]src/scheduler/index.ts.Chat UI Improvements
src/app/chat/page.tsxandpage.module.css) to use a unifiednoticestate for displaying status messages, improved initialization logic with caching, and updated UI styles for better feedback and accessibility. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]MongoDB Enhancements
getUri()methods to both in-memory and remote MongoDB classes to provide connection URIs, improving testability and integration with external tools. [1] [2] [3] [4] [5]Actor and Agent Context Improvements
ActorScopeand passed contextual information throughtoolContext, enabling tools to access actor, user, and conversation IDs during execution. [1] [2] [3] [4] [5]Dependency Updates
@hokify/agenda,mongodb-agenda) inpackage.jsonfiles for bothemaandema-uipackages. [1] [2] [3]