@opensearch-project/agent-health 0.3.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -6
- package/cli/dist/index.js +10072 -4502
- package/deployment/cloudformation/agent-health-observability.yaml +762 -0
- package/dist/assets/index-CCQRDlO0.js +243 -0
- package/dist/assets/index-CNHQVbcj.css +1 -0
- package/dist/index.html +2 -2
- package/docs/ARCHITECTURE.md +450 -0
- package/docs/BACKEND_JOB_QUEUE.md +405 -0
- package/docs/CLAUDE_CODE_TELEMETRY.md +283 -0
- package/docs/CLI.md +431 -0
- package/docs/CODING_AGENT_ANALYTICS.md +298 -0
- package/docs/CONFIGURATION.md +388 -0
- package/docs/CONNECTORS.md +536 -0
- package/docs/INSTRUMENT_WITH_OTEL.md +390 -0
- package/docs/ML-COMMONS-SETUP.md +289 -0
- package/docs/NPX_PACKAGING.md +195 -0
- package/docs/PERFORMANCE-MONITORING.md +200 -0
- package/docs/PERFORMANCE.md +390 -0
- package/docs/PI_PROFILING.md +169 -0
- package/docs/PLAN-non-agui-agent-support.md +525 -0
- package/docs/SDK.md +577 -0
- package/docs/SKILLS.md +264 -0
- package/docs/blogs/2026-02-28-opensearch-agent-health.md +200 -0
- package/docs/blogs/getting-started-blog.md +608 -0
- package/docs/diagrams/Agent-health.excalidraw +5656 -0
- package/docs/diagrams/architecture.png +0 -0
- package/docs/plans/field-redesign.md +468 -0
- package/docs/rfcs/001-coding-agent-analytics.md +374 -0
- package/docs/rfcs/002-enterprise-leaderboard.md +267 -0
- package/docs/rfcs/003-remote-aggregation.md +146 -0
- package/docs/rfcs/004-test-sdk-v2.md +599 -0
- package/docs/skills/AGENT_HEALTH.md +598 -0
- package/docs/skills/AGENT_PROFILE.md +191 -0
- package/docs/skills/add-connector/SKILL.md +68 -0
- package/docs/skills/agent-health-profile/SKILL.md +40 -0
- package/docs/skills/config-auth/SKILL.md +194 -0
- package/docs/skills/config-auth/evals/evals.json +35 -0
- package/docs/skills/create-pr/SKILL.md +73 -0
- package/docs/skills/instrument-otel/SKILL.md +84 -0
- package/docs/skills/write-test/SKILL.md +124 -0
- package/docs/ui prd.md +376 -0
- package/examples/README.md +53 -0
- package/examples/config/agent-health.config.example.ts +155 -0
- package/examples/connectors/echo-connector.ts +131 -0
- package/examples/eval-files/demo.eval.js +128 -0
- package/examples/eval-files/sdk-hooks-demo.eval.js +99 -0
- package/examples/pi-profiling/README.md +77 -0
- package/examples/pi-profiling/agent-health-profile.ts +417 -0
- package/lib/dist/lib/agentUtils.d.ts +29 -0
- package/lib/dist/lib/agentUtils.d.ts.map +1 -0
- package/lib/dist/lib/agentUtils.js +43 -0
- package/lib/dist/lib/agentUtils.js.map +1 -0
- package/lib/dist/lib/benchmarkExport.d.ts +14 -0
- package/lib/dist/lib/benchmarkExport.d.ts.map +1 -0
- package/lib/dist/lib/benchmarkExport.js +41 -0
- package/lib/dist/lib/benchmarkExport.js.map +1 -0
- package/lib/dist/lib/benchmarkVersionUtils.d.ts +37 -0
- package/lib/dist/lib/benchmarkVersionUtils.d.ts.map +1 -0
- package/lib/dist/lib/benchmarkVersionUtils.js +68 -0
- package/lib/dist/lib/benchmarkVersionUtils.js.map +1 -0
- package/lib/dist/lib/config/defineConfig.d.ts +27 -0
- package/lib/dist/lib/config/defineConfig.d.ts.map +1 -0
- package/lib/dist/lib/config/defineConfig.js +28 -0
- package/lib/dist/lib/config/defineConfig.js.map +1 -0
- package/lib/dist/lib/config/index.d.ts +9 -0
- package/lib/dist/lib/config/index.d.ts.map +1 -0
- package/lib/dist/lib/config/index.js +8 -0
- package/lib/dist/lib/config/index.js.map +1 -0
- package/lib/dist/lib/config/loader.d.ts +39 -0
- package/lib/dist/lib/config/loader.d.ts.map +1 -0
- package/lib/dist/lib/config/loader.js +258 -0
- package/lib/dist/lib/config/loader.js.map +1 -0
- package/lib/dist/lib/config/statePaths.d.ts +61 -0
- package/lib/dist/lib/config/statePaths.d.ts.map +1 -0
- package/lib/dist/lib/config/statePaths.js +188 -0
- package/lib/dist/lib/config/statePaths.js.map +1 -0
- package/lib/dist/lib/config/types.d.ts +231 -0
- package/lib/dist/lib/config/types.d.ts.map +1 -0
- package/lib/dist/lib/config/types.js +6 -0
- package/lib/dist/lib/config/types.js.map +1 -0
- package/lib/dist/lib/config.d.ts +39 -0
- package/lib/dist/lib/config.d.ts.map +1 -0
- package/lib/dist/lib/config.js +118 -0
- package/lib/dist/lib/config.js.map +1 -0
- package/lib/dist/lib/constants.d.ts +70 -0
- package/lib/dist/lib/constants.d.ts.map +1 -0
- package/lib/dist/lib/constants.js +365 -0
- package/lib/dist/lib/constants.js.map +1 -0
- package/lib/dist/lib/contextUtilization.d.ts +23 -0
- package/lib/dist/lib/contextUtilization.d.ts.map +1 -0
- package/lib/dist/lib/contextUtilization.js +72 -0
- package/lib/dist/lib/contextUtilization.js.map +1 -0
- package/lib/dist/lib/dashboardMetrics.d.ts +87 -0
- package/lib/dist/lib/dashboardMetrics.d.ts.map +1 -0
- package/lib/dist/lib/dashboardMetrics.js +242 -0
- package/lib/dist/lib/dashboardMetrics.js.map +1 -0
- package/lib/dist/lib/dataSourceConfig.d.ts +108 -0
- package/lib/dist/lib/dataSourceConfig.d.ts.map +1 -0
- package/lib/dist/lib/dataSourceConfig.js +166 -0
- package/lib/dist/lib/dataSourceConfig.js.map +1 -0
- package/lib/dist/lib/debug.d.ts +26 -0
- package/lib/dist/lib/debug.d.ts.map +1 -0
- package/lib/dist/lib/debug.js +132 -0
- package/lib/dist/lib/debug.js.map +1 -0
- package/lib/dist/lib/diagnostics.d.ts +28 -0
- package/lib/dist/lib/diagnostics.d.ts.map +1 -0
- package/lib/dist/lib/diagnostics.js +65 -0
- package/lib/dist/lib/diagnostics.js.map +1 -0
- package/lib/dist/lib/envCompat.d.ts +27 -0
- package/lib/dist/lib/envCompat.d.ts.map +1 -0
- package/lib/dist/lib/envCompat.js +73 -0
- package/lib/dist/lib/envCompat.js.map +1 -0
- package/lib/dist/lib/findPackageRoot.d.ts +7 -0
- package/lib/dist/lib/findPackageRoot.d.ts.map +1 -0
- package/lib/dist/lib/findPackageRoot.js +57 -0
- package/lib/dist/lib/findPackageRoot.js.map +1 -0
- package/lib/dist/lib/hooks.d.ts +36 -0
- package/lib/dist/lib/hooks.d.ts.map +1 -0
- package/lib/dist/lib/hooks.js +112 -0
- package/lib/dist/lib/hooks.js.map +1 -0
- package/lib/dist/lib/index.d.ts +47 -0
- package/lib/dist/lib/index.d.ts.map +1 -0
- package/lib/dist/lib/index.js +62 -0
- package/lib/dist/lib/index.js.map +1 -0
- package/lib/dist/lib/labels.d.ts +90 -0
- package/lib/dist/lib/labels.d.ts.map +1 -0
- package/lib/dist/lib/labels.js +158 -0
- package/lib/dist/lib/labels.js.map +1 -0
- package/lib/dist/lib/markdown.d.ts +16 -0
- package/lib/dist/lib/markdown.d.ts.map +1 -0
- package/lib/dist/lib/markdown.js +42 -0
- package/lib/dist/lib/markdown.js.map +1 -0
- package/lib/dist/lib/matchers/expect.d.ts +3 -0
- package/lib/dist/lib/matchers/expect.d.ts.map +1 -0
- package/lib/dist/lib/matchers/expect.js +225 -0
- package/lib/dist/lib/matchers/expect.js.map +1 -0
- package/lib/dist/lib/matchers/index.d.ts +8 -0
- package/lib/dist/lib/matchers/index.d.ts.map +1 -0
- package/lib/dist/lib/matchers/index.js +9 -0
- package/lib/dist/lib/matchers/index.js.map +1 -0
- package/lib/dist/lib/matchers/judgeAccessor.d.ts +113 -0
- package/lib/dist/lib/matchers/judgeAccessor.d.ts.map +1 -0
- package/lib/dist/lib/matchers/judgeAccessor.js +183 -0
- package/lib/dist/lib/matchers/judgeAccessor.js.map +1 -0
- package/lib/dist/lib/matchers/session.d.ts +39 -0
- package/lib/dist/lib/matchers/session.d.ts.map +1 -0
- package/lib/dist/lib/matchers/session.js +116 -0
- package/lib/dist/lib/matchers/session.js.map +1 -0
- package/lib/dist/lib/matchers/traces.d.ts +55 -0
- package/lib/dist/lib/matchers/traces.d.ts.map +1 -0
- package/lib/dist/lib/matchers/traces.js +116 -0
- package/lib/dist/lib/matchers/traces.js.map +1 -0
- package/lib/dist/lib/matchers/types.d.ts +75 -0
- package/lib/dist/lib/matchers/types.d.ts.map +1 -0
- package/lib/dist/lib/matchers/types.js +6 -0
- package/lib/dist/lib/matchers/types.js.map +1 -0
- package/lib/dist/lib/packagePaths.d.ts +29 -0
- package/lib/dist/lib/packagePaths.d.ts.map +1 -0
- package/lib/dist/lib/packagePaths.js +63 -0
- package/lib/dist/lib/packagePaths.js.map +1 -0
- package/lib/dist/lib/performance.d.ts +51 -0
- package/lib/dist/lib/performance.d.ts.map +1 -0
- package/lib/dist/lib/performance.js +159 -0
- package/lib/dist/lib/performance.js.map +1 -0
- package/lib/dist/lib/portConfig.d.ts +29 -0
- package/lib/dist/lib/portConfig.d.ts.map +1 -0
- package/lib/dist/lib/portConfig.js +64 -0
- package/lib/dist/lib/portConfig.js.map +1 -0
- package/lib/dist/lib/preferences.d.ts +63 -0
- package/lib/dist/lib/preferences.d.ts.map +1 -0
- package/lib/dist/lib/preferences.js +117 -0
- package/lib/dist/lib/preferences.js.map +1 -0
- package/lib/dist/lib/resolveAgentModel.d.ts +22 -0
- package/lib/dist/lib/resolveAgentModel.d.ts.map +1 -0
- package/lib/dist/lib/resolveAgentModel.js +37 -0
- package/lib/dist/lib/resolveAgentModel.js.map +1 -0
- package/lib/dist/lib/runStats.d.ts +92 -0
- package/lib/dist/lib/runStats.d.ts.map +1 -0
- package/lib/dist/lib/runStats.js +160 -0
- package/lib/dist/lib/runStats.js.map +1 -0
- package/lib/dist/lib/telemetry/constants.d.ts +60 -0
- package/lib/dist/lib/telemetry/constants.d.ts.map +1 -0
- package/lib/dist/lib/telemetry/constants.js +87 -0
- package/lib/dist/lib/telemetry/constants.js.map +1 -0
- package/lib/dist/lib/telemetry/evalSpans.d.ts +61 -0
- package/lib/dist/lib/telemetry/evalSpans.d.ts.map +1 -0
- package/lib/dist/lib/telemetry/evalSpans.js +254 -0
- package/lib/dist/lib/telemetry/evalSpans.js.map +1 -0
- package/lib/dist/lib/telemetry/index.d.ts +11 -0
- package/lib/dist/lib/telemetry/index.d.ts.map +1 -0
- package/lib/dist/lib/telemetry/index.js +15 -0
- package/lib/dist/lib/telemetry/index.js.map +1 -0
- package/lib/dist/lib/telemetry/opensearchExporter.d.ts +43 -0
- package/lib/dist/lib/telemetry/opensearchExporter.d.ts.map +1 -0
- package/lib/dist/lib/telemetry/opensearchExporter.js +217 -0
- package/lib/dist/lib/telemetry/opensearchExporter.js.map +1 -0
- package/lib/dist/lib/telemetry/provider.d.ts +55 -0
- package/lib/dist/lib/telemetry/provider.d.ts.map +1 -0
- package/lib/dist/lib/telemetry/provider.js +140 -0
- package/lib/dist/lib/telemetry/provider.js.map +1 -0
- package/lib/dist/lib/testCaseLabels.d.ts +34 -0
- package/lib/dist/lib/testCaseLabels.d.ts.map +1 -0
- package/lib/dist/lib/testCaseLabels.js +88 -0
- package/lib/dist/lib/testCaseLabels.js.map +1 -0
- package/lib/dist/lib/testCaseValidation.d.ts +140 -0
- package/lib/dist/lib/testCaseValidation.d.ts.map +1 -0
- package/lib/dist/lib/testCaseValidation.js +162 -0
- package/lib/dist/lib/testCaseValidation.js.map +1 -0
- package/lib/dist/lib/testCases/agentFixture.d.ts +80 -0
- package/lib/dist/lib/testCases/agentFixture.d.ts.map +1 -0
- package/lib/dist/lib/testCases/agentFixture.js +43 -0
- package/lib/dist/lib/testCases/agentFixture.js.map +1 -0
- package/lib/dist/lib/testCases/authoringSurface.d.ts +10 -0
- package/lib/dist/lib/testCases/authoringSurface.d.ts.map +1 -0
- package/lib/dist/lib/testCases/authoringSurface.js +54 -0
- package/lib/dist/lib/testCases/authoringSurface.js.map +1 -0
- package/lib/dist/lib/testCases/codemod.d.ts +13 -0
- package/lib/dist/lib/testCases/codemod.d.ts.map +1 -0
- package/lib/dist/lib/testCases/codemod.js +169 -0
- package/lib/dist/lib/testCases/codemod.js.map +1 -0
- package/lib/dist/lib/testCases/define.d.ts +114 -0
- package/lib/dist/lib/testCases/define.d.ts.map +1 -0
- package/lib/dist/lib/testCases/define.js +253 -0
- package/lib/dist/lib/testCases/define.js.map +1 -0
- package/lib/dist/lib/testCases/evaluators.d.ts +80 -0
- package/lib/dist/lib/testCases/evaluators.d.ts.map +1 -0
- package/lib/dist/lib/testCases/evaluators.js +105 -0
- package/lib/dist/lib/testCases/evaluators.js.map +1 -0
- package/lib/dist/lib/testCases/index.d.ts +14 -0
- package/lib/dist/lib/testCases/index.d.ts.map +1 -0
- package/lib/dist/lib/testCases/index.js +12 -0
- package/lib/dist/lib/testCases/index.js.map +1 -0
- package/lib/dist/lib/testCases/judge.d.ts +165 -0
- package/lib/dist/lib/testCases/judge.d.ts.map +1 -0
- package/lib/dist/lib/testCases/judge.js +359 -0
- package/lib/dist/lib/testCases/judge.js.map +1 -0
- package/lib/dist/lib/testCases/loader.d.ts +26 -0
- package/lib/dist/lib/testCases/loader.d.ts.map +1 -0
- package/lib/dist/lib/testCases/loader.js +149 -0
- package/lib/dist/lib/testCases/loader.js.map +1 -0
- package/lib/dist/lib/testCases/types.d.ts +242 -0
- package/lib/dist/lib/testCases/types.d.ts.map +1 -0
- package/lib/dist/lib/testCases/types.js +6 -0
- package/lib/dist/lib/testCases/types.js.map +1 -0
- package/lib/dist/lib/theme.d.ts +6 -0
- package/lib/dist/lib/theme.d.ts.map +1 -0
- package/lib/dist/lib/theme.js +36 -0
- package/lib/dist/lib/theme.js.map +1 -0
- package/lib/dist/lib/uiTelemetry.d.ts +7 -0
- package/lib/dist/lib/uiTelemetry.d.ts.map +1 -0
- package/lib/dist/lib/uiTelemetry.js +25 -0
- package/lib/dist/lib/uiTelemetry.js.map +1 -0
- package/lib/dist/lib/utils.d.ts +96 -0
- package/lib/dist/lib/utils.d.ts.map +1 -0
- package/lib/dist/lib/utils.js +232 -0
- package/lib/dist/lib/utils.js.map +1 -0
- package/lib/dist/lib/workflow/consolidate.d.ts +12 -0
- package/lib/dist/lib/workflow/consolidate.d.ts.map +1 -0
- package/lib/dist/lib/workflow/consolidate.js +33 -0
- package/lib/dist/lib/workflow/consolidate.js.map +1 -0
- package/lib/dist/lib/workflow/index.d.ts +13 -0
- package/lib/dist/lib/workflow/index.d.ts.map +1 -0
- package/lib/dist/lib/workflow/index.js +12 -0
- package/lib/dist/lib/workflow/index.js.map +1 -0
- package/lib/dist/lib/workflow/ledger.d.ts +30 -0
- package/lib/dist/lib/workflow/ledger.d.ts.map +1 -0
- package/lib/dist/lib/workflow/ledger.js +41 -0
- package/lib/dist/lib/workflow/ledger.js.map +1 -0
- package/lib/dist/lib/workflow/pool.d.ts +13 -0
- package/lib/dist/lib/workflow/pool.d.ts.map +1 -0
- package/lib/dist/lib/workflow/pool.js +44 -0
- package/lib/dist/lib/workflow/pool.js.map +1 -0
- package/lib/dist/lib/workflow/source.d.ts +22 -0
- package/lib/dist/lib/workflow/source.d.ts.map +1 -0
- package/lib/dist/lib/workflow/source.js +29 -0
- package/lib/dist/lib/workflow/source.js.map +1 -0
- package/lib/dist/lib/workflow/stepB.d.ts +71 -0
- package/lib/dist/lib/workflow/stepB.d.ts.map +1 -0
- package/lib/dist/lib/workflow/stepB.js +99 -0
- package/lib/dist/lib/workflow/stepB.js.map +1 -0
- package/lib/dist/lib/workflow/types.d.ts +86 -0
- package/lib/dist/lib/workflow/types.d.ts.map +1 -0
- package/lib/dist/lib/workflow/types.js +6 -0
- package/lib/dist/lib/workflow/types.js.map +1 -0
- package/lib/dist/lib/workflow/workflow.d.ts +119 -0
- package/lib/dist/lib/workflow/workflow.d.ts.map +1 -0
- package/lib/dist/lib/workflow/workflow.js +195 -0
- package/lib/dist/lib/workflow/workflow.js.map +1 -0
- package/lib/dist/services/agent/aguiConverter.d.ts +50 -0
- package/lib/dist/services/agent/aguiConverter.d.ts.map +1 -0
- package/lib/dist/services/agent/aguiConverter.js +449 -0
- package/lib/dist/services/agent/aguiConverter.js.map +1 -0
- package/lib/dist/services/agent/index.d.ts +10 -0
- package/lib/dist/services/agent/index.d.ts.map +1 -0
- package/lib/dist/services/agent/index.js +12 -0
- package/lib/dist/services/agent/index.js.map +1 -0
- package/lib/dist/services/agent/payloadBuilder.d.ts +33 -0
- package/lib/dist/services/agent/payloadBuilder.d.ts.map +1 -0
- package/lib/dist/services/agent/payloadBuilder.js +75 -0
- package/lib/dist/services/agent/payloadBuilder.js.map +1 -0
- package/lib/dist/services/agent/sseStream.d.ts +43 -0
- package/lib/dist/services/agent/sseStream.d.ts.map +1 -0
- package/lib/dist/services/agent/sseStream.js +223 -0
- package/lib/dist/services/agent/sseStream.js.map +1 -0
- package/lib/dist/services/connectors/agui/AGUIStreamingConnector.d.ts +44 -0
- package/lib/dist/services/connectors/agui/AGUIStreamingConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/agui/AGUIStreamingConnector.js +95 -0
- package/lib/dist/services/connectors/agui/AGUIStreamingConnector.js.map +1 -0
- package/lib/dist/services/connectors/base/BaseConnector.d.ts +81 -0
- package/lib/dist/services/connectors/base/BaseConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/base/BaseConnector.js +170 -0
- package/lib/dist/services/connectors/base/BaseConnector.js.map +1 -0
- package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.d.ts +116 -0
- package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.js +403 -0
- package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.js.map +1 -0
- package/lib/dist/services/connectors/index.d.ts +13 -0
- package/lib/dist/services/connectors/index.d.ts.map +1 -0
- package/lib/dist/services/connectors/index.js +32 -0
- package/lib/dist/services/connectors/index.js.map +1 -0
- package/lib/dist/services/connectors/kiro/KiroConnector.d.ts +48 -0
- package/lib/dist/services/connectors/kiro/KiroConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/kiro/KiroConnector.js +158 -0
- package/lib/dist/services/connectors/kiro/KiroConnector.js.map +1 -0
- package/lib/dist/services/connectors/langgraph/LangGraphConnector.d.ts +36 -0
- package/lib/dist/services/connectors/langgraph/LangGraphConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/langgraph/LangGraphConnector.js +175 -0
- package/lib/dist/services/connectors/langgraph/LangGraphConnector.js.map +1 -0
- package/lib/dist/services/connectors/mock/MockConnector.d.ts +37 -0
- package/lib/dist/services/connectors/mock/MockConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/mock/MockConnector.js +120 -0
- package/lib/dist/services/connectors/mock/MockConnector.js.map +1 -0
- package/lib/dist/services/connectors/openai-compatible/OpenAICompatibleConnector.d.ts +42 -0
- package/lib/dist/services/connectors/openai-compatible/OpenAICompatibleConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/openai-compatible/OpenAICompatibleConnector.js +133 -0
- package/lib/dist/services/connectors/openai-compatible/OpenAICompatibleConnector.js.map +1 -0
- package/lib/dist/services/connectors/pi/PiConnector.d.ts +87 -0
- package/lib/dist/services/connectors/pi/PiConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/pi/PiConnector.js +274 -0
- package/lib/dist/services/connectors/pi/PiConnector.js.map +1 -0
- package/lib/dist/services/connectors/registry.d.ts +57 -0
- package/lib/dist/services/connectors/registry.d.ts.map +1 -0
- package/lib/dist/services/connectors/registry.js +106 -0
- package/lib/dist/services/connectors/registry.js.map +1 -0
- package/lib/dist/services/connectors/rest/RESTConnector.d.ts +38 -0
- package/lib/dist/services/connectors/rest/RESTConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/rest/RESTConnector.js +117 -0
- package/lib/dist/services/connectors/rest/RESTConnector.js.map +1 -0
- package/lib/dist/services/connectors/server.d.ts +13 -0
- package/lib/dist/services/connectors/server.d.ts.map +1 -0
- package/lib/dist/services/connectors/server.js +34 -0
- package/lib/dist/services/connectors/server.js.map +1 -0
- package/lib/dist/services/connectors/strands/StrandsConnector.d.ts +48 -0
- package/lib/dist/services/connectors/strands/StrandsConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/strands/StrandsConnector.js +221 -0
- package/lib/dist/services/connectors/strands/StrandsConnector.js.map +1 -0
- package/lib/dist/services/connectors/subprocess/SubprocessConnector.d.ts +88 -0
- package/lib/dist/services/connectors/subprocess/SubprocessConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/subprocess/SubprocessConnector.js +418 -0
- package/lib/dist/services/connectors/subprocess/SubprocessConnector.js.map +1 -0
- package/lib/dist/services/connectors/types.d.ts +213 -0
- package/lib/dist/services/connectors/types.d.ts.map +1 -0
- package/lib/dist/services/connectors/types.js +6 -0
- package/lib/dist/services/connectors/types.js.map +1 -0
- package/lib/dist/services/evaluation/bedrockJudge.d.ts +64 -0
- package/lib/dist/services/evaluation/bedrockJudge.d.ts.map +1 -0
- package/lib/dist/services/evaluation/bedrockJudge.js +167 -0
- package/lib/dist/services/evaluation/bedrockJudge.js.map +1 -0
- package/lib/dist/services/evaluation/evaluatorError.d.ts +56 -0
- package/lib/dist/services/evaluation/evaluatorError.d.ts.map +1 -0
- package/lib/dist/services/evaluation/evaluatorError.js +56 -0
- package/lib/dist/services/evaluation/evaluatorError.js.map +1 -0
- package/lib/dist/services/evaluation/index.d.ts +106 -0
- package/lib/dist/services/evaluation/index.d.ts.map +1 -0
- package/lib/dist/services/evaluation/index.js +684 -0
- package/lib/dist/services/evaluation/index.js.map +1 -0
- package/lib/dist/services/evaluation/mockTrajectory.d.ts +3 -0
- package/lib/dist/services/evaluation/mockTrajectory.d.ts.map +1 -0
- package/lib/dist/services/evaluation/mockTrajectory.js +72 -0
- package/lib/dist/services/evaluation/mockTrajectory.js.map +1 -0
- package/lib/dist/services/opensearch/client.d.ts +26 -0
- package/lib/dist/services/opensearch/client.d.ts.map +1 -0
- package/lib/dist/services/opensearch/client.js +131 -0
- package/lib/dist/services/opensearch/client.js.map +1 -0
- package/lib/dist/services/opensearch/index.d.ts +16 -0
- package/lib/dist/services/opensearch/index.d.ts.map +1 -0
- package/lib/dist/services/opensearch/index.js +25 -0
- package/lib/dist/services/opensearch/index.js.map +1 -0
- package/lib/dist/services/storage/asyncBenchmarkStorage.d.ts +123 -0
- package/lib/dist/services/storage/asyncBenchmarkStorage.d.ts.map +1 -0
- package/lib/dist/services/storage/asyncBenchmarkStorage.js +429 -0
- package/lib/dist/services/storage/asyncBenchmarkStorage.js.map +1 -0
- package/lib/dist/services/storage/asyncRunStorage.d.ts +127 -0
- package/lib/dist/services/storage/asyncRunStorage.d.ts.map +1 -0
- package/lib/dist/services/storage/asyncRunStorage.js +448 -0
- package/lib/dist/services/storage/asyncRunStorage.js.map +1 -0
- package/lib/dist/services/storage/asyncTestCaseStorage.d.ts +156 -0
- package/lib/dist/services/storage/asyncTestCaseStorage.d.ts.map +1 -0
- package/lib/dist/services/storage/asyncTestCaseStorage.js +285 -0
- package/lib/dist/services/storage/asyncTestCaseStorage.js.map +1 -0
- package/lib/dist/services/storage/index.d.ts +17 -0
- package/lib/dist/services/storage/index.d.ts.map +1 -0
- package/lib/dist/services/storage/index.js +20 -0
- package/lib/dist/services/storage/index.js.map +1 -0
- package/lib/dist/services/storage/migration.d.ts +54 -0
- package/lib/dist/services/storage/migration.d.ts.map +1 -0
- package/lib/dist/services/storage/migration.js +296 -0
- package/lib/dist/services/storage/migration.js.map +1 -0
- package/lib/dist/services/storage/opensearchClient.d.ts +924 -0
- package/lib/dist/services/storage/opensearchClient.d.ts.map +1 -0
- package/lib/dist/services/storage/opensearchClient.js +435 -0
- package/lib/dist/services/storage/opensearchClient.js.map +1 -0
- package/lib/dist/services/traces/browserRecovery.d.ts +26 -0
- package/lib/dist/services/traces/browserRecovery.d.ts.map +1 -0
- package/lib/dist/services/traces/browserRecovery.js +81 -0
- package/lib/dist/services/traces/browserRecovery.js.map +1 -0
- package/lib/dist/services/traces/categoryStyles.d.ts +21 -0
- package/lib/dist/services/traces/categoryStyles.d.ts.map +1 -0
- package/lib/dist/services/traces/categoryStyles.js +56 -0
- package/lib/dist/services/traces/categoryStyles.js.map +1 -0
- package/lib/dist/services/traces/executionOrderTransform.d.ts +35 -0
- package/lib/dist/services/traces/executionOrderTransform.d.ts.map +1 -0
- package/lib/dist/services/traces/executionOrderTransform.js +313 -0
- package/lib/dist/services/traces/executionOrderTransform.js.map +1 -0
- package/lib/dist/services/traces/fetchSpansForRun.d.ts +86 -0
- package/lib/dist/services/traces/fetchSpansForRun.d.ts.map +1 -0
- package/lib/dist/services/traces/fetchSpansForRun.js +69 -0
- package/lib/dist/services/traces/fetchSpansForRun.js.map +1 -0
- package/lib/dist/services/traces/flowTransform.d.ts +24 -0
- package/lib/dist/services/traces/flowTransform.d.ts.map +1 -0
- package/lib/dist/services/traces/flowTransform.js +228 -0
- package/lib/dist/services/traces/flowTransform.js.map +1 -0
- package/lib/dist/services/traces/index.d.ts +121 -0
- package/lib/dist/services/traces/index.d.ts.map +1 -0
- package/lib/dist/services/traces/index.js +255 -0
- package/lib/dist/services/traces/index.js.map +1 -0
- package/lib/dist/services/traces/intentTransform.d.ts +20 -0
- package/lib/dist/services/traces/intentTransform.d.ts.map +1 -0
- package/lib/dist/services/traces/intentTransform.js +131 -0
- package/lib/dist/services/traces/intentTransform.js.map +1 -0
- package/lib/dist/services/traces/judgeAgentsHints.d.ts +63 -0
- package/lib/dist/services/traces/judgeAgentsHints.d.ts.map +1 -0
- package/lib/dist/services/traces/judgeAgentsHints.js +89 -0
- package/lib/dist/services/traces/judgeAgentsHints.js.map +1 -0
- package/lib/dist/services/traces/messageExtraction.d.ts +15 -0
- package/lib/dist/services/traces/messageExtraction.d.ts.map +1 -0
- package/lib/dist/services/traces/messageExtraction.js +251 -0
- package/lib/dist/services/traces/messageExtraction.js.map +1 -0
- package/lib/dist/services/traces/spanCategorization.d.ts +63 -0
- package/lib/dist/services/traces/spanCategorization.d.ts.map +1 -0
- package/lib/dist/services/traces/spanCategorization.js +276 -0
- package/lib/dist/services/traces/spanCategorization.js.map +1 -0
- package/lib/dist/services/traces/spanPreprocessing.d.ts +37 -0
- package/lib/dist/services/traces/spanPreprocessing.d.ts.map +1 -0
- package/lib/dist/services/traces/spanPreprocessing.js +102 -0
- package/lib/dist/services/traces/spanPreprocessing.js.map +1 -0
- package/lib/dist/services/traces/spansToTrajectory.d.ts +36 -0
- package/lib/dist/services/traces/spansToTrajectory.d.ts.map +1 -0
- package/lib/dist/services/traces/spansToTrajectory.js +387 -0
- package/lib/dist/services/traces/spansToTrajectory.js.map +1 -0
- package/lib/dist/services/traces/toolSimilarity.d.ts +35 -0
- package/lib/dist/services/traces/toolSimilarity.d.ts.map +1 -0
- package/lib/dist/services/traces/toolSimilarity.js +203 -0
- package/lib/dist/services/traces/toolSimilarity.js.map +1 -0
- package/lib/dist/services/traces/traceComparison.d.ts +31 -0
- package/lib/dist/services/traces/traceComparison.d.ts.map +1 -0
- package/lib/dist/services/traces/traceComparison.js +318 -0
- package/lib/dist/services/traces/traceComparison.js.map +1 -0
- package/lib/dist/services/traces/traceGrouping.d.ts +19 -0
- package/lib/dist/services/traces/traceGrouping.d.ts.map +1 -0
- package/lib/dist/services/traces/traceGrouping.js +107 -0
- package/lib/dist/services/traces/traceGrouping.js.map +1 -0
- package/lib/dist/services/traces/tracePoller.d.ts +84 -0
- package/lib/dist/services/traces/tracePoller.d.ts.map +1 -0
- package/lib/dist/services/traces/tracePoller.js +309 -0
- package/lib/dist/services/traces/tracePoller.js.map +1 -0
- package/lib/dist/services/traces/traceStats.d.ts +45 -0
- package/lib/dist/services/traces/traceStats.d.ts.map +1 -0
- package/lib/dist/services/traces/traceStats.js +114 -0
- package/lib/dist/services/traces/traceStats.js.map +1 -0
- package/lib/dist/services/traces/traceSummary.d.ts +47 -0
- package/lib/dist/services/traces/traceSummary.d.ts.map +1 -0
- package/lib/dist/services/traces/traceSummary.js +68 -0
- package/lib/dist/services/traces/traceSummary.js.map +1 -0
- package/lib/dist/services/traces/utils.d.ts +33 -0
- package/lib/dist/services/traces/utils.d.ts.map +1 -0
- package/lib/dist/services/traces/utils.js +114 -0
- package/lib/dist/services/traces/utils.js.map +1 -0
- package/lib/dist/types/agui.d.ts +13 -0
- package/lib/dist/types/agui.d.ts.map +1 -0
- package/lib/dist/types/agui.js +16 -0
- package/lib/dist/types/agui.js.map +1 -0
- package/lib/dist/types/index.d.ts +1175 -0
- package/lib/dist/types/index.d.ts.map +1 -0
- package/lib/dist/types/index.js +12 -0
- package/lib/dist/types/index.js.map +1 -0
- package/lib/dist/types/skills.d.ts +146 -0
- package/lib/dist/types/skills.d.ts.map +1 -0
- package/lib/dist/types/skills.js +6 -0
- package/lib/dist/types/skills.js.map +1 -0
- package/observio-sample-agent/pi-package/README.md +112 -0
- package/observio-sample-agent/pi-package/extensions/agent-health.ts +373 -0
- package/observio-sample-agent/pi-package/package.json +17 -0
- package/observio-sample-agent/pi-package/prompts/agent-health.md +37 -0
- package/observio-sample-agent/pi-package/skills/create-pr/SKILL.md +88 -0
- package/observio-sample-agent/pi-package/skills/fix-bug/SKILL.md +71 -0
- package/observio-sample-agent/pi-package/skills/implement-feature/SKILL.md +156 -0
- package/observio-sample-agent/pi-package/skills/instrument-otel/SKILL.md +208 -0
- package/observio-sample-agent/pi-package/skills/setup-collector/SKILL.md +146 -0
- package/observio-sample-agent/pi-package/skills/write-test/SKILL.md +115 -0
- package/package.json +64 -13
- package/server/dist/app.js +32651 -17637
- package/server/dist/index.js +29875 -14638
- package/tsconfig.lib.json +71 -0
- package/dist/assets/index-EvPLSTAS.js +0 -267
- package/dist/assets/index-RXasQKUs.css +0 -1
- package/lib/dist/config/index.js +0 -404
- package/lib/dist/index.js +0 -1665
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright OpenSearch Contributors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Agent Health extension for Pi.dev
|
|
8
|
+
*
|
|
9
|
+
* Provides tools for:
|
|
10
|
+
* 1. Validating OTel instrumentation against Gen AI semantic conventions
|
|
11
|
+
* 2. Checking project compliance (SPDX headers, DCO, changelog)
|
|
12
|
+
* 3. Running build/test validation
|
|
13
|
+
* 4. Finding relevant code in the Agent Health architecture
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
17
|
+
import { Type } from "typebox";
|
|
18
|
+
import { StringEnum } from "@earendil-works/pi-ai";
|
|
19
|
+
|
|
20
|
+
export default function (pi: ExtensionAPI) {
|
|
21
|
+
// --- Tool: validate-spans ---
|
|
22
|
+
pi.registerTool({
|
|
23
|
+
name: "validate_spans",
|
|
24
|
+
label: "Validate OTel Spans",
|
|
25
|
+
description:
|
|
26
|
+
"Checks if a codebase follows OpenTelemetry Gen AI semantic conventions for agent instrumentation. Scans for span attributes, naming, and hierarchy issues.",
|
|
27
|
+
promptSnippet: "Validate OTel span instrumentation against Gen AI conventions",
|
|
28
|
+
promptGuidelines: [
|
|
29
|
+
"Use validate_spans when the user asks if their instrumentation is correct",
|
|
30
|
+
"Use validate_spans after generating instrumentation code to verify it",
|
|
31
|
+
"Use validate_spans when debugging why traces don't appear in Agent Health",
|
|
32
|
+
],
|
|
33
|
+
parameters: Type.Object({
|
|
34
|
+
path: Type.String({ description: "Path to scan (file or directory)" }),
|
|
35
|
+
check: StringEnum([
|
|
36
|
+
"all",
|
|
37
|
+
"attributes",
|
|
38
|
+
"naming",
|
|
39
|
+
"hierarchy",
|
|
40
|
+
"events",
|
|
41
|
+
] as const),
|
|
42
|
+
}),
|
|
43
|
+
|
|
44
|
+
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
45
|
+
const { path, check } = params;
|
|
46
|
+
|
|
47
|
+
// Required Gen AI attributes per span type
|
|
48
|
+
const requirements = {
|
|
49
|
+
agent: [
|
|
50
|
+
"gen_ai.operation.name",
|
|
51
|
+
"gen_ai.system",
|
|
52
|
+
"gen_ai.agent.name",
|
|
53
|
+
],
|
|
54
|
+
llm: [
|
|
55
|
+
"gen_ai.operation.name",
|
|
56
|
+
"gen_ai.system",
|
|
57
|
+
"gen_ai.request.model",
|
|
58
|
+
"gen_ai.usage.input_tokens",
|
|
59
|
+
"gen_ai.usage.output_tokens",
|
|
60
|
+
],
|
|
61
|
+
tool: ["gen_ai.operation.name", "gen_ai.tool.name"],
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// Required span events
|
|
65
|
+
const requiredEvents = {
|
|
66
|
+
llm: ["gen_ai.content.prompt", "gen_ai.content.completion"],
|
|
67
|
+
tool: ["gen_ai.tool.input", "gen_ai.tool.output"],
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// Expected operation names
|
|
71
|
+
const validOps = ["invoke_agent", "chat", "execute_tool"];
|
|
72
|
+
|
|
73
|
+
// Expected span naming: "<operation> <system/tool>"
|
|
74
|
+
const namingPattern = /^(invoke_agent|chat|execute_tool)\s+\S+/;
|
|
75
|
+
|
|
76
|
+
const report = {
|
|
77
|
+
path,
|
|
78
|
+
check,
|
|
79
|
+
requirements,
|
|
80
|
+
requiredEvents,
|
|
81
|
+
validOps,
|
|
82
|
+
namingPattern: namingPattern.source,
|
|
83
|
+
instructions: [
|
|
84
|
+
`Scan files at '${path}' for OpenTelemetry span creation calls`,
|
|
85
|
+
"Check startSpan() calls for required attributes based on span type",
|
|
86
|
+
"Verify span names follow '<operation> <system>' pattern",
|
|
87
|
+
"Check for addEvent() calls with required event names",
|
|
88
|
+
"Verify parent-child hierarchy: agent → llm/tool spans",
|
|
89
|
+
"Report any missing attributes, bad naming, or hierarchy issues",
|
|
90
|
+
],
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
content: [
|
|
95
|
+
{
|
|
96
|
+
type: "text",
|
|
97
|
+
text: JSON.stringify(report, null, 2),
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// --- Tool: check-compliance ---
|
|
105
|
+
pi.registerTool({
|
|
106
|
+
name: "check_compliance",
|
|
107
|
+
label: "Check PR Compliance",
|
|
108
|
+
description:
|
|
109
|
+
"Validates Agent Health project compliance: SPDX license headers, DCO signoff, CHANGELOG entries, and build status.",
|
|
110
|
+
promptSnippet: "Check PR compliance (SPDX, DCO, changelog, build)",
|
|
111
|
+
promptGuidelines: [
|
|
112
|
+
"Use check_compliance before creating a PR to catch issues early",
|
|
113
|
+
"Use check_compliance when the user asks about PR requirements",
|
|
114
|
+
],
|
|
115
|
+
parameters: Type.Object({
|
|
116
|
+
check: StringEnum([
|
|
117
|
+
"all",
|
|
118
|
+
"spdx",
|
|
119
|
+
"dco",
|
|
120
|
+
"changelog",
|
|
121
|
+
"build",
|
|
122
|
+
] as const),
|
|
123
|
+
}),
|
|
124
|
+
|
|
125
|
+
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
126
|
+
const checks: Record<string, object> = {};
|
|
127
|
+
|
|
128
|
+
if (params.check === "all" || params.check === "spdx") {
|
|
129
|
+
checks.spdx = {
|
|
130
|
+
description: "All source files need SPDX Apache-2.0 header",
|
|
131
|
+
header:
|
|
132
|
+
"/* Copyright OpenSearch Contributors\n SPDX-License-Identifier: Apache-2.0 */",
|
|
133
|
+
check: "grep -rL 'SPDX-License-Identifier' src/ --include='*.ts'",
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (params.check === "all" || params.check === "dco") {
|
|
138
|
+
checks.dco = {
|
|
139
|
+
description: "All commits need DCO signoff",
|
|
140
|
+
check: "git log --no-merges --format='%H %s' | head -5",
|
|
141
|
+
fix: "git commit -s -m 'message'",
|
|
142
|
+
note: "Use -s flag, never --no-verify",
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (params.check === "all" || params.check === "changelog") {
|
|
147
|
+
checks.changelog = {
|
|
148
|
+
description: "CHANGELOG.md must be updated for PRs",
|
|
149
|
+
check: "git diff main -- CHANGELOG.md",
|
|
150
|
+
format: "- Description of change ([#PR](link)) by @author",
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (params.check === "all" || params.check === "build") {
|
|
155
|
+
checks.build = {
|
|
156
|
+
description: "Build and all tests must pass",
|
|
157
|
+
command: "npm run build:all && npm run test:all",
|
|
158
|
+
note: "Never use --no-verify to skip hooks",
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
content: [
|
|
164
|
+
{
|
|
165
|
+
type: "text",
|
|
166
|
+
text: JSON.stringify(checks, null, 2),
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
};
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
// --- Tool: find-architecture ---
|
|
174
|
+
pi.registerTool({
|
|
175
|
+
name: "find_architecture",
|
|
176
|
+
label: "Find Relevant Code",
|
|
177
|
+
description:
|
|
178
|
+
"Routes a query to the correct layer in Agent Health's architecture. Knows where services, routes, storage, CLI commands, types, and UI components live.",
|
|
179
|
+
promptSnippet: "Find relevant code in Agent Health's architecture",
|
|
180
|
+
promptGuidelines: [
|
|
181
|
+
"Use find_architecture when implementing a feature to find the right files",
|
|
182
|
+
"Use find_architecture when the user asks where something is implemented",
|
|
183
|
+
],
|
|
184
|
+
parameters: Type.Object({
|
|
185
|
+
area: StringEnum([
|
|
186
|
+
"agent-streaming",
|
|
187
|
+
"evaluation",
|
|
188
|
+
"storage",
|
|
189
|
+
"traces",
|
|
190
|
+
"cli",
|
|
191
|
+
"routes",
|
|
192
|
+
"types",
|
|
193
|
+
"config",
|
|
194
|
+
"ui-components",
|
|
195
|
+
"connectors",
|
|
196
|
+
] as const),
|
|
197
|
+
query: Type.Optional(
|
|
198
|
+
Type.String({ description: "What specifically to find" })
|
|
199
|
+
),
|
|
200
|
+
}),
|
|
201
|
+
|
|
202
|
+
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
203
|
+
const map: Record<string, object> = {
|
|
204
|
+
"agent-streaming": {
|
|
205
|
+
dir: "services/agent/",
|
|
206
|
+
key_files: ["sseHandler.ts", "agUiConverter.ts"],
|
|
207
|
+
patterns: ["SSE streaming", "AG-UI protocol", "event-stream headers"],
|
|
208
|
+
},
|
|
209
|
+
evaluation: {
|
|
210
|
+
dir: "services/evaluation/",
|
|
211
|
+
routes: "server/routes/judge.ts",
|
|
212
|
+
key_files: ["judge.ts", "mockEvaluator.ts"],
|
|
213
|
+
patterns: ["Bedrock judge", "passFailStatus", "accuracy"],
|
|
214
|
+
},
|
|
215
|
+
storage: {
|
|
216
|
+
dir: "services/storage/",
|
|
217
|
+
adapter: "server/adapters/opensearch/StorageModule.ts",
|
|
218
|
+
key_files: [
|
|
219
|
+
"asyncTestCaseStorage.ts",
|
|
220
|
+
"asyncBenchmarkStorage.ts",
|
|
221
|
+
"asyncRunStorage.ts",
|
|
222
|
+
],
|
|
223
|
+
patterns: [
|
|
224
|
+
"toAppFormat/toStorageFormat",
|
|
225
|
+
"CRUD wrappers",
|
|
226
|
+
"OpenSearch client",
|
|
227
|
+
],
|
|
228
|
+
},
|
|
229
|
+
traces: {
|
|
230
|
+
dir: "services/traces/",
|
|
231
|
+
key_files: [
|
|
232
|
+
"spanCategorization.ts",
|
|
233
|
+
"metrics.ts",
|
|
234
|
+
"tracePoller.ts",
|
|
235
|
+
],
|
|
236
|
+
patterns: [
|
|
237
|
+
"Gen AI semantic conventions",
|
|
238
|
+
"token/cost calculation",
|
|
239
|
+
"background polling",
|
|
240
|
+
],
|
|
241
|
+
},
|
|
242
|
+
cli: {
|
|
243
|
+
dir: "cli/",
|
|
244
|
+
key_files: [
|
|
245
|
+
"commands/run.ts",
|
|
246
|
+
"commands/benchmark.ts",
|
|
247
|
+
"commands/export.ts",
|
|
248
|
+
"utils/serverLifecycle.ts",
|
|
249
|
+
"utils/apiClient.ts",
|
|
250
|
+
],
|
|
251
|
+
patterns: [
|
|
252
|
+
"ensureServer()",
|
|
253
|
+
"server auto-start",
|
|
254
|
+
"typed HTTP client",
|
|
255
|
+
],
|
|
256
|
+
},
|
|
257
|
+
routes: {
|
|
258
|
+
dir: "server/routes/",
|
|
259
|
+
patterns: [
|
|
260
|
+
"validateX(): string | null",
|
|
261
|
+
"return 400 with { error }",
|
|
262
|
+
"early return for 404",
|
|
263
|
+
],
|
|
264
|
+
},
|
|
265
|
+
types: {
|
|
266
|
+
file: "types/index.ts",
|
|
267
|
+
key_types: [
|
|
268
|
+
"TestCase",
|
|
269
|
+
"BenchmarkRun",
|
|
270
|
+
"TrajectoryStep",
|
|
271
|
+
"AgentConfig",
|
|
272
|
+
],
|
|
273
|
+
patterns: [
|
|
274
|
+
"string unions not enums",
|
|
275
|
+
"discriminated unions with type field",
|
|
276
|
+
],
|
|
277
|
+
},
|
|
278
|
+
config: {
|
|
279
|
+
dir: "lib/",
|
|
280
|
+
key_files: [
|
|
281
|
+
"config/loader.ts",
|
|
282
|
+
"config/types.ts",
|
|
283
|
+
"constants.ts",
|
|
284
|
+
"hooks.ts",
|
|
285
|
+
],
|
|
286
|
+
patterns: [
|
|
287
|
+
"agent-health.config.ts",
|
|
288
|
+
"UserAgentConfig",
|
|
289
|
+
"beforeRequest hook",
|
|
290
|
+
],
|
|
291
|
+
},
|
|
292
|
+
"ui-components": {
|
|
293
|
+
dir: "components/",
|
|
294
|
+
patterns: ["shadcn/ui", "React hooks in hooks/"],
|
|
295
|
+
},
|
|
296
|
+
connectors: {
|
|
297
|
+
dir: "services/connectors/",
|
|
298
|
+
patterns: [
|
|
299
|
+
"ConnectorType",
|
|
300
|
+
"agui-streaming",
|
|
301
|
+
"custom connector template",
|
|
302
|
+
],
|
|
303
|
+
skill: "/add-connector for full guide",
|
|
304
|
+
},
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
const result = map[params.area] || { error: "Unknown area" };
|
|
308
|
+
|
|
309
|
+
return {
|
|
310
|
+
content: [
|
|
311
|
+
{
|
|
312
|
+
type: "text",
|
|
313
|
+
text: JSON.stringify(
|
|
314
|
+
{ area: params.area, query: params.query, ...result },
|
|
315
|
+
null,
|
|
316
|
+
2
|
|
317
|
+
),
|
|
318
|
+
},
|
|
319
|
+
],
|
|
320
|
+
};
|
|
321
|
+
},
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
// --- Tool: run-validation ---
|
|
325
|
+
pi.registerTool({
|
|
326
|
+
name: "run_validation",
|
|
327
|
+
label: "Run Build & Tests",
|
|
328
|
+
description:
|
|
329
|
+
"Runs the Agent Health build and test suite. Use before creating PRs.",
|
|
330
|
+
promptSnippet: "Run npm build:all && test:all for Agent Health",
|
|
331
|
+
promptGuidelines: [
|
|
332
|
+
"Use run_validation after implementing changes to verify nothing is broken",
|
|
333
|
+
"Use run_validation before creating a PR",
|
|
334
|
+
],
|
|
335
|
+
parameters: Type.Object({
|
|
336
|
+
scope: StringEnum([
|
|
337
|
+
"all",
|
|
338
|
+
"build",
|
|
339
|
+
"unit",
|
|
340
|
+
"integration",
|
|
341
|
+
"e2e",
|
|
342
|
+
] as const),
|
|
343
|
+
}),
|
|
344
|
+
|
|
345
|
+
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
346
|
+
const commands: Record<string, string> = {
|
|
347
|
+
all: "npm run build:all && npm run test:all",
|
|
348
|
+
build: "npm run build:all",
|
|
349
|
+
unit: "npm run test:unit",
|
|
350
|
+
integration: "npm run test:integration",
|
|
351
|
+
e2e: "npm run test:e2e",
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
return {
|
|
355
|
+
content: [
|
|
356
|
+
{
|
|
357
|
+
type: "text",
|
|
358
|
+
text: JSON.stringify({
|
|
359
|
+
command: commands[params.scope],
|
|
360
|
+
note: "Run this in the agent-health project root",
|
|
361
|
+
coverage_thresholds: {
|
|
362
|
+
lines: "90%",
|
|
363
|
+
statements: "90%",
|
|
364
|
+
functions: "80%",
|
|
365
|
+
branches: "80%",
|
|
366
|
+
},
|
|
367
|
+
}),
|
|
368
|
+
},
|
|
369
|
+
],
|
|
370
|
+
};
|
|
371
|
+
},
|
|
372
|
+
});
|
|
373
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opensearch-project/agent-health-pi",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Pi.dev coding agent for Agent Health — helps instrument agents with OTel and contribute to the project",
|
|
5
|
+
"keywords": ["pi-package"],
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"pi": {
|
|
8
|
+
"extensions": ["./extensions"],
|
|
9
|
+
"skills": ["./skills"],
|
|
10
|
+
"prompts": ["./prompts"]
|
|
11
|
+
},
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"@earendil-works/pi-ai": "*",
|
|
14
|
+
"@earendil-works/pi-agent-core": "*",
|
|
15
|
+
"@earendil-works/pi-coding-agent": "*"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Agent Health Coding Assistant
|
|
2
|
+
|
|
3
|
+
You are a specialized coding agent for the **Agent Health** project — an evaluation and observability framework for AI agents built on OpenSearch.
|
|
4
|
+
|
|
5
|
+
## Your Two Modes
|
|
6
|
+
|
|
7
|
+
### 1. DIY Observability (for customers with their own agents)
|
|
8
|
+
Help users instrument their AI agents with OpenTelemetry so traces flow into Agent Health. You know:
|
|
9
|
+
- Gen AI semantic conventions (`gen_ai.operation.name`, `gen_ai.system`, etc.)
|
|
10
|
+
- How Agent Health categorizes spans (AGENT/LLM/TOOL/FRAMEWORK)
|
|
11
|
+
- OTLP export setup (OSIS pipelines, OTel Collector, direct)
|
|
12
|
+
- How to verify traces appear correctly
|
|
13
|
+
|
|
14
|
+
Use skills: `/instrument-otel`, `/setup-collector`
|
|
15
|
+
|
|
16
|
+
### 2. Contributor Mode (implementing features and fixes)
|
|
17
|
+
Help anyone contribute to Agent Health itself. You know:
|
|
18
|
+
- The architecture: server-mediated CLI, service layers, storage adapters
|
|
19
|
+
- Coding conventions: SSE streaming, cancellation tokens, route validation, `@/` imports
|
|
20
|
+
- PR requirements: SPDX headers, DCO signoff, CHANGELOG, test coverage
|
|
21
|
+
|
|
22
|
+
Use skills: `/implement-feature`, `/fix-bug`, `/create-pr`, `/write-test`
|
|
23
|
+
|
|
24
|
+
## Key Principles
|
|
25
|
+
|
|
26
|
+
- **Read before writing.** Always examine existing code in the relevant directory before implementing.
|
|
27
|
+
- **Minimal changes.** Fix what's asked, don't refactor the neighborhood.
|
|
28
|
+
- **Architecture-aware.** Route work to the correct layer. CLI calls server, server calls storage. Never bypass.
|
|
29
|
+
- **Test everything.** 90% line coverage, `@/` imports, mock at boundaries only.
|
|
30
|
+
- **Compliance always.** SPDX headers, DCO signoff, CHANGELOG updates. Never skip hooks.
|
|
31
|
+
|
|
32
|
+
## Tools Available
|
|
33
|
+
|
|
34
|
+
- `validate_spans` — Check OTel instrumentation correctness
|
|
35
|
+
- `check_compliance` — Verify PR readiness (SPDX, DCO, changelog, build)
|
|
36
|
+
- `find_architecture` — Route queries to the right code layer
|
|
37
|
+
- `run_validation` — Run build and test suite
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: create-pr
|
|
3
|
+
description: >
|
|
4
|
+
Create a pull request for Agent Health following all compliance requirements.
|
|
5
|
+
Use after implementing a feature or fix. Handles SPDX headers, DCO signoff,
|
|
6
|
+
CHANGELOG, and the PR template.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Create Pull Request for Agent Health
|
|
10
|
+
|
|
11
|
+
You are helping the user create a compliant PR for the Agent Health project.
|
|
12
|
+
|
|
13
|
+
## Pre-flight Checks
|
|
14
|
+
|
|
15
|
+
Run these before creating the PR:
|
|
16
|
+
|
|
17
|
+
### 1. Build & Tests
|
|
18
|
+
```bash
|
|
19
|
+
npm run build:all && npm run test:all
|
|
20
|
+
```
|
|
21
|
+
Must pass. Never use `--no-verify`.
|
|
22
|
+
|
|
23
|
+
### 2. SPDX License Headers
|
|
24
|
+
Every new `.ts`, `.tsx`, `.js` source file needs:
|
|
25
|
+
```
|
|
26
|
+
/* Copyright OpenSearch Contributors
|
|
27
|
+
SPDX-License-Identifier: Apache-2.0 */
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Check for missing headers:
|
|
31
|
+
```bash
|
|
32
|
+
grep -rL 'SPDX-License-Identifier' src/ cli/ server/ services/ --include='*.ts' --include='*.tsx'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 3. DCO Signoff
|
|
36
|
+
Every commit needs `Signed-off-by:` line:
|
|
37
|
+
```bash
|
|
38
|
+
git log --format='%H %s' origin/main..HEAD | while read hash msg; do
|
|
39
|
+
git log -1 --format='%b' $hash | grep -q 'Signed-off-by:' || echo "MISSING: $hash $msg"
|
|
40
|
+
done
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Fix missing signoff (for last commit):
|
|
44
|
+
```bash
|
|
45
|
+
git commit --amend -s --no-edit
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 4. CHANGELOG.md
|
|
49
|
+
Add entry under `## [Unreleased]` in the appropriate section:
|
|
50
|
+
- `### Added` — new features
|
|
51
|
+
- `### Fixed` — bug fixes
|
|
52
|
+
- `### Changed` — modifications to existing features
|
|
53
|
+
- `### Removed` — removed features
|
|
54
|
+
|
|
55
|
+
Format: `- Description of change ([#PR](link))`
|
|
56
|
+
|
|
57
|
+
## Create the PR
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
gh pr create --title "<type>: <concise description>" --body "$(cat <<'EOF'
|
|
61
|
+
## Summary
|
|
62
|
+
- <bullet 1>
|
|
63
|
+
- <bullet 2>
|
|
64
|
+
|
|
65
|
+
## Test plan
|
|
66
|
+
- [ ] Unit tests added/updated
|
|
67
|
+
- [ ] `npm run build:all && npm run test:all` passes
|
|
68
|
+
- [ ] Manual verification: <describe what to check>
|
|
69
|
+
|
|
70
|
+
EOF
|
|
71
|
+
)"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Title Conventions
|
|
75
|
+
- `feat:` — new feature
|
|
76
|
+
- `fix:` — bug fix
|
|
77
|
+
- `refactor:` — code restructuring (no behavior change)
|
|
78
|
+
- `docs:` — documentation only
|
|
79
|
+
- `test:` — test additions/changes
|
|
80
|
+
- `chore:` — maintenance tasks
|
|
81
|
+
|
|
82
|
+
Keep title under 70 characters.
|
|
83
|
+
|
|
84
|
+
## After PR Creation
|
|
85
|
+
|
|
86
|
+
- CI will run: tests, coverage, DCO check, changelog check, link checker
|
|
87
|
+
- Address review feedback with new commits (don't force-push unless asked)
|
|
88
|
+
- Ensure all CI checks pass before requesting re-review
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fix-bug
|
|
3
|
+
description: >
|
|
4
|
+
Diagnose and fix bugs in Agent Health. Use when a user reports a bug, failing test,
|
|
5
|
+
or unexpected behavior. Follows a systematic diagnosis → fix → verify workflow.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Fix Bug in Agent Health
|
|
9
|
+
|
|
10
|
+
You are helping the user diagnose and fix a bug in Agent Health.
|
|
11
|
+
|
|
12
|
+
## Step 1: Reproduce & Locate
|
|
13
|
+
|
|
14
|
+
1. **Understand the symptom**: What's the expected vs actual behavior?
|
|
15
|
+
2. **Identify the layer**: Use `find_architecture` tool to narrow down where the bug likely lives
|
|
16
|
+
3. **Find the code path**: Trace from the trigger (UI action, CLI command, API call) through the layers
|
|
17
|
+
|
|
18
|
+
### Common Bug Locations by Symptom
|
|
19
|
+
|
|
20
|
+
| Symptom | Likely Location |
|
|
21
|
+
|---------|----------------|
|
|
22
|
+
| Traces not appearing | `services/traces/tracePoller.ts`, `spanCategorization.ts` |
|
|
23
|
+
| Wrong token/cost metrics | `services/traces/metrics.ts` |
|
|
24
|
+
| Storage errors | `services/storage/async*Storage.ts`, `server/adapters/` |
|
|
25
|
+
| CLI command fails | `cli/commands/`, `cli/utils/apiClient.ts` |
|
|
26
|
+
| SSE stream drops | `services/agent/sseHandler.ts`, response flushing |
|
|
27
|
+
| Evaluation incorrect | `server/routes/judge.ts`, prompt templates |
|
|
28
|
+
| UI not updating | `hooks/`, `services/client/` |
|
|
29
|
+
| Agent connector fails | `services/connectors/`, connector-specific adapter |
|
|
30
|
+
|
|
31
|
+
## Step 2: Diagnose
|
|
32
|
+
|
|
33
|
+
Read the relevant code. Look for:
|
|
34
|
+
- Off-by-one errors in iteration/pagination
|
|
35
|
+
- Missing null checks at system boundaries (API responses, storage queries)
|
|
36
|
+
- Race conditions in async flows (SSE, polling, cancellation)
|
|
37
|
+
- Type mismatches between storage format and app format
|
|
38
|
+
- Incorrect OpenSearch query construction
|
|
39
|
+
|
|
40
|
+
**Do NOT guess.** Read the code, understand the flow, then identify the root cause.
|
|
41
|
+
|
|
42
|
+
## Step 3: Fix
|
|
43
|
+
|
|
44
|
+
Apply the minimal fix:
|
|
45
|
+
- Fix the actual bug, don't refactor surrounding code
|
|
46
|
+
- Don't add defensive error handling for scenarios that can't happen
|
|
47
|
+
- Don't add comments explaining the fix (the commit message does that)
|
|
48
|
+
- If the fix touches a type, check all usages of that type
|
|
49
|
+
|
|
50
|
+
## Step 4: Write a Regression Test
|
|
51
|
+
|
|
52
|
+
Every bug fix should have a test that would have caught it:
|
|
53
|
+
- Test the specific scenario that was broken
|
|
54
|
+
- Use `@/` path alias
|
|
55
|
+
- Place in `tests/` mirroring the source path
|
|
56
|
+
|
|
57
|
+
## Step 5: Verify
|
|
58
|
+
|
|
59
|
+
1. Run `run_validation` tool (scope: "all")
|
|
60
|
+
2. Manually verify the original symptom is resolved
|
|
61
|
+
3. Check that no other tests broke (the fix didn't introduce regressions)
|
|
62
|
+
|
|
63
|
+
## Step 6: Commit & PR
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
git commit -s -m "fix: <concise description of what was wrong>
|
|
67
|
+
|
|
68
|
+
<one line explaining root cause>"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Update CHANGELOG.md under the appropriate section.
|