Skip to content

Conversation

@Disviel
Copy link
Contributor

@Disviel Disviel commented Jan 27, 2026

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

  • Added a new Agenda-backed scheduler domain with typed interfaces, job specs, and handler signatures in src/scheduler/base.ts. This establishes a stable API for scheduling and managing jobs.
  • Introduced job data definitions and handler mappings in src/scheduler/jobs/index.ts, including a demo job and handler in src/scheduler/jobs/test.job.ts. [1] [2]
  • Created a central export for scheduler modules in src/scheduler/index.ts.

Chat UI Improvements

  • Refactored the chat page (src/app/chat/page.tsx and page.module.css) to use a unified notice state 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

  • Added 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

  • Introduced ActorScope and passed contextual information through toolContext, enabling tools to access actor, user, and conversation IDs during execution. [1] [2] [3] [4] [5]

Dependency Updates

  • Added new dependencies for Agenda scheduling (@hokify/agenda, mongodb-agenda) in package.json files for both ema and ema-ui packages. [1] [2] [3]

Copy link
Contributor

Copilot AI left a 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 AgendaScheduler with job handler registry, plus comprehensive scheduler tests.
  • Introduce ToolContext / ActorScope and switch tool execution from positional args to {...args} payloads.
  • Patch @hokify/agenda to 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

@Disviel Disviel changed the title Implemented a scheduler based on agenda Implemented a scheduler based on agenda and modified the Tool execute interface to adapt Jan 27, 2026
Disviel and others added 2 commits January 27, 2026 12:26
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Disviel Disviel marked this pull request as draft January 27, 2026 08:28
@Disviel Disviel requested a review from Copilot January 27, 2026 08:50
Copy link
Contributor

Copilot AI left a 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>
@Disviel Disviel marked this pull request as ready for review January 27, 2026 09:35
@Disviel Disviel marked this pull request as draft January 28, 2026 06:18
@Disviel Disviel marked this pull request as ready for review January 28, 2026 06:25
@Disviel Disviel marked this pull request as draft January 28, 2026 06:26
@Disviel Disviel requested a review from Copilot January 28, 2026 06:26
Copy link
Contributor

Copilot AI left a 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

@Disviel Disviel marked this pull request as ready for review January 28, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant