feat: Hermes Agent plugin v2 with full test coverage and zero TS errors#8
Merged
Conversation
…ive tests Major changes: - Add Node.js bridge (bridge.mjs) for real framework integration via JSON IPC - Quality gate + pre/post processor pipeline on code-producing tools - File logging to activity.log and plugin-tool-events.log - Session stats tracking (quality gate runs, blocks, bridge calls/errors) - Smart terminal nudges based on command patterns (grep, eslint, audit, etc.) - Slash command /strray with status, stats, help subcommands - Bridge-first tool execution with CLI fallback - Project root detection (env var, node_modules/strray-ai, .opencode/strray) Test coverage: 103 tests, 99% on tools.py, 100% on schemas.py - Bridge error paths (JSON decode, OS errors, timeouts, generic exceptions) - Pre/post hook bridge error resilience - All 5 code tools verified to trigger bridge - Partial processor failure handling - Edge cases (None args, non-dict results, empty paths, missing keys) - Slash command edge cases (unknown command, case insensitivity) - Log timestamp format verification - Live bridge integration tests (health, stats, quality gate, violations) Files: __init__.py: 500 lines (hooks, bridge, slash cmd, file logging, session mgmt) bridge.mjs: 553 lines (Node.js IPC to StringRay framework components) tools.py: 207 lines (strray_validate, strray_codex_check, strray_health) test_plugin.py: 944 lines (103 tests, 23 test classes) schemas.py: 71 lines (tool parameter schemas) conftest.py: 14 lines (pytest config) after-install.md: 35 lines (post-install setup instructions) plugin.yaml: 11 lines (plugin manifest)
…postinstall
Two fixes for the Hermes plugin distribution pipeline:
1. Add src/integrations/hermes-agent/ to package.json files array
- Previously the plugin source was not included in the npm tarball
- The skill (src/skills/) was included but the plugin (src/integrations/) was not
2. Add plugin installation to postinstall.cjs
- Detects ~/.hermes/ directory (Hermes Agent presence check)
- Copies all 7 plugin files to ~/.hermes/plugins/strray-hermes/
- Uses mtime comparison to skip if already up to date
- Copies: __init__.py, tools.py, schemas.py, plugin.yaml, bridge.mjs, conftest.py, after-install.md
- Graceful error handling — never blocks npm install
Flow after fix:
npm install strray-ai
-> postinstall detects ~/.hermes/
-> copies skill to ~/.hermes/skills/hermes-agent/SKILL.md
-> copies plugin to ~/.hermes/plugins/strray-hermes/ (7 files)
-> Hermes restart picks up the plugin automatically
- Change files array from directory glob to explicit file list This prevents __pycache__ and .pytest_cache from being packaged - Add test_plugin.py to both files array and postinstall copy list - Add .npmignore as defense-in-depth for any future src/ additions npm pack --dry-run verification: - 8 hermes-agent files included - 0 __pycache__ files - Total tarball size clean
- Sync all version refs from 1.15.1 -> 1.15.6 (1 ahead of npm 1.15.5) - Fix duplicate imports in model-router.test.ts and test-auto-creation-processor.test.ts - Fix AGENTS.md currency test: 31 days could round to 30, use 40 days - Add system prompt to DEFAULT_AGENT_CONFIG in agent-resolver.ts Test results: 151 passed / 9 failed (down from 145 passed / 15 failed) Remaining 9 failures are pre-existing missing npm deps (express, ws, @modelcontextprotocol/sdk)
- Add express, ws, @modelcontextprotocol/sdk as devDependencies - Resolves all 9 remaining test failures Test results: 160 passed / 0 failed (2311 tests)
- Install missing deps: express, ws, @modelcontextprotocol/sdk - Fix agent-delegator.test.ts: rewrite 20 tests to match current API - Fix orchestrator.test.ts: add missing mocks, fix assertion shapes - Fix consent-manager.test.ts: unique temp dirs per test for isolation - Fix consent-manager.ts: handle absolute paths correctly - Fix processor-activation.test.ts: explicit mock return for codexCompliance - Fix state-manager-persistence.test.ts: mock fs.statSync - Fix SuccessHandler.test.ts: clear console spy between tests - Fix performance-system-orchestrator.ts: set monitoringActive before async ops - Fix framework-enforcement-integration.test.ts: import path, assertions - Fix architect.test.ts: unskip integration points describe - Fix codex-enforcement-e2e.test.ts: rule ID mismatches, assertion counts - Fix e2e-orchestration-flow.test.ts: rewrite to match BootOrchestrator API - Fix rule-enforcer.ts: resolve-all-errors -> error-resolution, loop-safety IDs Test results: 161 passed / 0 failed / 0 skipped (2359 tests)
- CircuitBreaker: fix double-counting of successes/failures (counted in both executeWithTimeout and onSuccess/onFailure) - CircuitBreaker: make onSuccess/onFailure/trip/reset async to properly await frameworkLogger.log() calls (was using await in non-async context) - CircuitBreaker: clean up mangled log event names - processor-manager: remove unreachable dead code after throw statement - kernel-patterns: remove no-op inverted logic block that did nothing - state-manager: fix logging operationsProcessed before clearing queue (was always 0) - orchestrator: fix getStatus() totalProcessed to use proper counter instead of queue+active (which returned pending count, not processed count) - strray-activation: fix activateCodexInjection to actually push hook to globalThis.strRayHooks (was created and discarded) All 161 test files / 2359 tests passing.
- Fix wrong import paths (framework-logger.js, context-loader.js, job-correlation-manager.js, orchestrator.js, PostProcessor.js)
- Fix missing properties on AgentConfig objects in tests (capabilities, maxComplexity, enabled)
- Fix missing 'operation' property on PostProcessorData objects
- Fix implicit 'any' types in test callbacks and parameters
- Fix LogStatus type mismatches ('warn' -> 'warning') in registry.ts
- Fix Record<LogLevel> index type in Integration.ts
- Fix await in non-async contexts (iac-validator.ts, orchestration-flow-validator.ts)
- Fix constructor argument counts in test files (MCPClientManager, MonitoringEngine, ProcessorManager)
- Fix inputSchema missing required 'type' property in tool-cache tests
- Fix mock type casting in tool-discovery and tool-executor tests
- Fix ws module declaration (vendor.d.ts) - proper WebSocket class with static constants
- Fix WebSocket imports to avoid DOM type collision (use named import from 'ws' module)
- Add null-safe assertions (!) for WebSocket operations after construction
- Add stub modules for missing imports (predictive-analytics, live-metrics-collector, marketplace-service, ml/core/types)
- Export missing interfaces from integration.ts (TaskContext, AgentConfig, IntegrationResult)
- Fix processor-activation.test.ts wrong ProcessorResult import
- Fix rule-enforcer.test.ts mock path
- Clean up unused vendor.d.ts test file
Result: 0 TypeScript errors on full project compilation (was 152)
All 161 test files / 2359 tests still passing.
- Added eslint-plugin-vitest dependency for processor test linting - Converted processor-mock-validator.ts to processor-mock-validator.js to avoid ts-node ESM issues in CI - Updated CI workflow to use node instead of npx ts-node
- Renamed processor-mock-validator.js to .cjs (ES module compatibility) - Removed vitest plugin from processor-test-rules.js to fix circular JSON error (vitest/globals and plugin:vitest/recommended caused issues)
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
Upgrade the Hermes Agent native plugin to v2 with a bridge pipeline architecture, comprehensive tests, and fix all TypeScript errors across the codebase.
Changes
Plugin Features
__pycache__Test Fixes (48 tests unskipped, all passing)
Source Code Bug Fixes (7 bugs)
TypeScript Error Fixes (152 -> 0)
Test Results
Files Changed
~47 files modified, 319 insertions, 117 deletions