codehere 0.4.0 → 0.5.0-alpha
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/LICENSE +1 -1
- package/README.md +113 -30
- package/dist/application/agents/execution-agent.js +2 -2
- package/dist/application/agents/execution-agent.js.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.d.ts +1 -0
- package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.js +10 -3
- package/dist/application/agents/multi-agent-orchestrator.js.map +1 -1
- package/dist/application/agents/planning-agent.d.ts.map +1 -1
- package/dist/application/agents/planning-agent.js +22 -10
- package/dist/application/agents/planning-agent.js.map +1 -1
- package/dist/application/agents/validation-agent.js +2 -2
- package/dist/application/agents/validation-agent.js.map +1 -1
- package/dist/application/reasoning/multi-model-planning-strategy.d.ts +21 -0
- package/dist/application/reasoning/multi-model-planning-strategy.d.ts.map +1 -0
- package/dist/application/reasoning/multi-model-planning-strategy.js +158 -0
- package/dist/application/reasoning/multi-model-planning-strategy.js.map +1 -0
- package/dist/application/reasoning/reasoning-config.d.ts +15 -0
- package/dist/application/reasoning/reasoning-config.d.ts.map +1 -0
- package/dist/application/reasoning/reasoning-config.js +50 -0
- package/dist/application/reasoning/reasoning-config.js.map +1 -0
- package/dist/application/reasoning/reasoning-orchestrator.d.ts +18 -0
- package/dist/application/reasoning/reasoning-orchestrator.d.ts.map +1 -0
- package/dist/application/reasoning/reasoning-orchestrator.js +170 -0
- package/dist/application/reasoning/reasoning-orchestrator.js.map +1 -0
- package/dist/application/reasoning/reasoning-strategy.interface.d.ts +24 -0
- package/dist/application/reasoning/reasoning-strategy.interface.d.ts.map +1 -0
- package/dist/application/reasoning/reasoning-strategy.interface.js +6 -0
- package/dist/application/reasoning/reasoning-strategy.interface.js.map +1 -0
- package/dist/application/reasoning/role-provider-resolver.d.ts +36 -0
- package/dist/application/reasoning/role-provider-resolver.d.ts.map +1 -0
- package/dist/application/reasoning/role-provider-resolver.js +74 -0
- package/dist/application/reasoning/role-provider-resolver.js.map +1 -0
- package/dist/application/reasoning/simple-planning-strategy.d.ts +22 -0
- package/dist/application/reasoning/simple-planning-strategy.d.ts.map +1 -0
- package/dist/application/reasoning/simple-planning-strategy.js +217 -0
- package/dist/application/reasoning/simple-planning-strategy.js.map +1 -0
- package/dist/application/reasoning/types.d.ts +65 -0
- package/dist/application/reasoning/types.d.ts.map +1 -0
- package/dist/application/reasoning/types.js +6 -0
- package/dist/application/reasoning/types.js.map +1 -0
- package/dist/application/reasoning/validator-strategy.d.ts +56 -0
- package/dist/application/reasoning/validator-strategy.d.ts.map +1 -0
- package/dist/application/reasoning/validator-strategy.js +103 -0
- package/dist/application/reasoning/validator-strategy.js.map +1 -0
- package/dist/application/services/dependency-container.d.ts +30 -6
- package/dist/application/services/dependency-container.d.ts.map +1 -1
- package/dist/application/services/dependency-container.js +96 -44
- package/dist/application/services/dependency-container.js.map +1 -1
- package/dist/application/services/intelligent-router.d.ts +6 -0
- package/dist/application/services/intelligent-router.d.ts.map +1 -1
- package/dist/application/services/intelligent-router.js +98 -9
- package/dist/application/services/intelligent-router.js.map +1 -1
- package/dist/application/use-cases/ask-question-use-case.d.ts +1 -0
- package/dist/application/use-cases/ask-question-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/ask-question-use-case.js +4 -3
- package/dist/application/use-cases/ask-question-use-case.js.map +1 -1
- package/dist/application/use-cases/planning-use-case.d.ts +14 -1
- package/dist/application/use-cases/planning-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/planning-use-case.js +109 -2
- package/dist/application/use-cases/planning-use-case.js.map +1 -1
- package/dist/domain/entities/memory.d.ts.map +1 -1
- package/dist/domain/entities/task.d.ts +1 -1
- package/dist/domain/entities/task.d.ts.map +1 -1
- package/dist/domain/entities/task.js +2 -2
- package/dist/domain/entities/task.js.map +1 -1
- package/dist/domain/errors/embeddings-not-found-error.d.ts +9 -0
- package/dist/domain/errors/embeddings-not-found-error.d.ts.map +1 -0
- package/dist/domain/errors/embeddings-not-found-error.js +13 -0
- package/dist/domain/errors/embeddings-not-found-error.js.map +1 -0
- package/dist/domain/interfaces/embedding-repository.interface.d.ts +5 -0
- package/dist/domain/interfaces/embedding-repository.interface.d.ts.map +1 -1
- package/dist/domain/services/environment-mode-manager.d.ts +4 -10
- package/dist/domain/services/environment-mode-manager.d.ts.map +1 -1
- package/dist/domain/services/environment-mode-manager.js +7 -22
- package/dist/domain/services/environment-mode-manager.js.map +1 -1
- package/dist/domain/services/query-intent-classifier.d.ts.map +1 -1
- package/dist/domain/services/query-intent-classifier.js +20 -1
- package/dist/domain/services/query-intent-classifier.js.map +1 -1
- package/dist/domain/services/risk-tier-detector.d.ts +8 -9
- package/dist/domain/services/risk-tier-detector.d.ts.map +1 -1
- package/dist/domain/services/risk-tier-detector.js +53 -40
- package/dist/domain/services/risk-tier-detector.js.map +1 -1
- package/dist/embed.d.ts.map +1 -1
- package/dist/embed.js +18 -8
- package/dist/embed.js.map +1 -1
- package/dist/index.js +405 -52
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.js +4 -4
- package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -1
- package/dist/infrastructure/ai/provider-ai-service.d.ts.map +1 -1
- package/dist/infrastructure/ai/provider-ai-service.js +7 -7
- package/dist/infrastructure/ai/provider-ai-service.js.map +1 -1
- package/dist/infrastructure/cache/query-result-cache.d.ts +14 -55
- package/dist/infrastructure/cache/query-result-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/query-result-cache.js +40 -112
- package/dist/infrastructure/cache/query-result-cache.js.map +1 -1
- package/dist/infrastructure/cache/response-cache.d.ts +10 -78
- package/dist/infrastructure/cache/response-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/response-cache.js +22 -198
- package/dist/infrastructure/cache/response-cache.js.map +1 -1
- package/dist/infrastructure/cache/security-scan-cache.d.ts +8 -49
- package/dist/infrastructure/cache/security-scan-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/security-scan-cache.js +25 -102
- package/dist/infrastructure/cache/security-scan-cache.js.map +1 -1
- package/dist/infrastructure/completion/bash-completion.d.ts +2 -3
- package/dist/infrastructure/completion/bash-completion.d.ts.map +1 -1
- package/dist/infrastructure/completion/bash-completion.js +11 -87
- package/dist/infrastructure/completion/bash-completion.js.map +1 -1
- package/dist/infrastructure/completion/fish-completion.d.ts +2 -3
- package/dist/infrastructure/completion/fish-completion.d.ts.map +1 -1
- package/dist/infrastructure/completion/fish-completion.js +15 -58
- package/dist/infrastructure/completion/fish-completion.js.map +1 -1
- package/dist/infrastructure/completion/zsh-completion.d.ts +2 -3
- package/dist/infrastructure/completion/zsh-completion.d.ts.map +1 -1
- package/dist/infrastructure/completion/zsh-completion.js +18 -73
- package/dist/infrastructure/completion/zsh-completion.js.map +1 -1
- package/dist/infrastructure/config/config-manager.d.ts +10 -0
- package/dist/infrastructure/config/config-manager.d.ts.map +1 -1
- package/dist/infrastructure/config/config-manager.js +13 -2
- package/dist/infrastructure/config/config-manager.js.map +1 -1
- package/dist/infrastructure/context/conversation-context.d.ts +27 -31
- package/dist/infrastructure/context/conversation-context.d.ts.map +1 -1
- package/dist/infrastructure/context/conversation-context.js +95 -136
- package/dist/infrastructure/context/conversation-context.js.map +1 -1
- package/dist/infrastructure/context/session-manager.d.ts +27 -11
- package/dist/infrastructure/context/session-manager.d.ts.map +1 -1
- package/dist/infrastructure/context/session-manager.js +69 -73
- package/dist/infrastructure/context/session-manager.js.map +1 -1
- package/dist/infrastructure/protocols/a2a-metadata.js +1 -1
- package/dist/infrastructure/protocols/mcp-oauth.js +1 -1
- package/dist/infrastructure/providers/cohere-provider.d.ts.map +1 -1
- package/dist/infrastructure/providers/cohere-provider.js +102 -17
- package/dist/infrastructure/providers/cohere-provider.js.map +1 -1
- package/dist/infrastructure/providers/openrouter-provider.d.ts +42 -0
- package/dist/infrastructure/providers/openrouter-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/openrouter-provider.js +401 -0
- package/dist/infrastructure/providers/openrouter-provider.js.map +1 -0
- package/dist/infrastructure/providers/operation-provider-resolver.d.ts.map +1 -1
- package/dist/infrastructure/providers/operation-provider-resolver.js +33 -7
- package/dist/infrastructure/providers/operation-provider-resolver.js.map +1 -1
- package/dist/infrastructure/security/input-validator.d.ts.map +1 -1
- package/dist/infrastructure/security/input-validator.js +19 -6
- package/dist/infrastructure/security/input-validator.js.map +1 -1
- package/dist/infrastructure/serialization/toon-serializer.d.ts +45 -0
- package/dist/infrastructure/serialization/toon-serializer.d.ts.map +1 -0
- package/dist/infrastructure/serialization/toon-serializer.js +119 -0
- package/dist/infrastructure/serialization/toon-serializer.js.map +1 -0
- package/dist/infrastructure/storage/embeddings-path.d.ts +18 -0
- package/dist/infrastructure/storage/embeddings-path.d.ts.map +1 -0
- package/dist/infrastructure/storage/embeddings-path.js +37 -0
- package/dist/infrastructure/storage/embeddings-path.js.map +1 -0
- package/dist/infrastructure/storage/plan-repository.d.ts +2 -0
- package/dist/infrastructure/storage/plan-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/plan-repository.js +36 -73
- package/dist/infrastructure/storage/plan-repository.js.map +1 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts +10 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.js +37 -3
- package/dist/infrastructure/storage/sqlite-embedding-repository.js.map +1 -1
- package/dist/infrastructure/storage/task-helpers.d.ts +12 -1
- package/dist/infrastructure/storage/task-helpers.d.ts.map +1 -1
- package/dist/infrastructure/storage/task-helpers.js +48 -8
- package/dist/infrastructure/storage/task-helpers.js.map +1 -1
- package/dist/infrastructure/storage/task-repository.d.ts +2 -1
- package/dist/infrastructure/storage/task-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/task-repository.js +14 -3
- package/dist/infrastructure/storage/task-repository.js.map +1 -1
- package/dist/infrastructure/telemetry/telemetry-service.d.ts +74 -0
- package/dist/infrastructure/telemetry/telemetry-service.d.ts.map +1 -0
- package/dist/infrastructure/telemetry/telemetry-service.js +167 -0
- package/dist/infrastructure/telemetry/telemetry-service.js.map +1 -0
- package/dist/infrastructure/ux/capability-boundaries.d.ts +9 -37
- package/dist/infrastructure/ux/capability-boundaries.d.ts.map +1 -1
- package/dist/infrastructure/ux/capability-boundaries.js +23 -148
- package/dist/infrastructure/ux/capability-boundaries.js.map +1 -1
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts +12 -54
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts.map +1 -1
- package/dist/infrastructure/ux/comprehensive-formatter.js +87 -182
- package/dist/infrastructure/ux/comprehensive-formatter.js.map +1 -1
- package/dist/infrastructure/ux/contextual-feature-discovery.d.ts +5 -18
- package/dist/infrastructure/ux/contextual-feature-discovery.d.ts.map +1 -1
- package/dist/infrastructure/ux/contextual-feature-discovery.js +5 -139
- package/dist/infrastructure/ux/contextual-feature-discovery.js.map +1 -1
- package/dist/infrastructure/ux/feature-discovery.d.ts +3 -33
- package/dist/infrastructure/ux/feature-discovery.d.ts.map +1 -1
- package/dist/infrastructure/ux/feature-discovery.js +5 -181
- package/dist/infrastructure/ux/feature-discovery.js.map +1 -1
- package/dist/infrastructure/ux/feedback-prompt.d.ts +15 -31
- package/dist/infrastructure/ux/feedback-prompt.d.ts.map +1 -1
- package/dist/infrastructure/ux/feedback-prompt.js +30 -166
- package/dist/infrastructure/ux/feedback-prompt.js.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.d.ts +4 -6
- package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.js +35 -50
- package/dist/infrastructure/ux/progress-indicator.js.map +1 -1
- package/dist/infrastructure/ux/review-checkpoint.d.ts +3 -1
- package/dist/infrastructure/ux/review-checkpoint.d.ts.map +1 -1
- package/dist/infrastructure/ux/review-checkpoint.js +33 -80
- package/dist/infrastructure/ux/review-checkpoint.js.map +1 -1
- package/dist/infrastructure/ux/staged-feature-intro.d.ts +14 -39
- package/dist/infrastructure/ux/staged-feature-intro.d.ts.map +1 -1
- package/dist/infrastructure/ux/staged-feature-intro.js +12 -132
- package/dist/infrastructure/ux/staged-feature-intro.js.map +1 -1
- package/dist/infrastructure/ux/syntax-highlighter.d.ts +1 -2
- package/dist/infrastructure/ux/syntax-highlighter.d.ts.map +1 -1
- package/dist/infrastructure/ux/syntax-highlighter.js +67 -148
- package/dist/infrastructure/ux/syntax-highlighter.js.map +1 -1
- package/dist/infrastructure/validation/agent-feedback.d.ts +25 -89
- package/dist/infrastructure/validation/agent-feedback.d.ts.map +1 -1
- package/dist/infrastructure/validation/agent-feedback.js +32 -204
- package/dist/infrastructure/validation/agent-feedback.js.map +1 -1
- package/dist/infrastructure/validation/agent-validation-helper.d.ts +53 -53
- package/dist/infrastructure/validation/agent-validation-helper.d.ts.map +1 -1
- package/dist/infrastructure/validation/agent-validation-helper.js +110 -61
- package/dist/infrastructure/validation/agent-validation-helper.js.map +1 -1
- package/dist/infrastructure/validation/review-handler.d.ts +13 -41
- package/dist/infrastructure/validation/review-handler.d.ts.map +1 -1
- package/dist/infrastructure/validation/review-handler.js +23 -189
- package/dist/infrastructure/validation/review-handler.js.map +1 -1
- package/dist/infrastructure/validation/summary-aggregator.d.ts +25 -22
- package/dist/infrastructure/validation/summary-aggregator.d.ts.map +1 -1
- package/dist/infrastructure/validation/summary-aggregator.js +47 -133
- package/dist/infrastructure/validation/summary-aggregator.js.map +1 -1
- package/dist/infrastructure/validation/summary-extractor.d.ts +13 -48
- package/dist/infrastructure/validation/summary-extractor.d.ts.map +1 -1
- package/dist/infrastructure/validation/summary-extractor.js +32 -89
- package/dist/infrastructure/validation/summary-extractor.js.map +1 -1
- package/dist/infrastructure/validation/trace-summary.d.ts +30 -57
- package/dist/infrastructure/validation/trace-summary.d.ts.map +1 -1
- package/dist/infrastructure/validation/trace-summary.js +37 -356
- package/dist/infrastructure/validation/trace-summary.js.map +1 -1
- package/dist/monitoring.d.ts +1 -1
- package/dist/monitoring.d.ts.map +1 -1
- package/dist/monitoring.js +12 -9
- package/dist/monitoring.js.map +1 -1
- package/dist/parallel-processor.d.ts.map +1 -1
- package/dist/parallel-processor.js +124 -45
- package/dist/parallel-processor.js.map +1 -1
- package/dist/presentation/cli/commands/ask-command.d.ts +2 -0
- package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/ask-command.js +316 -129
- package/dist/presentation/cli/commands/ask-command.js.map +1 -1
- package/dist/presentation/cli/commands/config-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/config-command.js +22 -8
- package/dist/presentation/cli/commands/config-command.js.map +1 -1
- package/dist/presentation/cli/commands/decision-command.js +23 -6
- package/dist/presentation/cli/commands/decision-command.js.map +1 -1
- package/dist/presentation/cli/commands/docs-command.d.ts +3 -1
- package/dist/presentation/cli/commands/docs-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/docs-command.js +13 -184
- package/dist/presentation/cli/commands/docs-command.js.map +1 -1
- package/dist/presentation/cli/commands/fix-command.d.ts +2 -0
- package/dist/presentation/cli/commands/fix-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/fix-command.js +61 -276
- package/dist/presentation/cli/commands/fix-command.js.map +1 -1
- package/dist/presentation/cli/commands/help-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/help-command.js +21 -1
- package/dist/presentation/cli/commands/help-command.js.map +1 -1
- package/dist/presentation/cli/commands/memory-command.d.ts +17 -0
- package/dist/presentation/cli/commands/memory-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/memory-command.js +252 -0
- package/dist/presentation/cli/commands/memory-command.js.map +1 -0
- package/dist/presentation/cli/commands/models-command.d.ts +13 -0
- package/dist/presentation/cli/commands/models-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/models-command.js +194 -0
- package/dist/presentation/cli/commands/models-command.js.map +1 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts +1 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/orchestrate-command.js +129 -14
- package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -1
- package/dist/presentation/cli/commands/plan-command.d.ts +1 -0
- package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/plan-command.js +134 -25
- package/dist/presentation/cli/commands/plan-command.js.map +1 -1
- package/dist/presentation/cli/commands/product-command.d.ts +6 -4
- package/dist/presentation/cli/commands/product-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/product-command.js +12 -178
- package/dist/presentation/cli/commands/product-command.js.map +1 -1
- package/dist/presentation/cli/commands/react-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/react-command.js +5 -1
- package/dist/presentation/cli/commands/react-command.js.map +1 -1
- package/dist/presentation/cli/commands/review-command.d.ts +7 -7
- package/dist/presentation/cli/commands/review-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/review-command.js +167 -16
- package/dist/presentation/cli/commands/review-command.js.map +1 -1
- package/dist/presentation/cli/commands/run-command.d.ts +6 -8
- package/dist/presentation/cli/commands/run-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/run-command.js +182 -23
- package/dist/presentation/cli/commands/run-command.js.map +1 -1
- package/dist/presentation/cli/commands/setup-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/setup-command.js +15 -0
- package/dist/presentation/cli/commands/setup-command.js.map +1 -1
- package/dist/presentation/cli/commands/smart-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/smart-command.js +74 -6
- package/dist/presentation/cli/commands/smart-command.js.map +1 -1
- package/dist/presentation/cli/commands/status-command.d.ts +3 -0
- package/dist/presentation/cli/commands/status-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/status-command.js +151 -156
- package/dist/presentation/cli/commands/status-command.js.map +1 -1
- package/dist/presentation/cli/commands/suggest-command.d.ts +3 -5
- package/dist/presentation/cli/commands/suggest-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/suggest-command.js +132 -19
- package/dist/presentation/cli/commands/suggest-command.js.map +1 -1
- package/dist/presentation/cli/error-display.d.ts.map +1 -1
- package/dist/presentation/cli/error-display.js +75 -17
- package/dist/presentation/cli/error-display.js.map +1 -1
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +6 -1
- package/dist/search.js.map +1 -1
- package/dist/session.d.ts +1 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +55 -7
- package/dist/session.js.map +1 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +3 -0
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/git-tool.js +7 -7
- package/dist/tools/git-tool.js.map +1 -1
- package/dist/ui.d.ts +11 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +54 -1
- package/dist/ui.js.map +1 -1
- package/package.json +14 -4
|
@@ -1,88 +1,137 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Agent Validation Helper
|
|
3
|
+
* Validates agent outputs and checks trust scores
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* - Automatic TraceSummary generation
|
|
7
|
-
* - AgentFeedback recording
|
|
8
|
-
* - Run context tracking
|
|
5
|
+
* Phase 1: v0.5.0-alpha.0
|
|
9
6
|
*/
|
|
7
|
+
import { TraceSummary } from './trace-summary.js';
|
|
10
8
|
import { executionTracer } from '../observability/execution-tracer.js';
|
|
11
|
-
import {
|
|
12
|
-
import { traceSummaryFormatter } from './trace-summary.js';
|
|
9
|
+
import { randomUUID } from 'crypto';
|
|
13
10
|
/**
|
|
14
|
-
*
|
|
11
|
+
* Agent validation helper
|
|
15
12
|
*/
|
|
16
|
-
export
|
|
13
|
+
export const agentValidationHelper = {
|
|
17
14
|
/**
|
|
18
|
-
* Start
|
|
15
|
+
* Start an agent operation and return validation context
|
|
19
16
|
*/
|
|
20
|
-
startAgentOperation(agentName, operation,
|
|
21
|
-
const runId = executionTracer.startRun(`${agentName}:${operation}`, {
|
|
22
|
-
query: context?.query,
|
|
23
|
-
codebaseId: context?.codebaseId,
|
|
24
|
-
});
|
|
17
|
+
startAgentOperation(agentName, operation, metadata) {
|
|
25
18
|
return {
|
|
26
|
-
runId,
|
|
27
19
|
agentName,
|
|
28
20
|
operation,
|
|
29
21
|
startTime: Date.now(),
|
|
22
|
+
metadata,
|
|
30
23
|
};
|
|
31
|
-
}
|
|
24
|
+
},
|
|
32
25
|
/**
|
|
33
|
-
* Complete agent operation and
|
|
26
|
+
* Complete an agent operation and return validation result
|
|
34
27
|
*/
|
|
35
|
-
async completeAgentOperation(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
startTime: validationContext.startTime,
|
|
50
|
-
endTime: Date.now(),
|
|
51
|
-
operation: validationContext.operation,
|
|
52
|
-
query: metadata.additionalContext?.query,
|
|
53
|
-
codebaseId: metadata.additionalContext?.codebaseId,
|
|
54
|
-
traces: [],
|
|
55
|
-
}, agentFeedbackManager.getFeedbackForRun(validationContext.runId) || undefined, validationContext.agentName);
|
|
56
|
-
// Update summary with metadata if available
|
|
57
|
-
if (metadata.filesChanged) {
|
|
58
|
-
summary.filesChanged = metadata.filesChanged;
|
|
28
|
+
async completeAgentOperation(context, result, options) {
|
|
29
|
+
const endTime = Date.now();
|
|
30
|
+
const duration = endTime - context.startTime;
|
|
31
|
+
const opts = options || {};
|
|
32
|
+
// Basic validation
|
|
33
|
+
const issues = [];
|
|
34
|
+
const warnings = [];
|
|
35
|
+
// Check validation checks
|
|
36
|
+
if (opts.validationChecks) {
|
|
37
|
+
for (const check of opts.validationChecks) {
|
|
38
|
+
if (!check.passed) {
|
|
39
|
+
issues.push(check.message || check.check);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
59
42
|
}
|
|
60
|
-
|
|
61
|
-
|
|
43
|
+
// Check errors
|
|
44
|
+
if (opts.errors && opts.errors.length > 0) {
|
|
45
|
+
issues.push(...opts.errors.map((e) => typeof e === 'string' ? e : e.message || String(e)));
|
|
62
46
|
}
|
|
63
|
-
|
|
64
|
-
|
|
47
|
+
// Check warnings
|
|
48
|
+
if (opts.warnings && opts.warnings.length > 0) {
|
|
49
|
+
warnings.push(...opts.warnings.map((w) => typeof w === 'string' ? w : w.message || String(w)));
|
|
65
50
|
}
|
|
66
|
-
|
|
67
|
-
|
|
51
|
+
// Check outcome
|
|
52
|
+
if (opts.outcome === 'failure') {
|
|
53
|
+
issues.push('Operation failed');
|
|
68
54
|
}
|
|
69
|
-
if (
|
|
70
|
-
|
|
55
|
+
else if (opts.outcome === 'partial_success') {
|
|
56
|
+
warnings.push('Operation partially succeeded');
|
|
71
57
|
}
|
|
58
|
+
// Check overallSuccess in result
|
|
59
|
+
if (result && result.overallSuccess === false) {
|
|
60
|
+
issues.push('Overall operation was not successful');
|
|
61
|
+
}
|
|
62
|
+
// Get runId from execution tracer
|
|
63
|
+
const runId = executionTracer.getCurrentRunId();
|
|
64
|
+
// Generate feedbackId
|
|
65
|
+
const feedbackId = randomUUID();
|
|
66
|
+
// Collect files affected
|
|
67
|
+
const filesAffected = [];
|
|
68
|
+
if (opts.filesChanged)
|
|
69
|
+
filesAffected.push(...opts.filesChanged);
|
|
70
|
+
if (opts.filesCreated)
|
|
71
|
+
filesAffected.push(...opts.filesCreated);
|
|
72
|
+
if (opts.filesDeleted)
|
|
73
|
+
filesAffected.push(...opts.filesDeleted);
|
|
74
|
+
// Create trace summary
|
|
75
|
+
const summaryData = {
|
|
76
|
+
runId: runId || `run-${Date.now()}`,
|
|
77
|
+
agentName: context.agentName,
|
|
78
|
+
operation: context.operation,
|
|
79
|
+
startTime: context.startTime,
|
|
80
|
+
endTime,
|
|
81
|
+
success: issues.length === 0,
|
|
82
|
+
filesAffected: filesAffected.length > 0 ? filesAffected : undefined,
|
|
83
|
+
error: issues.length > 0 ? issues.join('; ') : undefined,
|
|
84
|
+
metadata: {
|
|
85
|
+
...context.metadata,
|
|
86
|
+
duration,
|
|
87
|
+
validationChecks: opts.validationChecks?.length || 0,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
const summary = new TraceSummary(summaryData);
|
|
72
91
|
return {
|
|
73
|
-
|
|
92
|
+
passed: issues.length === 0,
|
|
93
|
+
issues: issues.length > 0 ? issues : undefined,
|
|
94
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
95
|
+
score: issues.length === 0 ? 1.0 : Math.max(0, 1.0 - (issues.length * 0.2)),
|
|
74
96
|
summary,
|
|
75
97
|
feedbackId,
|
|
76
|
-
runId
|
|
98
|
+
runId,
|
|
77
99
|
};
|
|
78
|
-
}
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* Trace an operation step
|
|
103
|
+
*/
|
|
104
|
+
trace(data) {
|
|
105
|
+
// In alpha, tracing is a no-op
|
|
106
|
+
// Can be enhanced later to log to execution tracer
|
|
107
|
+
},
|
|
79
108
|
/**
|
|
80
|
-
*
|
|
109
|
+
* Validate agent output
|
|
81
110
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
111
|
+
validate(output, context) {
|
|
112
|
+
// Basic validation - can be enhanced later
|
|
113
|
+
if (!output) {
|
|
114
|
+
return {
|
|
115
|
+
passed: false,
|
|
116
|
+
issues: ['Output is empty'],
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
passed: true,
|
|
121
|
+
score: 1.0,
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* Check trust score for an agent
|
|
126
|
+
*/
|
|
127
|
+
checkTrust(agentName, operation) {
|
|
128
|
+
// In alpha, default to passing
|
|
129
|
+
// Can be enhanced later with actual trust score tracking
|
|
130
|
+
return {
|
|
131
|
+
passed: true,
|
|
132
|
+
trustScore: 1.0,
|
|
133
|
+
threshold: 0.7,
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
};
|
|
88
137
|
//# sourceMappingURL=agent-validation-helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-validation-helper.js","sourceRoot":"","sources":["../../../src/infrastructure/validation/agent-validation-helper.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agent-validation-helper.js","sourceRoot":"","sources":["../../../src/infrastructure/validation/agent-validation-helper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAyB,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAmCpC;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC;;OAEG;IACH,mBAAmB,CACjB,SAAiB,EACjB,SAAiB,EACjB,QAA8B;QAE9B,OAAO;YACL,SAAS;YACT,SAAS;YACT,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,QAAQ;SACT,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,sBAAsB,CAC1B,OAA0B,EAC1B,MAAkC,EAClC,OAaC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;QAC7C,MAAM,IAAI,GAAG,OAAO,IAAI,EAAE,CAAC;QAE3B,mBAAmB;QACnB,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,0BAA0B;QAC1B,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC1B,KAAK,MAAM,KAAK,IAAI,IAAI,CA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pha.0
|
|
4
6
|
*/
|
|
5
|
-
import type { TraceSummary } from './trace-summary.js';
|
|
6
7
|
export interface ReviewDecision {
|
|
7
8
|
approved: boolean;
|
|
8
9
|
proceed: boolean;
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
userAction: 'approved' | 'rejected' | 'not_required' | 'cancelled';
|
|
11
|
+
comment?: string;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
|
-
* Review
|
|
14
|
-
* Manages the review flow when --review flag is enabled
|
|
14
|
+
* Review handler instance
|
|
15
15
|
*/
|
|
16
|
-
export declare
|
|
17
|
-
/**
|
|
18
|
-
* Request user review before proceeding
|
|
19
|
-
*/
|
|
20
|
-
requestReview(summary: TraceSummary, options?: {
|
|
21
|
-
timeout?: number;
|
|
22
|
-
defaultAction?: 'approve' | 'reject';
|
|
23
|
-
}): Promise<ReviewDecision>;
|
|
16
|
+
export declare const reviewHandler: {
|
|
24
17
|
/**
|
|
25
|
-
*
|
|
18
|
+
* Request review from user
|
|
26
19
|
*/
|
|
27
|
-
|
|
20
|
+
requestReview(summary: string): Promise<ReviewDecision>;
|
|
28
21
|
/**
|
|
29
|
-
*
|
|
22
|
+
* Get review decision (with optional review requested flag)
|
|
30
23
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* Get review decision - single source of truth for userAction
|
|
34
|
-
*
|
|
35
|
-
* This method is the ONLY place where userAction is determined.
|
|
36
|
-
* All CLI commands must use this method and trust its userAction value.
|
|
37
|
-
*
|
|
38
|
-
* Logic:
|
|
39
|
-
* 1. If reviewRequested === false:
|
|
40
|
-
* → userAction = 'not_required'
|
|
41
|
-
*
|
|
42
|
-
* 2. If reviewRequested === true and shouldReview === false:
|
|
43
|
-
* → userAction = 'approved' (user explicitly requested review, treat as approved)
|
|
44
|
-
*
|
|
45
|
-
* 3. If reviewRequested === true and shouldReview === true:
|
|
46
|
-
* → Call requestReview() which handles:
|
|
47
|
-
* - Interactive mode: prompt user, return 'approved' or 'rejected'
|
|
48
|
-
* - Non-interactive + auto-approve: return 'approved'
|
|
49
|
-
* - Non-interactive + no auto-approve: return 'rejected'
|
|
50
|
-
*/
|
|
51
|
-
getReviewDecision(summary: TraceSummary, reviewRequested: boolean): Promise<ReviewDecision>;
|
|
52
|
-
}
|
|
53
|
-
export declare const reviewHandler: ReviewHandler;
|
|
24
|
+
getReviewDecision(summary: string, reviewRequested: boolean): Promise<ReviewDecision>;
|
|
25
|
+
};
|
|
54
26
|
//# sourceMappingURL=review-handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-handler.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/validation/review-handler.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"review-handler.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/validation/review-handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,UAAU,GAAG,UAAU,GAAG,cAAc,GAAG,WAAW,CAAC;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;2BAC0B,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAc7D;;OAEG;+BAEQ,MAAM,mBACE,OAAO,GACvB,OAAO,CAAC,cAAc,CAAC;CAW3B,CAAC"}
|
|
@@ -1,176 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Handles
|
|
2
|
+
* Review Handler
|
|
3
|
+
* Handles review requests and decisions
|
|
4
|
+
*
|
|
5
|
+
* Phase 1: v0.5.0-alpha.0
|
|
4
6
|
*/
|
|
5
|
-
import * as readline from 'readline';
|
|
6
|
-
import { colors, newline, separator } from '../../ui.js';
|
|
7
|
-
import { traceSummaryFormatter } from './trace-summary.js';
|
|
8
7
|
/**
|
|
9
|
-
* Review
|
|
10
|
-
* Manages the review flow when --review flag is enabled
|
|
8
|
+
* Review handler instance
|
|
11
9
|
*/
|
|
12
|
-
export
|
|
13
|
-
/**
|
|
14
|
-
* Request user review before proceeding
|
|
15
|
-
*/
|
|
16
|
-
async requestReview(summary, options = {}) {
|
|
17
|
-
// TODO: Update task review metadata
|
|
18
|
-
// When review is requested: set task.reviewStatus = PENDING
|
|
19
|
-
// When review is completed: set task.reviewStatus, task.reviewedAt, task.reviewComments
|
|
20
|
-
// Update task.status: NEEDS_REVIEW → APPROVED/REJECTED
|
|
21
|
-
// See: docs/ARCHITECTURE/TASK_MODEL.md
|
|
22
|
-
// Display summary
|
|
23
|
-
const summaryText = traceSummaryFormatter.formatSummary(summary);
|
|
24
|
-
console.log('\n' + summaryText);
|
|
25
|
-
newline();
|
|
26
|
-
// Check if we should skip review in non-interactive mode
|
|
27
|
-
if (!process.stdin.isTTY) {
|
|
28
|
-
const autoApprove = process.env.CODEHERE_AUTO_APPROVE === 'true' ||
|
|
29
|
-
process.env.CODEHERE_REVIEW_SKIP === 'true';
|
|
30
|
-
if (autoApprove) {
|
|
31
|
-
console.log(colors.yellow('⚠️ Non-interactive mode: Auto-approving changes (CODEHERE_AUTO_APPROVE=true)'));
|
|
32
|
-
return {
|
|
33
|
-
approved: true,
|
|
34
|
-
proceed: true,
|
|
35
|
-
reason: 'auto-approved (non-interactive mode)',
|
|
36
|
-
userAction: 'approved',
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
console.log(colors.red('❌ Non-interactive mode: Review required but cannot prompt for input.'));
|
|
40
|
-
console.log(colors.yellow(' Set CODEHERE_AUTO_APPROVE=true to auto-approve, or run in interactive mode.'));
|
|
41
|
-
return {
|
|
42
|
-
approved: false,
|
|
43
|
-
proceed: false,
|
|
44
|
-
reason: 'non-interactive mode, review required',
|
|
45
|
-
userAction: 'rejected',
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
// Prompt for approval
|
|
49
|
-
console.log(separator('─', 80));
|
|
50
|
-
console.log(colors.bold('Review Required'));
|
|
51
|
-
console.log(separator('─', 80));
|
|
52
|
-
if (summary.reviewNeeded.riskLevel) {
|
|
53
|
-
const riskColor = {
|
|
54
|
-
low: colors.cyan,
|
|
55
|
-
medium: colors.yellow,
|
|
56
|
-
high: colors.red,
|
|
57
|
-
critical: colors.red.bold,
|
|
58
|
-
}[summary.reviewNeeded.riskLevel];
|
|
59
|
-
console.log(riskColor(`Risk Level: ${summary.reviewNeeded.riskLevel.toUpperCase()}`));
|
|
60
|
-
newline();
|
|
61
|
-
}
|
|
62
|
-
const decision = await this.promptApproval(options.timeout || 0, options.defaultAction);
|
|
63
|
-
newline();
|
|
64
|
-
if (decision.approved) {
|
|
65
|
-
console.log(colors.green('✓ Changes approved. Proceeding...'));
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
console.log(colors.red('✗ Changes rejected. Cancelling operation.'));
|
|
69
|
-
}
|
|
70
|
-
return decision;
|
|
71
|
-
}
|
|
10
|
+
export const reviewHandler = {
|
|
72
11
|
/**
|
|
73
|
-
*
|
|
12
|
+
* Request review from user
|
|
74
13
|
*/
|
|
75
|
-
async
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
approved: true,
|
|
88
|
-
proceed: true,
|
|
89
|
-
userAction: 'approved',
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
else if (normalized === 'no' || normalized === 'n') {
|
|
93
|
-
resolve({
|
|
94
|
-
approved: false,
|
|
95
|
-
proceed: false,
|
|
96
|
-
reason: 'user rejected',
|
|
97
|
-
userAction: 'rejected',
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
// Invalid input, ask again
|
|
102
|
-
console.log(colors.yellow('Please enter "yes" or "no"'));
|
|
103
|
-
prompt();
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
// Handle timeout
|
|
108
|
-
if (timeout > 0) {
|
|
109
|
-
setTimeout(() => {
|
|
110
|
-
if (rl) {
|
|
111
|
-
rl.close();
|
|
112
|
-
}
|
|
113
|
-
const action = defaultAction || 'reject';
|
|
114
|
-
resolve({
|
|
115
|
-
approved: action === 'approve',
|
|
116
|
-
proceed: action === 'approve',
|
|
117
|
-
reason: `timeout (default: ${action})`,
|
|
118
|
-
userAction: action === 'approve' ? 'approved' : 'rejected',
|
|
119
|
-
});
|
|
120
|
-
if (action === 'approve') {
|
|
121
|
-
console.log(colors.yellow(`\n⏱ Timeout: Auto-approving (default action: ${action})`));
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
console.log(colors.yellow(`\n⏱ Timeout: Auto-rejecting (default action: ${action})`));
|
|
125
|
-
}
|
|
126
|
-
}, timeout);
|
|
127
|
-
}
|
|
128
|
-
prompt();
|
|
129
|
-
});
|
|
130
|
-
}
|
|
14
|
+
async requestReview(summary) {
|
|
15
|
+
// In alpha, auto-approve for non-interactive mode
|
|
16
|
+
// Can be enhanced later with interactive prompts
|
|
17
|
+
console.log('\n📋 Review Request:');
|
|
18
|
+
console.log(summary);
|
|
19
|
+
console.log('\n[Auto-approved in alpha mode]');
|
|
20
|
+
return {
|
|
21
|
+
approved: true,
|
|
22
|
+
proceed: true,
|
|
23
|
+
userAction: 'approved',
|
|
24
|
+
};
|
|
25
|
+
},
|
|
131
26
|
/**
|
|
132
|
-
*
|
|
133
|
-
*/
|
|
134
|
-
shouldRequireReview(summary) {
|
|
135
|
-
// Always require review if explicitly flagged
|
|
136
|
-
if (summary.reviewNeeded.required) {
|
|
137
|
-
return true;
|
|
138
|
-
}
|
|
139
|
-
// Require review for high/critical risk
|
|
140
|
-
if (summary.reviewNeeded.riskLevel === 'high' || summary.reviewNeeded.riskLevel === 'critical') {
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
// Require review if files changed
|
|
144
|
-
if (summary.filesChanged.length > 0 || summary.filesCreated.length > 0) {
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
// Require review if errors occurred
|
|
148
|
-
if (summary.errors && summary.errors.length > 0) {
|
|
149
|
-
return true;
|
|
150
|
-
}
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Get review decision - single source of truth for userAction
|
|
155
|
-
*
|
|
156
|
-
* This method is the ONLY place where userAction is determined.
|
|
157
|
-
* All CLI commands must use this method and trust its userAction value.
|
|
158
|
-
*
|
|
159
|
-
* Logic:
|
|
160
|
-
* 1. If reviewRequested === false:
|
|
161
|
-
* → userAction = 'not_required'
|
|
162
|
-
*
|
|
163
|
-
* 2. If reviewRequested === true and shouldReview === false:
|
|
164
|
-
* → userAction = 'approved' (user explicitly requested review, treat as approved)
|
|
165
|
-
*
|
|
166
|
-
* 3. If reviewRequested === true and shouldReview === true:
|
|
167
|
-
* → Call requestReview() which handles:
|
|
168
|
-
* - Interactive mode: prompt user, return 'approved' or 'rejected'
|
|
169
|
-
* - Non-interactive + auto-approve: return 'approved'
|
|
170
|
-
* - Non-interactive + no auto-approve: return 'rejected'
|
|
27
|
+
* Get review decision (with optional review requested flag)
|
|
171
28
|
*/
|
|
172
29
|
async getReviewDecision(summary, reviewRequested) {
|
|
173
|
-
// Case 1: Review not requested → not_required
|
|
174
30
|
if (!reviewRequested) {
|
|
175
31
|
return {
|
|
176
32
|
approved: true,
|
|
@@ -178,29 +34,7 @@ export class ReviewHandler {
|
|
|
178
34
|
userAction: 'not_required',
|
|
179
35
|
};
|
|
180
36
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
// Case 3: Review is required - call requestReview which handles auto-approve
|
|
185
|
-
return await this.requestReview(summary);
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
// Case 2: Review was requested but not required (e.g., no file changes)
|
|
189
|
-
// User explicitly passed --review, so treat as approved
|
|
190
|
-
// Note: autoApprove is checked here for logging purposes, but userAction is always 'approved'
|
|
191
|
-
const autoApprove = process.env.CODEHERE_AUTO_APPROVE === 'true' ||
|
|
192
|
-
process.env.CODEHERE_REVIEW_SKIP === 'true';
|
|
193
|
-
return {
|
|
194
|
-
approved: true,
|
|
195
|
-
proceed: true,
|
|
196
|
-
reason: autoApprove
|
|
197
|
-
? 'review requested but not required, auto-approved'
|
|
198
|
-
: 'review requested but not required',
|
|
199
|
-
userAction: 'approved',
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
// Singleton instance
|
|
205
|
-
export const reviewHandler = new ReviewHandler();
|
|
37
|
+
return this.requestReview(summary);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
206
40
|
//# sourceMappingURL=review-handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-handler.js","sourceRoot":"","sources":["../../../src/infrastructure/validation/review-handler.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"review-handler.js","sourceRoot":"","sources":["../../../src/infrastructure/validation/review-handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,OAAe;QACjC,kDAAkD;QAClD,iDAAiD;QACjD,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;QAE/C,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,UAAU;SACvB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAiB,CACrB,OAAe,EACf,eAAwB;QAExB,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,IAAI;gBACb,UAAU,EAAE,cAAc;aAC3B,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACF,CAAC"}
|
|
@@ -1,42 +1,45 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Merges multiple
|
|
4
|
-
*
|
|
2
|
+
* Summary Aggregator
|
|
3
|
+
* Merges multiple trace summaries into a composite summary
|
|
4
|
+
*
|
|
5
|
+
* Phase 1: v0.5.0-alpha.0
|
|
5
6
|
*/
|
|
6
7
|
import type { TraceSummary } from './trace-summary.js';
|
|
7
8
|
export interface CompositeSummary {
|
|
8
9
|
runId: string;
|
|
9
10
|
operation: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
reasoningSteps: TraceSummary['reasoningSteps'];
|
|
15
|
-
validationChecks: TraceSummary['validationChecks'];
|
|
16
|
-
metrics: TraceSummary['metrics'];
|
|
17
|
-
reviewNeeded: TraceSummary['reviewNeeded'];
|
|
18
|
-
outcome: TraceSummary['outcome'];
|
|
19
|
-
errors?: string[];
|
|
20
|
-
warnings?: string[];
|
|
21
|
-
agentSummaries: Array<{
|
|
11
|
+
agents: string[];
|
|
12
|
+
totalDuration: number;
|
|
13
|
+
success: boolean;
|
|
14
|
+
summaries: Array<{
|
|
22
15
|
agent: string;
|
|
23
|
-
runId: string;
|
|
24
16
|
summary: TraceSummary;
|
|
17
|
+
runId?: string;
|
|
25
18
|
}>;
|
|
26
|
-
|
|
19
|
+
filesAffected: string[];
|
|
20
|
+
filesChanged?: string[];
|
|
21
|
+
filesCreated?: string[];
|
|
22
|
+
filesDeleted?: string[];
|
|
23
|
+
errors: string[];
|
|
24
|
+
warnings?: string[];
|
|
25
|
+
validationChecks?: any[];
|
|
26
|
+
metrics?: Record<string, any>;
|
|
27
|
+
startTime: number;
|
|
28
|
+
endTime?: number;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
|
-
*
|
|
31
|
+
* Summary aggregator instance
|
|
30
32
|
*/
|
|
31
|
-
|
|
33
|
+
declare class SummaryAggregatorImpl {
|
|
32
34
|
/**
|
|
33
|
-
* Merge multiple summaries into a composite summary
|
|
35
|
+
* Merge multiple trace summaries into a composite summary
|
|
34
36
|
*/
|
|
35
|
-
mergeSummaries(
|
|
37
|
+
mergeSummaries(agentSummaries: Array<{
|
|
36
38
|
agent: string;
|
|
37
39
|
summary: TraceSummary;
|
|
38
40
|
runId?: string;
|
|
39
41
|
}>, unifiedRunId: string, operation: string): CompositeSummary;
|
|
40
42
|
}
|
|
41
|
-
export declare const summaryAggregator:
|
|
43
|
+
export declare const summaryAggregator: SummaryAggregatorImpl;
|
|
44
|
+
export {};
|
|
42
45
|
//# sourceMappingURL=summary-aggregator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary-aggregator.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/validation/summary-aggregator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"summary-aggregator.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/validation/summary-aggregator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,KAAK,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,YAAY,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;IACH,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,gBAAgB,CAAC,EAAE,GAAG,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,cAAM,qBAAqB;IACzB;;OAEG;IACH,cAAc,CACZ,cAAc,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,YAAY,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAC/E,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,GAChB,gBAAgB;CA+DpB;AAED,eAAO,MAAM,iBAAiB,uBAA8B,CAAC"}
|