Skip to content

Conversation

heyitsaamir
Copy link
Contributor

@heyitsaamir heyitsaamir commented Aug 4, 2025

This PR introduces the ability for plugins to add typed values to the activity context. It does this by adding a dedicated buildActivityContext function that gets called in app.process. Then via a bunch of generics plumbing we merge the plugin's context values with the default ones.

We can use this to separate graph out into other packages, but keep the contextual objects for the activity-handlers unchanged (aka. appGraph, and userGraph will still be available). However, graph object on app would most likely be part of the the GraphPlugin - (maybe we make that accessible via a new app.getPlugin('graph') method?)

Here's a mini demo:

Screen.Recording.2025-08-04.at.8.35.09.AM.mov

PR Dependency Tree

This tree was auto-generated by Charcoal

@heyitsaamir heyitsaamir requested a review from Copilot August 5, 2025 13:48
Copy link

@Copilot 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

This PR introduces a pluggable activity context system that allows plugins to add typed values to the activity context. The implementation adds a new buildActivityContext method to the plugin interface and updates all activity context types to support generics for plugin-provided context values.

Key changes:

  • Adds buildActivityContext method to the plugin interface for injecting typed context values
  • Updates all activity context interfaces and route types to accept generic context parameters
  • Implements context merging logic in the app processing pipeline

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/apps/src/types/plugin/plugin.ts Adds generic type parameters and buildActivityContext method to plugin interface
packages/apps/src/contexts/activity.ts Updates activity context interfaces to support generic plugin context types
packages/apps/src/app.process.ts Implements plugin context building and merging in activity processing
packages/apps/src/routes/*.ts Updates all route type definitions to support generic context parameters
packages/apps/src/router.ts Updates router class to support typed plugin contexts
packages/apps/src/app.ts Updates app class to use typed plugin contexts in router
packages/apps/src/types/app-routing.ts Adds utility type for extracting plugin context types

Copy link
Collaborator

@aacebo aacebo left a comment

Choose a reason for hiding this comment

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

left questions, this is a good first draft let me know when its ready for another review!

@heyitsaamir heyitsaamir marked this pull request as ready for review August 8, 2025 06:22
@heyitsaamir
Copy link
Contributor Author

left questions, this is a good first draft let me know when its ready for another review!

Updated it with your suggestions @aacebo . Take a look!

@heyitsaamir heyitsaamir merged commit e078b0e into main Aug 21, 2025
5 checks passed
@heyitsaamir heyitsaamir deleted the aamirj/plugin branch August 21, 2025 21:35
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.

3 participants