feat: make default workflow domain configurable at runtime#281
Open
mrsimpson wants to merge 3 commits into
Open
feat: make default workflow domain configurable at runtime#281mrsimpson wants to merge 3 commits into
mrsimpson wants to merge 3 commits into
Conversation
Eliminate hardcoded 'code' defaults in WorkflowManager through: - Four-level env var chain: constructor param > WORKFLOW_DOMAINS > DEFAULT_DOMAINS > VIBE_WORKFLOW_DOMAINS > empty Set (all workflows) - defaultDomains constructor parameter for programmatic override - DEFAULT_ALL_DOMAINS env var for getAllAvailableWorkflows() - setDomains() method for runtime domain switching with validation - DOMAIN_DESCRIPTIONS constant with meaningful domain summaries - load_workflows tool in MCP server and OpenCode plugin for LLM to dynamically load domains without restarting the process Fix pre-existing bug: loadPredefinedWorkflows() now clears maps before reloading, preventing workflow accumulation across domain switches. Add 18 new tests: 9 for env var precedence chain, 9 for setDomains(). Update existing domain filtering test for new empty Set default.
Simplify load_workflows tool parameter to use domain name enums instead of embedding full descriptions. This keeps the tool schema lean and reduces LLM context usage. - load_workflows(domains: string[]) now uses a simple enum - New domain-info:// resource exposes full domain descriptions - OpenCode plugin uses enum with inline domain list in description - Domain descriptions kept in DOMAIN_DESCRIPTIONS constant (core)
Collaborator
Author
|
@claude Review once |
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
Eliminate hardcoded
'code'default domain inWorkflowManagerand provide runtime domain switching for long-lived processes (MCP server, OpenCode plugin).Changes
WORKFLOW_DOMAINS>DEFAULT_DOMAINS>VIBE_WORKFLOW_DOMAINS> empty Set (all workflows)defaultDomainsconstructor parameter for programmatic override (library consumers, testing)DEFAULT_ALL_DOMAINSenv var forgetAllAvailableWorkflows()— replaces incomplete hardcoded listsetDomains()method for runtime domain switching with validation against known domainsDOMAIN_DESCRIPTIONSconstant with meaningful summaries of what each domain is suitable forload_workflowstool — simple enum parameter, domain descriptions exposed viadomain://resourcedomain://resource — exposes all available domains with descriptions for LLM discoveryloadPredefinedWorkflows()now clears maps before reloading (prevents workflow accumulation)Tests
setDomains()game-beginner.yaml)Architecture Decision
Domain descriptions are exposed as a resource (
domain://) rather than embedded in the tool parameter. This keeps the tool schema lean and reduces LLM context usage. The LLM can query the resource to discover domains before callingload_workflows.Affected Files
packages/core/src/workflow-manager.ts— core changespackages/core/test/unit/workflow-domains-precedence.test.ts— 9 new testspackages/core/test/unit/workflow-domain-switching.test.ts— 9 new tests (new file)packages/core/test/unit/workflow-domain-filtering.test.ts— updated for empty Set defaultpackages/mcp-server/src/server-config.ts— registerload_workflowstool +domain://resourcepackages/mcp-server/src/tool-handlers/load-workflows.ts— simplified handler (new file)packages/mcp-server/src/tool-handlers/index.ts— register handlerpackages/opencode-plugin/src/plugin.ts— registerload_workflowstoolpackages/opencode-plugin/src/tool-handlers/load-workflows.ts— simplified handler (new file)Backward Compatibility
VIBE_WORKFLOW_DOMAINSstill works as lowest-priority env varoptions?: WorkflowManagerOptionsto constructor is backward compatiblecodedefault)UX: No Active Workflow Prompt
When no workflow is active, the plugin injects this message (unchanged):