Skip to content

feat(backends): add archetype field to AgentEngineDefinition#1018

Merged
aaight merged 1 commit intodevfrom
feature/archetype-field-agent-engine-definition
Mar 23, 2026
Merged

feat(backends): add archetype field to AgentEngineDefinition#1018
aaight merged 1 commit intodevfrom
feature/archetype-field-agent-engine-definition

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 23, 2026

Summary

  • Adds readonly archetype: 'sdk' | 'native-tool' field to AgentEngineDefinition interface in src/backends/types.ts
  • Sets archetype values on all 4 catalog entries: LLMist → sdk, Claude Code/Codex/OpenCode → native-tool
  • Adds isNativeToolEngine(engineId) and isNativeToolEngineDefinition(def) helper functions in src/backends/registry.ts (also exported from src/backends/index.ts)
  • Replaces the hardcoded ['claude-code', 'codex', 'opencode'].includes(engineId) check in secretOrchestrator.ts with isNativeToolEngineDefinition(engine.definition)
  • Updates all test files with mock AgentEngineDefinition objects to include the new archetype field
  • Adds archetype validation to engine-contract.test.ts and catalog.test.ts
  • Adds isNativeToolEngine / isNativeToolEngineDefinition unit tests to registry.test.ts

Test plan

  • npm run typecheck — passes with zero errors
  • npm test — all 6698 tests pass, no regressions
  • npm run lint — passes with no issues
  • New tests in engine-contract.test.ts validate archetype field exists and is 'sdk' or 'native-tool'
  • New tests in catalog.test.ts validate archetype for each engine and cross-cutting archetype constraints
  • New tests in registry.test.ts validate isNativeToolEngine and isNativeToolEngineDefinition helpers

Card: https://trello.com/c/69c1aa02a6010792e20e4992

🤖 Generated with Claude Code

🕵️ claude-code · claude-sonnet-4-6 · run details

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

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

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 archetype field is correctly added as readonly with 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 _engineId parameter 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 the src/ 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.ts mock correctly derives archetype from a local ID list, which is reasonable for a test helper

🕵️ claude-code · claude-opus-4-6 · run details

@aaight aaight merged commit 2ad268d into dev Mar 23, 2026
9 checks passed
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.

2 participants