feat(backends): add archetype field to AgentEngineDefinition#1018
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
nhopeatall
approved these changes
Mar 23, 2026
Collaborator
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
LGTM — Clean, well-scoped refactoring that replaces a hardcoded engine ID list with a type-safe archetype field on the engine definition interface. The change is correct, fully tested, and CI passes.
The core improvement is solid: ['claude-code', 'codex', 'opencode'].includes(engineId) in secretOrchestrator.ts is replaced with isNativeToolEngineDefinition(engine.definition), which means adding a new native-tool engine no longer requires hunting for hardcoded ID lists — just set archetype: 'native-tool' on the definition.
Key observations:
- The
archetypefield is correctly added asreadonlywith a union type'sdk' | 'native-tool'— TypeScript enforces completeness at compile time - All 4 catalog entries have the correct archetype assigned (LLMist →
sdk, Claude Code/Codex/OpenCode →native-tool) - The
_engineIdparameter prefix convention is appropriate since it's no longer used in the function body but kept for call-site compatibility - No other hardcoded
['claude-code', 'codex', 'opencode']checks remain in thesrc/directory - The
isNativeToolEngine(engineId)helper (registry lookup by ID) is exported but not yet consumed — that's fine as a forward-looking convenience - Test coverage is thorough: contract tests, catalog cross-cutting tests, and direct unit tests for both helper functions
- The
adapter.test.tsmock correctly derives archetype from a local ID list, which is reasonable for a test helper
🕵️ claude-code · claude-opus-4-6 · run details
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
readonly archetype: 'sdk' | 'native-tool'field toAgentEngineDefinitioninterface insrc/backends/types.tssdk, Claude Code/Codex/OpenCode →native-toolisNativeToolEngine(engineId)andisNativeToolEngineDefinition(def)helper functions insrc/backends/registry.ts(also exported fromsrc/backends/index.ts)['claude-code', 'codex', 'opencode'].includes(engineId)check insecretOrchestrator.tswithisNativeToolEngineDefinition(engine.definition)AgentEngineDefinitionobjects to include the newarchetypefieldengine-contract.test.tsandcatalog.test.tsisNativeToolEngine/isNativeToolEngineDefinitionunit tests toregistry.test.tsTest plan
npm run typecheck— passes with zero errorsnpm test— all 6698 tests pass, no regressionsnpm run lint— passes with no issuesengine-contract.test.tsvalidatearchetypefield exists and is'sdk'or'native-tool'catalog.test.tsvalidate archetype for each engine and cross-cutting archetype constraintsregistry.test.tsvalidateisNativeToolEngineandisNativeToolEngineDefinitionhelpersCard: https://trello.com/c/69c1aa02a6010792e20e4992
🤖 Generated with Claude Code
🕵️ claude-code · claude-sonnet-4-6 · run details