@polymorphism-tech/morph-spec 8.37.1 → 8.40.0
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/CLAUDE.md +37 -13
- package/README.md +2 -2
- package/bin/morph-spec.js +75 -49
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/CLAUDE.md +6 -5
- package/framework/MORPH.md +25 -22
- package/framework/agents.json +96 -36
- package/framework/docs/CLI.md +54 -17
- package/framework/evals/rubrics/code-quality.md +5 -0
- package/framework/evals/rubrics/condensed.md +6 -2
- package/framework/evals/rubrics/contracts.md +20 -0
- package/framework/evals/rubrics/test-coverage.md +17 -6
- package/framework/hooks/README.md +9 -3
- package/framework/hooks/claude-code/core/graph-refresh-kick.js +52 -0
- package/framework/hooks/claude-code/core/telemetry-log.js +172 -87
- package/framework/hooks/claude-code/core/validate-completion.js +16 -90
- package/framework/hooks/claude-code/core/worktree-context.js +10 -0
- package/framework/hooks/shared/command-tokens.js +96 -0
- package/framework/hooks/shared/git-exclude.js +44 -0
- package/framework/hooks/shared/git-paths.js +52 -0
- package/framework/hooks/shared/graph-freshness.js +380 -0
- package/framework/hooks/shared/graph-refresh.js +416 -0
- package/framework/hooks/shared/morph-cli.js +17 -5
- package/framework/hooks/shared/redact-secrets.js +55 -0
- package/framework/hooks/shared/telemetry-logger.js +25 -2
- package/framework/hooks/shared/transcript-usage.js +80 -0
- package/framework/mcp/registry.json +33 -2
- package/framework/rubrics/backend.json +2 -2
- package/framework/rubrics/default.json +2 -2
- package/framework/rubrics/frontend.json +2 -2
- package/framework/rules/csharp-standards.md +1 -0
- package/framework/rules/infrastructure-standards.md +0 -1
- package/framework/rules/morph-workflow.md +10 -4
- package/framework/rules/nextjs-standards.md +1 -0
- package/framework/schemas/config.schema.json +41 -1
- package/framework/schemas/feature.schema.json +5 -1
- package/framework/skills/core/create-umbraco-lp/SKILL.md +1 -1
- package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +1 -1
- package/framework/skills/core/morph-apply/SKILL.md +40 -11
- package/framework/skills/core/morph-brainstorming/SKILL.md +16 -7
- package/framework/skills/core/morph-eval/SKILL.md +1 -1
- package/framework/skills/core/morph-hotfix/SKILL.md +1 -1
- package/framework/skills/core/morph-implement/SKILL.md +44 -10
- package/framework/skills/core/morph-media/SKILL.md +1 -1
- package/framework/skills/core/morph-plan/SKILL.md +73 -15
- package/framework/skills/core/morph-proposal/SKILL.md +1 -1
- package/framework/skills/core/morph-review/SKILL.md +51 -13
- package/framework/skills/core/morph-stack-scan/SKILL.md +1 -1
- package/framework/skills/core/morph-standards/SKILL.md +1 -1
- package/framework/skills/core/morph-uiux/SKILL.md +39 -13
- package/framework/standards/STANDARDS.json +189 -14
- package/framework/standards/ai-agents/context-providers.md +16 -26
- package/framework/standards/ai-agents/durable-workflows-hitl.md +15 -21
- package/framework/standards/ai-agents/modalities-image-gen.md +21 -25
- package/framework/standards/ai-agents/modalities-speech-to-text.md +4 -15
- package/framework/standards/ai-agents/modalities-text-to-speech.md +2 -11
- package/framework/standards/ai-agents/modalities-vision.md +1 -18
- package/framework/standards/ai-agents/prompt-sources.md +0 -4
- package/framework/standards/ai-agents/testing-ai.md +2 -1
- package/framework/standards/architecture/code-comments.md +100 -0
- package/framework/standards/backend/dotnet/testing.md +22 -0
- package/framework/standards/backend/integrations/neon-auth/neon-auth.md +63 -50
- package/framework/standards/frontend/admin-app/data-table.md +562 -0
- package/framework/standards/frontend/admin-app/feedback.md +236 -0
- package/framework/standards/frontend/admin-app/forms.md +232 -0
- package/framework/standards/frontend/admin-app/page-structure.md +203 -0
- package/framework/standards/frontend/design-system/ai-image-generation.md +5 -5
- package/framework/standards/frontend/nextjs/components.md +37 -58
- package/framework/standards/frontend/nextjs/data-fetching.md +1 -0
- package/framework/standards/frontend/nextjs/forms.md +31 -30
- package/framework/standards/frontend/nextjs/state-management.md +2 -1
- package/framework/standards/frontend/nextjs/testing.md +18 -0
- package/framework/standards/integration/mcp/mcp-tools.md +48 -117
- package/framework/templates/code/dotnet/abstractions/result.cs +0 -2
- package/framework/templates/code/dotnet/ai-agents/AgentBootstrap.cs.template +26 -39
- package/framework/templates/code/dotnet/ai-agents/EmbeddingService.cs.template +28 -68
- package/framework/templates/code/dotnet/ai-agents/ModelRegistry.cs.template +99 -117
- package/framework/templates/code/dotnet/ai-agents/PromptRepository.cs.template +2 -44
- package/framework/templates/code/dotnet/ai-agents/ResilientToolMiddleware.cs.template +40 -61
- package/framework/templates/code/dotnet/ai-agents/VectorSearchTool.cs.template +54 -107
- package/framework/templates/code/dotnet/ai-agents/model-registry.json.template +53 -58
- package/framework/templates/code/dotnet/contracts/contracts-vsa.cs +192 -281
- package/framework/templates/code/dotnet/database/migration.cs +49 -83
- package/framework/templates/code/dotnet/database/vector-entity.cs +2 -46
- package/framework/templates/code/dotnet/extensions/result-extensions.cs +0 -2
- package/framework/templates/code/dotnet/feature/validator.cs.hbs +11 -15
- package/framework/templates/code/dotnet/jobs/agent.cs +3 -51
- package/framework/templates/code/dotnet/jobs/job.cs +2 -97
- package/framework/templates/code/dotnet/test.cs +2 -87
- package/framework/templates/code/typescript/contracts.ts +140 -167
- package/framework/templates/context/design-system.md +3 -3
- package/framework/templates/docs/proposal.md +11 -0
- package/framework/templates/docs/spec.md +15 -0
- package/framework/templates/docs/ui-mockups.md +115 -98
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Agents/AgentApi.cs +1 -48
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Agents/AgentFactory.cs +3 -79
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Agents/AgentFactoryOptions.cs +1 -70
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Agents/AgentSpec.cs +1 -47
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Agents/AgentSpecOptions.cs +2 -99
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/AiKitAssemblyMarker.cs +0 -6
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Conversation/ConversationStore.cs +3 -88
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Conversation/IConversationStore.cs +1 -41
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Conversation/InMemoryConversationStore.cs +0 -21
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/CountingChatClient.cs +1 -25
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalAssertion.cs +2 -63
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalCacheMissException.cs +0 -30
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalCacheOptions.cs +1 -52
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalCacheStamp.cs +3 -78
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalFixture.cs +4 -109
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalMode.cs +0 -22
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalQualityEvaluators.cs +1 -36
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalScenario.cs +2 -57
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalSummary.cs +0 -75
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/OfflineChatClient.cs +2 -59
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/ShortPathResponseCache.cs +4 -111
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/IMediaGenerator.cs +0 -34
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/IMediaProvider.cs +1 -57
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaArtifact.cs +0 -19
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaDisclosure.cs +2 -74
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaGenerator.cs +2 -33
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaIdempotencyKey.cs +1 -43
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaJob.cs +1 -96
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaJobId.cs +0 -13
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaJobState.cs +0 -27
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaPricing.cs +0 -33
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaProvenance.cs +0 -31
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaRequest.cs +3 -75
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaResult.cs +0 -42
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaReview.cs +0 -39
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaSeams.cs +1 -55
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaStore.cs +3 -59
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MorphMedia.cs +0 -46
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/Providers/GoogleImageProvider.cs +3 -28
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/Providers/OpenAIImageProvider.cs +7 -61
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/Providers/VeoVideoProvider.cs +2 -37
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Middleware/IUsageCostSink.cs +1 -23
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Middleware/UsageCostMiddleware.cs +2 -82
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Middleware/UsageCostRecord.cs +1 -68
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Observability/MorphOpenTelemetryExtensions.cs +1 -62
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Observability/MorphTelemetryOptions.cs +2 -62
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Providers/IProviderClientFactory.cs +1 -25
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Providers/ModelAlias.cs +0 -124
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Providers/ModelRegistry.cs +1 -73
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Rag/DeltaIngest.cs +1 -66
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Rag/DeltaPlan.cs +0 -41
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/AgentFactoryTests.cs +2 -112
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/AgentSpecTests.cs +2 -43
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/ConversationStoreTests.cs +5 -110
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/DeltaIngestTests.cs +7 -103
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalAssertionTests.cs +1 -42
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalCacheMissTests.cs +1 -30
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalCacheStampTests.cs +1 -19
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalFailuresTests.cs +0 -48
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalFixtureTests.cs +1 -29
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalRefreshTests.cs +2 -38
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalWorkspace.cs +1 -14
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/KitEvals.cs +4 -69
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/OfflineChatClientTests.cs +1 -10
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeChatClient.cs +1 -57
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeChatClientTests.cs +0 -26
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeClock.cs +1 -19
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeMediaProvider.cs +0 -32
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeProviderClientFactory.cs +0 -14
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeUsageCostSink.cs +0 -24
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/InMemoryMediaStore.cs +0 -32
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaAccessibilityTests.cs +0 -37
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaAliasIsNotAnAgentTests.cs +0 -24
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaDisclosureTests.cs +0 -78
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaGeneratorTests.cs +0 -53
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaIdempotencyKeyTests.cs +0 -44
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaJobStateTests.cs +0 -44
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaReviewTests.cs +0 -19
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaStoreTests.cs +0 -24
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/ModelRegistryTests.cs +6 -48
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/SkeletonSmokeTests.cs +1 -13
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/TelemetryTests.cs +2 -71
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/UsageCostMiddlewareTests.cs +5 -100
- package/framework/templates/feature/decisions.md +124 -122
- package/framework/templates/frontend/nextjs/Dockerfile.nextjs.hbs +39 -43
- package/framework/templates/frontend/nextjs/env.mjs.hbs +29 -32
- package/framework/templates/frontend/nextjs/page.tsx.hbs +21 -22
- package/framework/templates/frontend/nextjs/use-feature.ts.hbs +42 -54
- package/framework/templates/integrations/asaas-client.cs +332 -387
- package/framework/templates/integrations/asaas-webhook.cs +290 -351
- package/framework/templates/integrations/neon-auth-config.cs +9 -105
- package/framework/templates/project/validate.js +97 -120
- package/package.json +2 -2
- package/src/commands/dashboard/dashboard.js +80 -53
- package/src/commands/graph/affected.js +4 -3
- package/src/commands/graph/build.js +109 -18
- package/src/commands/graph/explain.js +8 -5
- package/src/commands/graph/status.js +14 -8
- package/src/commands/mcp/mcp-setup.js +37 -9
- package/src/commands/observability/cost.js +148 -18
- package/src/commands/project/doctor.js +85 -15
- package/src/commands/project/init.js +6 -3
- package/src/commands/project/install-plugin-cmd.js +1 -1
- package/src/commands/project/update.js +30 -0
- package/src/commands/project/worktree.js +73 -90
- package/src/commands/state/advance.js +18 -0
- package/src/commands/state/approve.js +15 -0
- package/src/commands/state/archive.js +62 -9
- package/src/commands/state/finish.js +62 -14
- package/src/commands/state/gate-check.js +8 -1
- package/src/commands/state/gate-decision.js +8 -4
- package/src/commands/state/report-check.js +90 -9
- package/src/commands/state/usecase.js +66 -0
- package/src/commands/tasks/dag.js +17 -2
- package/src/commands/validation/validate-feature.js +6 -1
- package/src/commands/validation/verify.js +20 -1
- package/src/dashboard/app/App.jsx +80 -16
- package/src/dashboard/app/components/ActivityFeed.jsx +172 -0
- package/src/dashboard/app/components/CommandPalette.jsx +155 -0
- package/src/dashboard/app/components/DetailPanel.jsx +47 -11
- package/src/dashboard/app/components/EntityLink.jsx +55 -0
- package/src/dashboard/app/components/ErrorBoundary.jsx +54 -0
- package/src/dashboard/app/components/FlowGraph.jsx +19 -17
- package/src/dashboard/app/components/KnowledgeMarkdown.jsx +53 -0
- package/src/dashboard/app/components/Markdown.jsx +47 -0
- package/src/dashboard/app/components/PhaseRail.jsx +111 -0
- package/src/dashboard/app/components/SearchFilter.jsx +40 -22
- package/src/dashboard/app/components/Sidebar.jsx +146 -37
- package/src/dashboard/app/hooks/useMorphQuery.js +54 -0
- package/src/dashboard/app/hooks/usePref.js +38 -0
- package/src/dashboard/app/lib/format.js +69 -0
- package/src/dashboard/app/lib/phases.js +56 -0
- package/src/dashboard/app/lib/project.js +50 -0
- package/src/dashboard/app/pages/Activity.jsx +24 -0
- package/src/dashboard/app/pages/AgentMap.jsx +371 -370
- package/src/dashboard/app/pages/FeatureDetail.jsx +604 -0
- package/src/dashboard/app/pages/Features.jsx +400 -0
- package/src/dashboard/app/pages/Guide.jsx +146 -0
- package/src/dashboard/app/pages/HookInspector.jsx +357 -322
- package/src/dashboard/app/pages/PhasePipeline.jsx +277 -408
- package/src/dashboard/app/pages/Portfolio.jsx +156 -0
- package/src/dashboard/app/pages/Rubrics.jsx +101 -0
- package/src/dashboard/app/pages/RulesMap.jsx +300 -273
- package/src/dashboard/app/pages/SkillsLibrary.jsx +483 -366
- package/src/dashboard/app/pages/Standards.jsx +407 -332
- package/src/dashboard/app/styles/index.css +187 -47
- package/src/dashboard/index.html +14 -12
- package/src/dashboard/package.json +32 -24
- package/src/dashboard/scanner/activity-scanner.js +351 -0
- package/src/dashboard/scanner/agents-scanner.js +63 -1
- package/src/dashboard/scanner/docs-scanner.js +59 -0
- package/src/dashboard/scanner/feature-status.js +10 -0
- package/src/dashboard/scanner/features-scanner.js +360 -0
- package/src/dashboard/scanner/hooks-scanner.js +8 -1
- package/src/dashboard/scanner/index.js +14 -7
- package/src/dashboard/scanner/phases-scanner.js +14 -15
- package/src/dashboard/scanner/portfolio.js +153 -0
- package/src/dashboard/scanner/project-api.js +195 -0
- package/src/dashboard/scanner/rules-scanner.js +42 -37
- package/src/dashboard/scanner/skills-scanner.js +105 -43
- package/src/dashboard/scanner/standards-scanner.js +4 -1
- package/src/dashboard/vite-plugin-morph-data.js +134 -17
- package/src/lib/ai/comment-stripper.js +101 -4
- package/src/lib/detectors/claude-config-detector.js +2 -7
- package/src/lib/detectors/index.js +5 -1
- package/src/lib/evaluator-report.js +47 -0
- package/src/lib/generators/handoff-generator.js +4 -18
- package/src/lib/generators/settings-generator.js +208 -209
- package/src/lib/git/default-branch.js +52 -0
- package/src/lib/git/tree-fingerprint.js +58 -0
- package/src/lib/git/tree-state.js +167 -0
- package/src/lib/graph/god-nodes.js +12 -3
- package/src/lib/graph/graph-health.js +48 -2
- package/src/lib/graph/graph-loader.js +99 -25
- package/src/lib/graph/graphifyignore.js +145 -28
- package/src/lib/graph/sanitize.js +117 -11
- package/src/lib/installers/mcp-installer.js +724 -719
- package/src/lib/installers/memory-installer.js +1 -2
- package/src/lib/projects/registry.js +154 -0
- package/src/lib/risk-detector.js +90 -0
- package/src/lib/specs/acervo-format.js +70 -0
- package/src/lib/specs/acervo-lifecycle.js +264 -0
- package/src/lib/specs/adr-index.js +169 -0
- package/src/lib/specs/revocations.js +156 -0
- package/src/lib/specs/screen-checklist.js +357 -0
- package/src/lib/specs/usecase-check.js +20 -16
- package/src/lib/specs/usecase-promoter.js +103 -38
- package/src/lib/specs/usecase-registry.js +7 -7
- package/src/lib/tasks/tasks-json-parser.js +2 -3
- package/src/lib/telemetry/metrics.js +386 -0
- package/src/lib/telemetry/telemetry-reader.js +161 -51
- package/src/lib/telemetry/verify-event.js +79 -0
- package/src/lib/validators/code-budget/code-budget-validator.js +200 -0
- package/src/lib/validators/code-budget/comment-scanner.js +75 -0
- package/src/lib/validators/code-budget/index.js +9 -0
- package/src/lib/validators/reuse/reuse-validator.js +4 -2
- package/src/lib/validators/reuse/symbol-scanner.js +27 -22
- package/src/lib/validators/validation-runner.js +21 -5
- package/src/lib/validators/verify-runner.js +11 -0
- package/src/lib/worktree/finish-backup.js +739 -0
- package/src/lib/worktree/ignored-triage.js +15 -8
- package/src/lib/worktree/worktree-audit.js +5 -0
- package/src/scripts/install-plugin.js +1 -1
- package/src/scripts/setup-infra.js +31 -22
- package/src/utils/agents-installer.js +338 -24
- package/src/utils/banner.js +1 -1
- package/src/utils/hooks-installer.js +75 -15
- package/src/commands/index.js +0 -13
- package/src/commands/project/checkpoint.js +0 -209
- package/src/core/state/phase-state-machine.js +0 -197
- package/src/dashboard/app/hooks/useDetailPanel.js +0 -15
- package/src/dashboard/app/pages/LiveState.jsx +0 -206
- package/src/dashboard/scanner/squads-scanner.js +0 -13
- package/src/dashboard/scanner/state-scanner.js +0 -85
- package/src/lib/generators/index.js +0 -10
- package/src/lib/hooks/hook-executor.js +0 -167
- package/src/lib/validators/checkpoint-persistence.js +0 -39
- package/src/lib/validators/shared/emit-validator-dispatch.js +0 -14
- package/src/lib/validators/shared/index.js +0 -12
- package/src/lib/validators/shared/issue-counter.js +0 -14
- package/src/lib/validators/shared/result-formatter.js +0 -124
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loop measurements over the harness event stream: turns, tool calls split by
|
|
3
|
+
* orchestrator and sub-agent, time per command class, identical reruns, file
|
|
4
|
+
* rereads, feature-scope verify count, git calls per task and whether the
|
|
5
|
+
* reuse validator ran. Computed the same way on every window so a later
|
|
6
|
+
* window compares with an earlier one.
|
|
7
|
+
*
|
|
8
|
+
* Every number degrades to null ("not measurable here") when the stream lacks
|
|
9
|
+
* the field it needs — a v1 event never counts as a zero.
|
|
10
|
+
*
|
|
11
|
+
* A rerun is the same producer command (what runs before the output filter:
|
|
12
|
+
* `dotnet test | tail -25` then `| tail -20` is one test run twice) in the same
|
|
13
|
+
* feature within 10 minutes of its previous run. `rate` counts the repeats;
|
|
14
|
+
* `burstRate` counts every run that belongs to a burst, the first included.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { ingestedBytes } from './telemetry-reader.js';
|
|
18
|
+
import { producerOf } from '../../../framework/hooks/shared/command-tokens.js';
|
|
19
|
+
import { isFailedToolCall } from '../../../framework/hooks/shared/telemetry-logger.js';
|
|
20
|
+
|
|
21
|
+
export const RERUN_WINDOW_MS = 10 * 60 * 1000;
|
|
22
|
+
|
|
23
|
+
const RERUN_CLASSES = new Set(['test', 'build', 'verify']);
|
|
24
|
+
const READ_ONLY = new Set(['grep', 'rg', 'sed', 'ls', 'cat', 'find', 'head', 'tail', 'wc', 'tree', 'awk']);
|
|
25
|
+
const TOOL_EVENTS = new Set(['PostToolUse', 'PostToolUseFailure']);
|
|
26
|
+
const NO_FEATURE = '\u0000';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The command without quoted text and heredoc bodies: `morph-spec verify`
|
|
30
|
+
* inside a commit message is not a verify run.
|
|
31
|
+
*/
|
|
32
|
+
function executedText(command) {
|
|
33
|
+
const beforeHeredoc = command.split('<<', 1)[0];
|
|
34
|
+
return beforeHeredoc.replace(/"(?:[^"\\]|\\.)*"|'[^']*'/g, (q) => q[0] + ' '.repeat(q.length - 2) + q[0]);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Kind (fine) and class (coarse) of a shell command. Searched anywhere in the
|
|
39
|
+
* command, most specific first, so `cd x && dotnet test` is a test.
|
|
40
|
+
*
|
|
41
|
+
* @param {string} command
|
|
42
|
+
* @returns {{ kind: string, klass: string }}
|
|
43
|
+
*/
|
|
44
|
+
export function classifyCommand(command) {
|
|
45
|
+
const cmd = String(command || '');
|
|
46
|
+
const verify = /\bmorph-spec(?:\.js)?\s+verify\s+[^\s;&|)]+(\s+T\d+\b)?/.exec(executedText(cmd));
|
|
47
|
+
if (verify) return { kind: verify[1] ? 'verify-task' : 'verify-feature', klass: 'verify' };
|
|
48
|
+
if (/\bdotnet\s+test\b/.test(cmd)) {
|
|
49
|
+
if (/--list-tests\b/.test(cmd)) return { kind: 'dotnet-test-list', klass: 'test' };
|
|
50
|
+
return { kind: /--filter\b/.test(cmd) ? 'dotnet-test-filtered' : 'dotnet-test-full', klass: 'test' };
|
|
51
|
+
}
|
|
52
|
+
if (/\b(?:(?:npm|pnpm|yarn)\s+(?:run\s+)?test|vitest|jest|node\s+--test|run-tests\.mjs)\b/.test(cmd)) {
|
|
53
|
+
return { kind: 'js-test', klass: 'test' };
|
|
54
|
+
}
|
|
55
|
+
if (/\b(?:dotnet\s+build|(?:npm|pnpm|yarn)\s+(?:run\s+)?build|next\s+build|tsc)\b/.test(cmd)) {
|
|
56
|
+
return { kind: 'build', klass: 'build' };
|
|
57
|
+
}
|
|
58
|
+
if (/\b(?:morph-spec\s+e2e|playwright\s+test|docker\s+compose\s+up)\b/.test(cmd)) return { kind: 'e2e', klass: 'e2e' };
|
|
59
|
+
const git = /\bgit\s+(?:-C\s+(?:"[^"]*"|\S+)\s+)?([a-z][a-z-]*)/.exec(cmd);
|
|
60
|
+
if (git) return { kind: `git-${git[1]}`, klass: 'git' };
|
|
61
|
+
const morph = /\bmorph-spec\s+([a-z][a-z-]*)/.exec(cmd);
|
|
62
|
+
if (morph) return { kind: `morph-spec-${morph[1]}`, klass: 'morph-spec' };
|
|
63
|
+
const first = cmd.trim().split(/\s+/, 1)[0];
|
|
64
|
+
if (READ_ONLY.has(first)) return { kind: first, klass: 'read' };
|
|
65
|
+
return { kind: 'other', klass: 'other' };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** `git status` and `git diff` occurrences — `git status && git diff` is two calls. */
|
|
69
|
+
function gitCalls(command) {
|
|
70
|
+
const text = executedText(String(command || ''));
|
|
71
|
+
const count = (sub) => (text.match(new RegExp(`\\bgit\\s+(?:-C\\s+(?:"[^"]*"|\\S+)\\s+)?${sub}\\b`, 'g')) || []).length;
|
|
72
|
+
return { status: count('status'), diff: count('diff') };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function median(values) {
|
|
76
|
+
const v = values.filter((x) => Number.isFinite(x)).sort((a, b) => a - b);
|
|
77
|
+
if (!v.length) return null;
|
|
78
|
+
const mid = Math.floor(v.length / 2);
|
|
79
|
+
return v.length % 2 ? v[mid] : (v[mid - 1] + v[mid]) / 2;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function rate(part, whole) {
|
|
83
|
+
return whole ? Math.round((part / whole) * 1000) / 1000 : null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function isV2(e) {
|
|
87
|
+
return Number.isInteger(e.schemaVersion) && e.schemaVersion >= 2;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function whoOf(e) {
|
|
91
|
+
if (e.agentId) return 'subagent';
|
|
92
|
+
return isV2(e) ? 'orchestrator' : 'unknown';
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function newCounters() {
|
|
96
|
+
return {
|
|
97
|
+
toolCalls: { total: 0, orchestrator: 0, subagent: 0, unknown: 0 },
|
|
98
|
+
turns: { total: 0, orchestrator: 0, subagent: 0, unknown: 0 },
|
|
99
|
+
timeByClass: {},
|
|
100
|
+
reruns: { runs: 0, reruns: 0, inBursts: 0 },
|
|
101
|
+
git: { status: 0, diff: 0 },
|
|
102
|
+
reads: { reads: 0, bytes: 0, redundantBytes: 0, windowed: 0 },
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function addTime(counters, klass, durationMs) {
|
|
107
|
+
const slot = counters.timeByClass[klass] ||= { runs: 0, measuredMs: 0, unmeasured: 0 };
|
|
108
|
+
slot.runs += 1;
|
|
109
|
+
if (Number.isFinite(durationMs)) slot.measuredMs += durationMs;
|
|
110
|
+
else slot.unmeasured += 1;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function finishCounters(c, turnsObserved) {
|
|
114
|
+
return {
|
|
115
|
+
toolCalls: c.toolCalls,
|
|
116
|
+
turns: turnsObserved ? c.turns : null,
|
|
117
|
+
timeByClass: c.timeByClass,
|
|
118
|
+
reruns: { ...c.reruns, rate: rate(c.reruns.reruns, c.reruns.runs), burstRate: rate(c.reruns.inBursts, c.reruns.runs) },
|
|
119
|
+
git: c.git,
|
|
120
|
+
rereads: { ...c.reads, rate: rate(c.reads.redundantBytes, c.reads.bytes) },
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Why a command ran again within the window. Edits in between and a changed
|
|
126
|
+
* output filter need no exit code; the pass/fail split does, so a masked or v1
|
|
127
|
+
* exit code falls back to "after an edit or not".
|
|
128
|
+
*/
|
|
129
|
+
function rerunClass(prev, current, editsBetween) {
|
|
130
|
+
if (isV2(prev) && prev.outcome === 'timeout') return 'timeout';
|
|
131
|
+
if (editsBetween === 0 && prev.command !== current.command) return 'refilter';
|
|
132
|
+
if (!isV2(prev) || !isV2(current) || prev.exitMasked || current.exitMasked) {
|
|
133
|
+
return editsBetween > 0 ? 'unknown-after-edit' : 'unknown-no-edit';
|
|
134
|
+
}
|
|
135
|
+
const prevFailed = prev.outcome === 'error' || (Number.isInteger(prev.exitCode) && prev.exitCode !== 0);
|
|
136
|
+
const nowFailed = current.outcome === 'error' || (Number.isInteger(current.exitCode) && current.exitCode !== 0);
|
|
137
|
+
if (prevFailed) {
|
|
138
|
+
if (editsBetween > 0) return 'fix-loop';
|
|
139
|
+
return nowFailed ? 'retry' : 'flake';
|
|
140
|
+
}
|
|
141
|
+
return editsBetween > 0 ? 're-verify' : 'redundant';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function reuseStateOf(e) {
|
|
145
|
+
const skipped = (e.nodes?.validators?.skipped || []).find((s) => s?.validator === 'reuse');
|
|
146
|
+
if (skipped) return { state: 'skipped', reason: skipped.reason || null };
|
|
147
|
+
if ((e.nodes?.validators?.ran || []).includes('reuse')) return { state: 'ran', reason: null };
|
|
148
|
+
return { state: 'absent', reason: null };
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @param {Object[]} events - deduplicated, time-ordered (loadTelemetry)
|
|
153
|
+
* @param {{ feature?: string, top?: number }} [opts]
|
|
154
|
+
* @returns {Object} see framework/docs/CLI.md, "cost --metrics"
|
|
155
|
+
*/
|
|
156
|
+
export function computeMetrics(events, opts = {}) {
|
|
157
|
+
const top = Number.isInteger(opts.top) && opts.top > 0 ? opts.top : 10;
|
|
158
|
+
const scoped = (events || []).filter((e) => e && typeof e === 'object' && (!opts.feature || e.feature === opts.feature));
|
|
159
|
+
|
|
160
|
+
const global = newCounters();
|
|
161
|
+
const byFeature = new Map();
|
|
162
|
+
const openTask = new Map();
|
|
163
|
+
const tasks = [];
|
|
164
|
+
const lastRun = new Map();
|
|
165
|
+
const editCount = new Map();
|
|
166
|
+
const readsSeen = new Set();
|
|
167
|
+
const files = new Map();
|
|
168
|
+
const rerunClasses = {};
|
|
169
|
+
const rerunByKind = {};
|
|
170
|
+
const verifyByFeature = {};
|
|
171
|
+
const fullSuite = { runs: 0, withBuild: 0, byPhase: {} };
|
|
172
|
+
const lastFingerprint = new Map();
|
|
173
|
+
const unchangedRepeats = {};
|
|
174
|
+
const reuse = { runs: 0, byTree: {}, skipReasons: {} };
|
|
175
|
+
const tasksOf = new Map();
|
|
176
|
+
let callsInTaskWindows = 0;
|
|
177
|
+
let v2 = 0;
|
|
178
|
+
let legacy = 0;
|
|
179
|
+
let turnsObserved = false;
|
|
180
|
+
let from = null;
|
|
181
|
+
let to = null;
|
|
182
|
+
|
|
183
|
+
const featureCounters = (key) => {
|
|
184
|
+
if (!byFeature.has(key)) byFeature.set(key, newCounters());
|
|
185
|
+
return byFeature.get(key);
|
|
186
|
+
};
|
|
187
|
+
const closeTask = (key, endTs, status) => {
|
|
188
|
+
const task = openTask.get(key);
|
|
189
|
+
if (!task) return;
|
|
190
|
+
openTask.delete(key);
|
|
191
|
+
task.endTs = endTs;
|
|
192
|
+
task.status = status;
|
|
193
|
+
task.open = endTs === null;
|
|
194
|
+
tasks.push(task);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
for (const e of scoped) {
|
|
198
|
+
if (isV2(e)) v2 += 1; else legacy += 1;
|
|
199
|
+
if (e.ts) {
|
|
200
|
+
from ??= e.ts;
|
|
201
|
+
to = e.ts;
|
|
202
|
+
}
|
|
203
|
+
const fkey = e.feature || NO_FEATURE;
|
|
204
|
+
|
|
205
|
+
if (e.event === 'TaskStart' && e.task) {
|
|
206
|
+
if (!tasksOf.has(fkey)) tasksOf.set(fkey, new Set());
|
|
207
|
+
tasksOf.get(fkey).add(e.task);
|
|
208
|
+
closeTask(fkey, null, null);
|
|
209
|
+
openTask.set(fkey, { feature: e.feature ?? null, task: e.task, startTs: e.ts, endTs: null, status: null, open: true, c: newCounters() });
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
if (e.event === 'TaskEnd' && e.task) {
|
|
213
|
+
if (openTask.get(fkey)?.task === e.task) closeTask(fkey, e.ts, e.status ?? null);
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const sinks = [global, featureCounters(fkey)];
|
|
218
|
+
const task = openTask.get(fkey);
|
|
219
|
+
if (task) sinks.push(task.c);
|
|
220
|
+
|
|
221
|
+
if (e.event === 'ToolBatch') {
|
|
222
|
+
turnsObserved = true;
|
|
223
|
+
for (const c of sinks) { c.turns.total += 1; c.turns[whoOf(e)] += 1; }
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (e.event === 'Verify') {
|
|
228
|
+
if (e.scope === 'feature' && e.fingerprint && e.persisted !== false) {
|
|
229
|
+
if (lastFingerprint.get(fkey) === e.fingerprint) {
|
|
230
|
+
unchangedRepeats[e.feature || '(sem feature)'] = (unchangedRepeats[e.feature || '(sem feature)'] || 0) + 1;
|
|
231
|
+
}
|
|
232
|
+
lastFingerprint.set(fkey, e.fingerprint);
|
|
233
|
+
}
|
|
234
|
+
reuse.runs += 1;
|
|
235
|
+
const tree = e.tree || 'unknown';
|
|
236
|
+
const { state, reason } = reuseStateOf(e);
|
|
237
|
+
const slot = reuse.byTree[tree] ||= { ran: 0, skipped: 0, absent: 0 };
|
|
238
|
+
slot[state] += 1;
|
|
239
|
+
if (reason) reuse.skipReasons[reason] = (reuse.skipReasons[reason] || 0) + 1;
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (!TOOL_EVENTS.has(e.event) || !e.tool) continue;
|
|
244
|
+
for (const c of sinks) { c.toolCalls.total += 1; c.toolCalls[whoOf(e)] += 1; }
|
|
245
|
+
if (task) callsInTaskWindows += 1;
|
|
246
|
+
|
|
247
|
+
if (e.tool === 'Write' || e.tool === 'Edit') {
|
|
248
|
+
if (!isFailedToolCall(e)) editCount.set(fkey, (editCount.get(fkey) || 0) + 1);
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (e.tool === 'Read') {
|
|
253
|
+
const bytes = ingestedBytes(e);
|
|
254
|
+
if (bytes === null || !e.target) continue;
|
|
255
|
+
const window = `${fkey}\u0000${e.target}\u0000${e.offset || 1}\u0000${e.limit || 0}`;
|
|
256
|
+
const redundant = readsSeen.has(window) ? bytes : 0;
|
|
257
|
+
readsSeen.add(window);
|
|
258
|
+
for (const c of sinks) {
|
|
259
|
+
c.reads.reads += 1;
|
|
260
|
+
c.reads.bytes += bytes;
|
|
261
|
+
c.reads.redundantBytes += redundant;
|
|
262
|
+
if (Number.isFinite(e.bytesRead)) c.reads.windowed += 1;
|
|
263
|
+
}
|
|
264
|
+
const fileKey = `${fkey}\u0000${e.target}`;
|
|
265
|
+
const file = files.get(fileKey) || { feature: e.feature ?? null, file: e.target, reads: 0, bytes: 0, redundantBytes: 0 };
|
|
266
|
+
file.reads += 1;
|
|
267
|
+
file.bytes += bytes;
|
|
268
|
+
file.redundantBytes += redundant;
|
|
269
|
+
files.set(fileKey, file);
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (e.tool !== 'Bash' && e.tool !== 'PowerShell') continue;
|
|
274
|
+
const { kind, klass } = classifyCommand(e.command);
|
|
275
|
+
const git = gitCalls(e.command);
|
|
276
|
+
for (const c of sinks) {
|
|
277
|
+
addTime(c, klass, e.durationMs);
|
|
278
|
+
c.git.status += git.status;
|
|
279
|
+
c.git.diff += git.diff;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (kind === 'dotnet-test-full') {
|
|
283
|
+
const rebuilds = !/--no-build\b/.test(e.command);
|
|
284
|
+
const phase = fullSuite.byPhase[e.phase || '-'] ||= { runs: 0, withBuild: 0 };
|
|
285
|
+
fullSuite.runs += 1;
|
|
286
|
+
phase.runs += 1;
|
|
287
|
+
if (rebuilds) { fullSuite.withBuild += 1; phase.withBuild += 1; }
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (klass === 'verify') {
|
|
291
|
+
const slot = verifyByFeature[e.feature || '(sem feature)'] ||= { feature: 0, task: 0 };
|
|
292
|
+
slot[kind === 'verify-feature' ? 'feature' : 'task'] += 1;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (!RERUN_CLASSES.has(klass) || typeof e.command !== 'string') continue;
|
|
296
|
+
const runKey = `${fkey}\u0000${producerOf(e.command)}`;
|
|
297
|
+
const prev = lastRun.get(runKey);
|
|
298
|
+
const edits = editCount.get(fkey) || 0;
|
|
299
|
+
const t = Date.parse(e.ts ?? '');
|
|
300
|
+
const isRerun = Boolean(prev) && Number.isFinite(t) && t - prev.t <= RERUN_WINDOW_MS;
|
|
301
|
+
const kindSlot = rerunByKind[kind] ||= { runs: 0, reruns: 0, inBursts: 0 };
|
|
302
|
+
kindSlot.runs += 1;
|
|
303
|
+
for (const c of sinks) c.reruns.runs += 1;
|
|
304
|
+
const run = { t: Number.isFinite(t) ? t : 0, edits, event: e, sinks, kindSlot, inBurst: false };
|
|
305
|
+
if (isRerun) {
|
|
306
|
+
kindSlot.reruns += 1;
|
|
307
|
+
for (const c of sinks) c.reruns.reruns += 1;
|
|
308
|
+
// A burst counts its first run too; that one is only known once the
|
|
309
|
+
// second arrives, so it is credited to where it ran, late.
|
|
310
|
+
for (const r of prev.inBurst ? [run] : [prev, run]) {
|
|
311
|
+
r.inBurst = true;
|
|
312
|
+
r.kindSlot.inBursts += 1;
|
|
313
|
+
for (const c of r.sinks) c.reruns.inBursts += 1;
|
|
314
|
+
}
|
|
315
|
+
const why = rerunClass(prev.event, e, edits - prev.edits);
|
|
316
|
+
rerunClasses[why] = (rerunClasses[why] || 0) + 1;
|
|
317
|
+
}
|
|
318
|
+
lastRun.set(runKey, run);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
for (const key of [...openTask.keys()]) closeTask(key, null, null);
|
|
322
|
+
tasks.sort((a, b) => String(a.startTs).localeCompare(String(b.startTs)));
|
|
323
|
+
|
|
324
|
+
const taskRows = tasks.map((t) => ({
|
|
325
|
+
feature: t.feature,
|
|
326
|
+
task: t.task,
|
|
327
|
+
startTs: t.startTs,
|
|
328
|
+
endTs: t.endTs,
|
|
329
|
+
open: t.open,
|
|
330
|
+
status: t.status,
|
|
331
|
+
...finishCounters(t.c, turnsObserved),
|
|
332
|
+
}));
|
|
333
|
+
|
|
334
|
+
const featureRows = [...byFeature.entries()]
|
|
335
|
+
.filter(([key]) => key !== NO_FEATURE)
|
|
336
|
+
.map(([feature, c]) => ({
|
|
337
|
+
feature,
|
|
338
|
+
...finishCounters(c, turnsObserved),
|
|
339
|
+
verify: verifyByFeature[feature] || { feature: 0, task: 0 },
|
|
340
|
+
}))
|
|
341
|
+
.sort((a, b) => b.toolCalls.total - a.toolCalls.total || a.feature.localeCompare(b.feature));
|
|
342
|
+
|
|
343
|
+
// A task window only holds what ran between its TaskStart and TaskEnd, and
|
|
344
|
+
// a parallel batch or a late `in_progress` leaves most calls outside any
|
|
345
|
+
// window. Dividing each feature's totals by its task count needs no window.
|
|
346
|
+
const perTaskOfFeature = (pick) => median(featureRows
|
|
347
|
+
.filter((f) => tasksOf.has(f.feature))
|
|
348
|
+
.map((f) => Math.round((pick(f) / tasksOf.get(f.feature).size) * 10) / 10));
|
|
349
|
+
const byKind = {};
|
|
350
|
+
for (const [kind, slot] of Object.entries(rerunByKind)) {
|
|
351
|
+
byKind[kind] = { ...slot, rate: rate(slot.reruns, slot.runs), burstRate: rate(slot.inBursts, slot.runs) };
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return {
|
|
355
|
+
scope: { feature: opts.feature ?? null },
|
|
356
|
+
window: { from, to, events: scoped.length },
|
|
357
|
+
coverage: { v2, legacy },
|
|
358
|
+
...finishCounters(global, turnsObserved),
|
|
359
|
+
rerunsByKind: byKind,
|
|
360
|
+
rerunClasses,
|
|
361
|
+
topRereads: [...files.values()]
|
|
362
|
+
.filter((f) => f.redundantBytes > 0)
|
|
363
|
+
.sort((a, b) => b.redundantBytes - a.redundantBytes || a.file.localeCompare(b.file))
|
|
364
|
+
.slice(0, top),
|
|
365
|
+
verify: {
|
|
366
|
+
byFeature: verifyByFeature,
|
|
367
|
+
featureScopeMedian: median(featureRows.map((f) => f.verify.feature).filter((n) => n > 0)),
|
|
368
|
+
unchangedRepeats,
|
|
369
|
+
},
|
|
370
|
+
gitPerTaskMedian: {
|
|
371
|
+
status: median(taskRows.map((t) => t.git.status)),
|
|
372
|
+
diff: median(taskRows.map((t) => t.git.diff)),
|
|
373
|
+
},
|
|
374
|
+
turnsPerTaskMedian: turnsObserved ? median(taskRows.map((t) => t.turns.total)) : null,
|
|
375
|
+
taskWindowCoverage: rate(callsInTaskWindows, global.toolCalls.total),
|
|
376
|
+
perTaskByFeature: {
|
|
377
|
+
git: perTaskOfFeature((f) => f.git.status + f.git.diff),
|
|
378
|
+
toolCalls: perTaskOfFeature((f) => f.toolCalls.total),
|
|
379
|
+
turns: turnsObserved ? perTaskOfFeature((f) => f.turns.total) : null,
|
|
380
|
+
},
|
|
381
|
+
dotnetFullSuite: fullSuite,
|
|
382
|
+
reuse,
|
|
383
|
+
features: featureRows,
|
|
384
|
+
tasks: taskRows,
|
|
385
|
+
};
|
|
386
|
+
}
|