Conversation
Plugin API v2 extension. Plugins can call a tiny host facade via
context.host (PluginHost) to:
- create sessions (context.host.sessions.create)
- stop sessions (context.host.sessions.stop)
- launch workflows (context.host.workflows.launch)
The facade reuses the session manager and the task-seeded workflow
launcher already used by the MCP / WS paths so we don't introduce a
second implementation. The isRunning cycle stays entirely managed by
OpenFox; we never expose SessionManager, launchWorkflowRun, or setRunning.
Implementation:
- src/plugin/index.ts: new PluginSessions, PluginWorkflows, PluginHost
interfaces + optional host? field on PluginContext (and on the tool
context for handlers/tools).
- src/server/plugins/host.ts: new currentHost field + setHost method;
createContext now snapshots host via a lazy getter so plugins loaded
before setHost still see the new value. RPC handler context enriched
with the host too.
- src/server/index.ts: setHost({sessions, workflows}) wired after the
tasks launcher is initialised.
Tests:
- src/server/plugins/host.test.ts: 4 new cases — context.host is absent
when setHost was never called, present when called before plugin
load, propagates to existing contexts (lazy getter), removed when
setHost(undefined) is called.
Verified:
- npm run typecheck (server + web): 0 errors
- npm run lint: 0 errors (one targeted eslint-disable for the
no-this-alias rule required by the lazy-getter pattern)
- npm run test:unit: 434 files / 5843 tests passing, 29 skipped, 0 failed
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Plugin API v2 extension. Plugins can now call a tiny host facade via
context.host(PluginHost) to:context.host.sessions.create)context.host.sessions.stop)context.host.workflows.launch)Design rationale
The facade reuses the session manager and the task-seeded workflow
launcher already used by the MCP / WS paths so we don't introduce a
second implementation. The
isRunningcycle stays entirely managedby OpenFox; we never expose
SessionManager,launchWorkflowRun, orsetRunning.Plugins get exactly three generic operations already used by the
native MCP / WS surfaces. The API is generic and reusable by any
plugin, not specific to a single consumer.
Public surface
Implementation
src/plugin/index.ts: new interfaces + optionalhost?field onPluginContext(and on the tool context so RPC handlers see it too).src/server/plugins/host.ts: newcurrentHostfield +setHostmethod;createContextsnapshotshostvia a lazy getter so plugins loadedbefore
setHoststill see the new value.src/server/index.ts:setHost({sessions, workflows})wired after thetasks launcher is initialised.
Tests
src/server/plugins/host.test.tscovers:Verification
npm run typecheck(server + web): 0 errorsnpm run lint: 0 errors (one targeted eslint-disable for theno-this-alias rule required by the lazy-getter pattern)
npm run test:unit: 434 files / 5843 tests passing, 29 skipped, 0 failedAI-Enhanced Development
AI Models: MiniMax M3
What is NOT in this PR
SessionManageris not exposedlaunchWorkflowRunis not exposedsetRunningis not exposeddelegates to the existing primitives used by MCP / tasks