codehere 0.3.0 → 0.4.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.
Potentially problematic release.
This version of codehere might be problematic. Click here for more details.
- package/README.md +223 -42
- package/dist/application/agents/documentation-agent.d.ts +24 -0
- package/dist/application/agents/documentation-agent.d.ts.map +1 -0
- package/dist/application/agents/documentation-agent.js +399 -0
- package/dist/application/agents/documentation-agent.js.map +1 -0
- package/dist/application/agents/execution-agent.d.ts +11 -0
- package/dist/application/agents/execution-agent.d.ts.map +1 -1
- package/dist/application/agents/execution-agent.js +289 -80
- package/dist/application/agents/execution-agent.js.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.d.ts +3 -0
- package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.js +86 -0
- package/dist/application/agents/multi-agent-orchestrator.js.map +1 -1
- package/dist/application/agents/planning-agent.d.ts +3 -0
- package/dist/application/agents/planning-agent.d.ts.map +1 -1
- package/dist/application/agents/planning-agent.js +132 -64
- package/dist/application/agents/planning-agent.js.map +1 -1
- package/dist/application/agents/product-requirements-agent.d.ts +21 -0
- package/dist/application/agents/product-requirements-agent.d.ts.map +1 -0
- package/dist/application/agents/product-requirements-agent.js +247 -0
- package/dist/application/agents/product-requirements-agent.js.map +1 -0
- package/dist/application/agents/validation-agent.d.ts +5 -1
- package/dist/application/agents/validation-agent.d.ts.map +1 -1
- package/dist/application/agents/validation-agent.js +156 -21
- package/dist/application/agents/validation-agent.js.map +1 -1
- package/dist/application/services/dependency-container.d.ts +22 -2
- package/dist/application/services/dependency-container.d.ts.map +1 -1
- package/dist/application/services/dependency-container.js +144 -6
- package/dist/application/services/dependency-container.js.map +1 -1
- package/dist/application/services/intelligent-router.d.ts +13 -0
- package/dist/application/services/intelligent-router.d.ts.map +1 -1
- package/dist/application/services/intelligent-router.js +300 -87
- package/dist/application/services/intelligent-router.js.map +1 -1
- package/dist/application/use-cases/ask-question-use-case.d.ts +19 -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 +125 -46
- package/dist/application/use-cases/ask-question-use-case.js.map +1 -1
- package/dist/application/use-cases/edit-file-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/edit-file-use-case.js +16 -1
- package/dist/application/use-cases/edit-file-use-case.js.map +1 -1
- package/dist/domain/entities/documentation.d.ts +35 -0
- package/dist/domain/entities/documentation.d.ts.map +1 -0
- package/dist/domain/entities/documentation.js +6 -0
- package/dist/domain/entities/documentation.js.map +1 -0
- package/dist/domain/entities/product-requirements.d.ts +50 -0
- package/dist/domain/entities/product-requirements.d.ts.map +1 -0
- package/dist/domain/entities/product-requirements.js +6 -0
- package/dist/domain/entities/product-requirements.js.map +1 -0
- package/dist/domain/entities/task.d.ts +152 -0
- package/dist/domain/entities/task.d.ts.map +1 -0
- package/dist/domain/entities/task.js +61 -0
- package/dist/domain/entities/task.js.map +1 -0
- package/dist/domain/interfaces/agent.interface.d.ts +15 -0
- package/dist/domain/interfaces/agent.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/agent.interface.js +6 -0
- package/dist/domain/interfaces/agent.interface.js.map +1 -0
- package/dist/domain/services/environment-mode-manager.d.ts +18 -0
- package/dist/domain/services/environment-mode-manager.d.ts.map +1 -0
- package/dist/domain/services/environment-mode-manager.js +37 -0
- package/dist/domain/services/environment-mode-manager.js.map +1 -0
- package/dist/domain/services/risk-tier-detector.d.ts +18 -0
- package/dist/domain/services/risk-tier-detector.d.ts.map +1 -0
- package/dist/domain/services/risk-tier-detector.js +65 -0
- package/dist/domain/services/risk-tier-detector.js.map +1 -0
- package/dist/formatter.d.ts.map +1 -1
- package/dist/formatter.js +10 -3
- package/dist/formatter.js.map +1 -1
- package/dist/index.js +103 -129
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.d.ts.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.js +15 -2
- package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -1
- package/dist/infrastructure/ai/fake-ai-service.d.ts +22 -0
- package/dist/infrastructure/ai/fake-ai-service.d.ts.map +1 -0
- package/dist/infrastructure/ai/fake-ai-service.js +59 -0
- package/dist/infrastructure/ai/fake-ai-service.js.map +1 -0
- package/dist/infrastructure/ai/provider-ai-service.d.ts +59 -0
- package/dist/infrastructure/ai/provider-ai-service.d.ts.map +1 -0
- package/dist/infrastructure/ai/provider-ai-service.js +477 -0
- package/dist/infrastructure/ai/provider-ai-service.js.map +1 -0
- package/dist/infrastructure/cache/embedding-cache.d.ts +13 -1
- package/dist/infrastructure/cache/embedding-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/embedding-cache.js +80 -9
- package/dist/infrastructure/cache/embedding-cache.js.map +1 -1
- package/dist/infrastructure/cache/response-cache.d.ts +86 -0
- package/dist/infrastructure/cache/response-cache.d.ts.map +1 -0
- package/dist/infrastructure/cache/response-cache.js +224 -0
- package/dist/infrastructure/cache/response-cache.js.map +1 -0
- package/dist/infrastructure/context/conversation-context.d.ts +58 -0
- package/dist/infrastructure/context/conversation-context.d.ts.map +1 -0
- package/dist/infrastructure/context/conversation-context.js +170 -0
- package/dist/infrastructure/context/conversation-context.js.map +1 -0
- package/dist/infrastructure/context/session-manager.d.ts +26 -0
- package/dist/infrastructure/context/session-manager.d.ts.map +1 -0
- package/dist/infrastructure/context/session-manager.js +98 -0
- package/dist/infrastructure/context/session-manager.js.map +1 -0
- package/dist/infrastructure/cost/cost-tracker.d.ts +1 -0
- package/dist/infrastructure/cost/cost-tracker.d.ts.map +1 -1
- package/dist/infrastructure/cost/cost-tracker.js +12 -5
- package/dist/infrastructure/cost/cost-tracker.js.map +1 -1
- package/dist/infrastructure/governance/nist-ai-rmf.d.ts +6 -8
- package/dist/infrastructure/governance/nist-ai-rmf.d.ts.map +1 -1
- package/dist/infrastructure/governance/nist-ai-rmf.js +6 -8
- package/dist/infrastructure/governance/nist-ai-rmf.js.map +1 -1
- package/dist/infrastructure/governance/policy-as-code.d.ts +6 -8
- package/dist/infrastructure/governance/policy-as-code.d.ts.map +1 -1
- package/dist/infrastructure/governance/policy-as-code.js +6 -8
- package/dist/infrastructure/governance/policy-as-code.js.map +1 -1
- package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts +7 -9
- package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts.map +1 -1
- package/dist/infrastructure/governance/prompt-to-code-lineage.js +7 -9
- package/dist/infrastructure/governance/prompt-to-code-lineage.js.map +1 -1
- package/dist/infrastructure/providers/cohere-provider.d.ts +39 -0
- package/dist/infrastructure/providers/cohere-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/cohere-provider.js +359 -0
- package/dist/infrastructure/providers/cohere-provider.js.map +1 -0
- package/dist/infrastructure/providers/fake-provider.d.ts +43 -0
- package/dist/infrastructure/providers/fake-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/fake-provider.js +130 -0
- package/dist/infrastructure/providers/fake-provider.js.map +1 -0
- package/dist/infrastructure/providers/local-llm-provider.d.ts +49 -0
- package/dist/infrastructure/providers/local-llm-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/local-llm-provider.js +330 -0
- package/dist/infrastructure/providers/local-llm-provider.js.map +1 -0
- package/dist/infrastructure/providers/model-config.types.d.ts +70 -0
- package/dist/infrastructure/providers/model-config.types.d.ts.map +1 -0
- package/dist/infrastructure/providers/model-config.types.js +9 -0
- package/dist/infrastructure/providers/model-config.types.js.map +1 -0
- package/dist/infrastructure/providers/model-provider.interface.d.ts +113 -0
- package/dist/infrastructure/providers/model-provider.interface.d.ts.map +1 -0
- package/dist/infrastructure/providers/model-provider.interface.js +8 -0
- package/dist/infrastructure/providers/model-provider.interface.js.map +1 -0
- package/dist/infrastructure/providers/openai-provider.d.ts +38 -0
- package/dist/infrastructure/providers/openai-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/openai-provider.js +413 -0
- package/dist/infrastructure/providers/openai-provider.js.map +1 -0
- package/dist/infrastructure/providers/operation-provider-resolver.d.ts +48 -0
- package/dist/infrastructure/providers/operation-provider-resolver.d.ts.map +1 -0
- package/dist/infrastructure/providers/operation-provider-resolver.js +105 -0
- package/dist/infrastructure/providers/operation-provider-resolver.js.map +1 -0
- package/dist/infrastructure/providers/provider-config-loader.d.ts +37 -0
- package/dist/infrastructure/providers/provider-config-loader.d.ts.map +1 -0
- package/dist/infrastructure/providers/provider-config-loader.js +120 -0
- package/dist/infrastructure/providers/provider-config-loader.js.map +1 -0
- package/dist/infrastructure/providers/provider-registry.d.ts +53 -0
- package/dist/infrastructure/providers/provider-registry.d.ts.map +1 -0
- package/dist/infrastructure/providers/provider-registry.js +88 -0
- package/dist/infrastructure/providers/provider-registry.js.map +1 -0
- package/dist/infrastructure/storage/task-helpers.d.ts +58 -0
- package/dist/infrastructure/storage/task-helpers.d.ts.map +1 -0
- package/dist/infrastructure/storage/task-helpers.js +157 -0
- package/dist/infrastructure/storage/task-helpers.js.map +1 -0
- package/dist/infrastructure/storage/task-repository.d.ts +67 -0
- package/dist/infrastructure/storage/task-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/task-repository.js +205 -0
- package/dist/infrastructure/storage/task-repository.js.map +1 -0
- package/dist/infrastructure/ux/bi-directional-learning.d.ts +22 -0
- package/dist/infrastructure/ux/bi-directional-learning.d.ts.map +1 -1
- package/dist/infrastructure/ux/bi-directional-learning.js +144 -7
- package/dist/infrastructure/ux/bi-directional-learning.js.map +1 -1
- package/dist/infrastructure/ux/capability-boundaries.d.ts +50 -0
- package/dist/infrastructure/ux/capability-boundaries.d.ts.map +1 -0
- package/dist/infrastructure/ux/capability-boundaries.js +167 -0
- package/dist/infrastructure/ux/capability-boundaries.js.map +1 -0
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts +63 -0
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts.map +1 -0
- package/dist/infrastructure/ux/comprehensive-formatter.js +212 -0
- package/dist/infrastructure/ux/comprehensive-formatter.js.map +1 -0
- package/dist/infrastructure/ux/feedback-prompt.d.ts +42 -0
- package/dist/infrastructure/ux/feedback-prompt.d.ts.map +1 -0
- package/dist/infrastructure/ux/feedback-prompt.js +181 -0
- package/dist/infrastructure/ux/feedback-prompt.js.map +1 -0
- package/dist/infrastructure/ux/hitl-review-portal.d.ts.map +1 -1
- package/dist/infrastructure/ux/hitl-review-portal.js +4 -1
- package/dist/infrastructure/ux/hitl-review-portal.js.map +1 -1
- package/dist/infrastructure/ux/hitl-validation.d.ts +35 -0
- package/dist/infrastructure/ux/hitl-validation.d.ts.map +1 -1
- package/dist/infrastructure/ux/hitl-validation.js +86 -0
- package/dist/infrastructure/ux/hitl-validation.js.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.d.ts +2 -1
- package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.js +13 -3
- package/dist/infrastructure/ux/progress-indicator.js.map +1 -1
- package/dist/infrastructure/ux/proportional-friction.d.ts +73 -0
- package/dist/infrastructure/ux/proportional-friction.d.ts.map +1 -0
- package/dist/infrastructure/ux/proportional-friction.js +200 -0
- package/dist/infrastructure/ux/proportional-friction.js.map +1 -0
- package/dist/infrastructure/validation/agent-feedback.d.ts +115 -0
- package/dist/infrastructure/validation/agent-feedback.d.ts.map +1 -0
- package/dist/infrastructure/validation/agent-feedback.js +227 -0
- package/dist/infrastructure/validation/agent-feedback.js.map +1 -0
- package/dist/infrastructure/validation/agent-validation-helper.d.ts +75 -0
- package/dist/infrastructure/validation/agent-validation-helper.d.ts.map +1 -0
- package/dist/infrastructure/validation/agent-validation-helper.js +88 -0
- package/dist/infrastructure/validation/agent-validation-helper.js.map +1 -0
- package/dist/infrastructure/validation/feedback-stats.d.ts +99 -0
- package/dist/infrastructure/validation/feedback-stats.d.ts.map +1 -0
- package/dist/infrastructure/validation/feedback-stats.js +173 -0
- package/dist/infrastructure/validation/feedback-stats.js.map +1 -0
- package/dist/infrastructure/validation/review-handler.d.ts +54 -0
- package/dist/infrastructure/validation/review-handler.d.ts.map +1 -0
- package/dist/infrastructure/validation/review-handler.js +206 -0
- package/dist/infrastructure/validation/review-handler.js.map +1 -0
- package/dist/infrastructure/validation/summary-aggregator.d.ts +42 -0
- package/dist/infrastructure/validation/summary-aggregator.d.ts.map +1 -0
- package/dist/infrastructure/validation/summary-aggregator.js +156 -0
- package/dist/infrastructure/validation/summary-aggregator.js.map +1 -0
- package/dist/infrastructure/validation/summary-extractor.d.ts +59 -0
- package/dist/infrastructure/validation/summary-extractor.d.ts.map +1 -0
- package/dist/infrastructure/validation/summary-extractor.js +102 -0
- package/dist/infrastructure/validation/summary-extractor.js.map +1 -0
- package/dist/infrastructure/validation/trace-summary.d.ts +72 -0
- package/dist/infrastructure/validation/trace-summary.d.ts.map +1 -0
- package/dist/infrastructure/validation/trace-summary.js +371 -0
- package/dist/infrastructure/validation/trace-summary.js.map +1 -0
- package/dist/infrastructure/validation/trust-config.d.ts +27 -0
- package/dist/infrastructure/validation/trust-config.d.ts.map +1 -0
- package/dist/infrastructure/validation/trust-config.js +113 -0
- package/dist/infrastructure/validation/trust-config.js.map +1 -0
- package/dist/infrastructure/xai/attention-visualizer.d.ts +6 -8
- package/dist/infrastructure/xai/attention-visualizer.d.ts.map +1 -1
- package/dist/infrastructure/xai/attention-visualizer.js +6 -8
- package/dist/infrastructure/xai/attention-visualizer.js.map +1 -1
- package/dist/infrastructure/xai/cot-visualizer.d.ts +6 -9
- package/dist/infrastructure/xai/cot-visualizer.d.ts.map +1 -1
- package/dist/infrastructure/xai/cot-visualizer.js +6 -9
- package/dist/infrastructure/xai/cot-visualizer.js.map +1 -1
- package/dist/infrastructure/xai/decision-tree-log.d.ts +6 -10
- package/dist/infrastructure/xai/decision-tree-log.d.ts.map +1 -1
- package/dist/infrastructure/xai/decision-tree-log.js +6 -10
- package/dist/infrastructure/xai/decision-tree-log.js.map +1 -1
- package/dist/infrastructure/xai/interactive-xai.d.ts +6 -8
- package/dist/infrastructure/xai/interactive-xai.d.ts.map +1 -1
- package/dist/infrastructure/xai/interactive-xai.js +6 -8
- package/dist/infrastructure/xai/interactive-xai.js.map +1 -1
- package/dist/infrastructure/xai/uncertainty-quantifier.d.ts +6 -9
- package/dist/infrastructure/xai/uncertainty-quantifier.d.ts.map +1 -1
- package/dist/infrastructure/xai/uncertainty-quantifier.js +6 -9
- package/dist/infrastructure/xai/uncertainty-quantifier.js.map +1 -1
- package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/ask-command.js +84 -2
- package/dist/presentation/cli/commands/ask-command.js.map +1 -1
- package/dist/presentation/cli/commands/docs-command.d.ts +12 -0
- package/dist/presentation/cli/commands/docs-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/docs-command.js +196 -0
- package/dist/presentation/cli/commands/docs-command.js.map +1 -0
- package/dist/presentation/cli/commands/fix-command.d.ts +8 -0
- package/dist/presentation/cli/commands/fix-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/fix-command.js +309 -0
- package/dist/presentation/cli/commands/fix-command.js.map +1 -0
- package/dist/presentation/cli/commands/help-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/help-command.js +2 -0
- package/dist/presentation/cli/commands/help-command.js.map +1 -1
- 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 +53 -0
- 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 +80 -3
- package/dist/presentation/cli/commands/plan-command.js.map +1 -1
- package/dist/presentation/cli/commands/product-command.d.ts +12 -0
- package/dist/presentation/cli/commands/product-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/product-command.js +188 -0
- package/dist/presentation/cli/commands/product-command.js.map +1 -0
- package/dist/presentation/cli/commands/react-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/react-command.js +3 -1
- package/dist/presentation/cli/commands/react-command.js.map +1 -1
- package/dist/presentation/cli/commands/review-command.d.ts +14 -0
- package/dist/presentation/cli/commands/review-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/review-command.js +22 -0
- package/dist/presentation/cli/commands/review-command.js.map +1 -0
- package/dist/presentation/cli/commands/run-command.d.ts +15 -0
- package/dist/presentation/cli/commands/run-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/run-command.js +29 -0
- package/dist/presentation/cli/commands/run-command.js.map +1 -0
- package/dist/presentation/cli/commands/smart-command.d.ts +3 -1
- package/dist/presentation/cli/commands/smart-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/smart-command.js +92 -6
- package/dist/presentation/cli/commands/smart-command.js.map +1 -1
- package/dist/presentation/cli/commands/status-command.d.ts +11 -0
- package/dist/presentation/cli/commands/status-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/status-command.js +176 -0
- package/dist/presentation/cli/commands/status-command.js.map +1 -0
- package/dist/presentation/cli/commands/suggest-command.d.ts +13 -0
- package/dist/presentation/cli/commands/suggest-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/suggest-command.js +25 -0
- package/dist/presentation/cli/commands/suggest-command.js.map +1 -0
- package/dist/presentation/cli/error-display.d.ts.map +1 -1
- package/dist/presentation/cli/error-display.js +43 -0
- package/dist/presentation/cli/error-display.js.map +1 -1
- package/dist/session.js +19 -2
- package/dist/session.js.map +1 -1
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +8 -5
- package/dist/ui.js.map +1 -1
- package/package.json +10 -2
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: Proportional Friction Enhancement
|
|
3
|
+
* Task 5.2: Higher friction for high-risk actions, lower friction for safe operations
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - User-configurable friction levels
|
|
7
|
+
* - Risk-proportional friction calculation
|
|
8
|
+
* - Consistent application across operations
|
|
9
|
+
*/
|
|
10
|
+
import { AppropriateFriction, FrictionPoint } from './appropriate-friction.js';
|
|
11
|
+
export type UserFrictionPreference = 'minimal' | 'balanced' | 'strict';
|
|
12
|
+
export interface FrictionConfiguration {
|
|
13
|
+
preference: UserFrictionPreference;
|
|
14
|
+
allowAutoProceed: boolean;
|
|
15
|
+
customThresholds?: {
|
|
16
|
+
low?: number;
|
|
17
|
+
medium?: number;
|
|
18
|
+
high?: number;
|
|
19
|
+
critical?: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Enhanced Proportional Friction System
|
|
24
|
+
* Extends AppropriateFriction with user-configurable proportional scaling
|
|
25
|
+
*/
|
|
26
|
+
export declare class ProportionalFriction extends AppropriateFriction {
|
|
27
|
+
private config;
|
|
28
|
+
private configPath;
|
|
29
|
+
constructor(configPath?: string);
|
|
30
|
+
/**
|
|
31
|
+
* Get friction point adjusted for user preferences
|
|
32
|
+
* Scales friction level based on user configuration and risk
|
|
33
|
+
*/
|
|
34
|
+
getProportionalFriction(operation: string, context: {
|
|
35
|
+
riskLevel?: 'low' | 'medium' | 'high' | 'critical';
|
|
36
|
+
isDestructive?: boolean;
|
|
37
|
+
affectsMultipleFiles?: boolean;
|
|
38
|
+
modifiesSecuritySensitiveCode?: boolean;
|
|
39
|
+
uncertainty?: number;
|
|
40
|
+
}): FrictionPoint | null;
|
|
41
|
+
/**
|
|
42
|
+
* Adjust friction level based on user preference
|
|
43
|
+
*/
|
|
44
|
+
private adjustFrictionLevel;
|
|
45
|
+
/**
|
|
46
|
+
* Determine if explicit confirmation should be required
|
|
47
|
+
*/
|
|
48
|
+
private shouldRequireConfirmation;
|
|
49
|
+
/**
|
|
50
|
+
* Adjust timeout based on user preference
|
|
51
|
+
*/
|
|
52
|
+
private adjustTimeout;
|
|
53
|
+
/**
|
|
54
|
+
* Update friction configuration
|
|
55
|
+
*/
|
|
56
|
+
updateConfiguration(config: Partial<FrictionConfiguration>): void;
|
|
57
|
+
/**
|
|
58
|
+
* Get current configuration
|
|
59
|
+
*/
|
|
60
|
+
getConfiguration(): FrictionConfiguration;
|
|
61
|
+
/**
|
|
62
|
+
* Set user preference
|
|
63
|
+
*/
|
|
64
|
+
setPreference(preference: UserFrictionPreference): void;
|
|
65
|
+
/**
|
|
66
|
+
* Calculate friction intensity score (0-1)
|
|
67
|
+
* Higher score = more friction
|
|
68
|
+
*/
|
|
69
|
+
calculateFrictionScore(riskLevel: 'low' | 'medium' | 'high' | 'critical', isDestructive: boolean, affectsMultipleFiles: boolean, modifiesSecuritySensitiveCode: boolean, uncertainty: number): number;
|
|
70
|
+
private loadConfiguration;
|
|
71
|
+
private saveConfiguration;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=proportional-friction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proportional-friction.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/ux/proportional-friction.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAiB,MAAM,2BAA2B,CAAC;AAI9F,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEvE,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,sBAAsB,CAAC;IACnC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,mBAAmB;IAC3D,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,UAAU,CAAS;gBAEf,UAAU,CAAC,EAAE,MAAM;IAM/B;;;OAGG;IACH,uBAAuB,CACrB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;QACP,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;QACnD,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;QAC/B,6BAA6B,CAAC,EAAE,OAAO,CAAC;QACxC,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,GACA,aAAa,GAAG,IAAI;IAoCvB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAgC3B;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAqBjC;;OAEG;IACH,OAAO,CAAC,aAAa;IAuBrB;;OAEG;IACH,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,IAAI;IAQjE;;OAEG;IACH,gBAAgB,IAAI,qBAAqB;IAIzC;;OAEG;IACH,aAAa,CAAC,UAAU,EAAE,sBAAsB,GAAG,IAAI;IAKvD;;;OAGG;IACH,sBAAsB,CACpB,SAAS,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,EACjD,aAAa,EAAE,OAAO,EACtB,oBAAoB,EAAE,OAAO,EAC7B,6BAA6B,EAAE,OAAO,EACtC,WAAW,EAAE,MAAM,GAClB,MAAM;IAgCT,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,iBAAiB;CAW1B"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: Proportional Friction Enhancement
|
|
3
|
+
* Task 5.2: Higher friction for high-risk actions, lower friction for safe operations
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - User-configurable friction levels
|
|
7
|
+
* - Risk-proportional friction calculation
|
|
8
|
+
* - Consistent application across operations
|
|
9
|
+
*/
|
|
10
|
+
import { AppropriateFriction } from './appropriate-friction.js';
|
|
11
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
|
|
12
|
+
import { join } from 'path';
|
|
13
|
+
/**
|
|
14
|
+
* Enhanced Proportional Friction System
|
|
15
|
+
* Extends AppropriateFriction with user-configurable proportional scaling
|
|
16
|
+
*/
|
|
17
|
+
export class ProportionalFriction extends AppropriateFriction {
|
|
18
|
+
config;
|
|
19
|
+
configPath;
|
|
20
|
+
constructor(configPath) {
|
|
21
|
+
super();
|
|
22
|
+
this.configPath = configPath || join(process.cwd(), 'data', 'friction-config.json');
|
|
23
|
+
this.config = this.loadConfiguration();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get friction point adjusted for user preferences
|
|
27
|
+
* Scales friction level based on user configuration and risk
|
|
28
|
+
*/
|
|
29
|
+
getProportionalFriction(operation, context) {
|
|
30
|
+
const baseFriction = this.needsFriction(operation, context);
|
|
31
|
+
if (!baseFriction) {
|
|
32
|
+
return null; // No friction needed
|
|
33
|
+
}
|
|
34
|
+
// Adjust friction level based on user preference
|
|
35
|
+
const adjustedLevel = this.adjustFrictionLevel(baseFriction.level, context.riskLevel || 'medium', this.config);
|
|
36
|
+
// Adjust confirmation requirements based on preference
|
|
37
|
+
const requiresConfirmation = this.shouldRequireConfirmation(baseFriction.requiresExplicitConfirmation, adjustedLevel, this.config);
|
|
38
|
+
// Adjust timeout based on preference
|
|
39
|
+
const timeout = this.adjustTimeout(baseFriction.timeout, adjustedLevel, this.config);
|
|
40
|
+
return {
|
|
41
|
+
...baseFriction,
|
|
42
|
+
level: adjustedLevel,
|
|
43
|
+
requiresExplicitConfirmation: requiresConfirmation,
|
|
44
|
+
timeout: timeout,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Adjust friction level based on user preference
|
|
49
|
+
*/
|
|
50
|
+
adjustFrictionLevel(baseLevel, riskLevel, config) {
|
|
51
|
+
// For critical operations, always use heavy friction regardless of preference
|
|
52
|
+
if (riskLevel === 'critical') {
|
|
53
|
+
return 'heavy';
|
|
54
|
+
}
|
|
55
|
+
switch (config.preference) {
|
|
56
|
+
case 'minimal':
|
|
57
|
+
// Reduce friction levels
|
|
58
|
+
if (baseLevel === 'heavy')
|
|
59
|
+
return 'moderate';
|
|
60
|
+
if (baseLevel === 'moderate')
|
|
61
|
+
return 'light';
|
|
62
|
+
if (baseLevel === 'light')
|
|
63
|
+
return 'none';
|
|
64
|
+
return baseLevel;
|
|
65
|
+
case 'strict':
|
|
66
|
+
// Increase friction levels
|
|
67
|
+
if (baseLevel === 'light')
|
|
68
|
+
return 'moderate';
|
|
69
|
+
if (baseLevel === 'moderate')
|
|
70
|
+
return 'heavy';
|
|
71
|
+
if (baseLevel === 'none' && riskLevel !== 'low')
|
|
72
|
+
return 'light';
|
|
73
|
+
return baseLevel;
|
|
74
|
+
case 'balanced':
|
|
75
|
+
default:
|
|
76
|
+
// Use base level as-is (default behavior)
|
|
77
|
+
return baseLevel;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Determine if explicit confirmation should be required
|
|
82
|
+
*/
|
|
83
|
+
shouldRequireConfirmation(baseRequirement, frictionLevel, config) {
|
|
84
|
+
// Minimal preference allows auto-proceed for moderate friction
|
|
85
|
+
if (config.preference === 'minimal' && config.allowAutoProceed) {
|
|
86
|
+
if (frictionLevel === 'light' || frictionLevel === 'moderate') {
|
|
87
|
+
return false; // Allow auto-proceed
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Strict preference always requires confirmation for any friction
|
|
91
|
+
if (config.preference === 'strict') {
|
|
92
|
+
return frictionLevel !== 'none';
|
|
93
|
+
}
|
|
94
|
+
// Balanced: Use base requirement
|
|
95
|
+
return baseRequirement;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Adjust timeout based on user preference
|
|
99
|
+
*/
|
|
100
|
+
adjustTimeout(baseTimeout, frictionLevel, config) {
|
|
101
|
+
if (!baseTimeout) {
|
|
102
|
+
return undefined; // No timeout
|
|
103
|
+
}
|
|
104
|
+
// Minimal: Shorter timeout
|
|
105
|
+
if (config.preference === 'minimal') {
|
|
106
|
+
return Math.max(1000, baseTimeout * 0.5); // 50% of base timeout
|
|
107
|
+
}
|
|
108
|
+
// Strict: Longer timeout
|
|
109
|
+
if (config.preference === 'strict') {
|
|
110
|
+
return baseTimeout * 2; // 200% of base timeout
|
|
111
|
+
}
|
|
112
|
+
// Balanced: Use base timeout
|
|
113
|
+
return baseTimeout;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Update friction configuration
|
|
117
|
+
*/
|
|
118
|
+
updateConfiguration(config) {
|
|
119
|
+
this.config = {
|
|
120
|
+
...this.config,
|
|
121
|
+
...config,
|
|
122
|
+
};
|
|
123
|
+
this.saveConfiguration();
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get current configuration
|
|
127
|
+
*/
|
|
128
|
+
getConfiguration() {
|
|
129
|
+
return { ...this.config };
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Set user preference
|
|
133
|
+
*/
|
|
134
|
+
setPreference(preference) {
|
|
135
|
+
this.config.preference = preference;
|
|
136
|
+
this.saveConfiguration();
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Calculate friction intensity score (0-1)
|
|
140
|
+
* Higher score = more friction
|
|
141
|
+
*/
|
|
142
|
+
calculateFrictionScore(riskLevel, isDestructive, affectsMultipleFiles, modifiesSecuritySensitiveCode, uncertainty) {
|
|
143
|
+
let score = 0;
|
|
144
|
+
// Risk level contribution (40%)
|
|
145
|
+
const riskScores = { low: 0.1, medium: 0.3, high: 0.6, critical: 1.0 };
|
|
146
|
+
score += riskScores[riskLevel] * 0.4;
|
|
147
|
+
// Destructive operation (20%)
|
|
148
|
+
if (isDestructive)
|
|
149
|
+
score += 0.2;
|
|
150
|
+
// Multi-file impact (15%)
|
|
151
|
+
if (affectsMultipleFiles)
|
|
152
|
+
score += 0.15;
|
|
153
|
+
// Security-sensitive (20%)
|
|
154
|
+
if (modifiesSecuritySensitiveCode)
|
|
155
|
+
score += 0.2;
|
|
156
|
+
// Uncertainty (5%)
|
|
157
|
+
score += Math.min(uncertainty, 1.0) * 0.05;
|
|
158
|
+
// Apply user preference scaling
|
|
159
|
+
const preferenceScale = {
|
|
160
|
+
minimal: 0.7, // 30% reduction
|
|
161
|
+
balanced: 1.0, // No change
|
|
162
|
+
strict: 1.3, // 30% increase
|
|
163
|
+
};
|
|
164
|
+
score *= preferenceScale[this.config.preference];
|
|
165
|
+
return Math.min(score, 1.0); // Cap at 1.0
|
|
166
|
+
}
|
|
167
|
+
// Configuration persistence
|
|
168
|
+
loadConfiguration() {
|
|
169
|
+
try {
|
|
170
|
+
if (existsSync(this.configPath)) {
|
|
171
|
+
const data = JSON.parse(readFileSync(this.configPath, 'utf-8'));
|
|
172
|
+
return {
|
|
173
|
+
preference: data.preference || 'balanced',
|
|
174
|
+
allowAutoProceed: data.allowAutoProceed ?? true,
|
|
175
|
+
customThresholds: data.customThresholds,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
// Use defaults if config doesn't exist or can't be read
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
preference: 'balanced',
|
|
184
|
+
allowAutoProceed: true,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
saveConfiguration() {
|
|
188
|
+
try {
|
|
189
|
+
const configDir = join(this.configPath, '..');
|
|
190
|
+
if (!existsSync(configDir)) {
|
|
191
|
+
mkdirSync(configDir, { recursive: true });
|
|
192
|
+
}
|
|
193
|
+
writeFileSync(this.configPath, JSON.stringify(this.config, null, 2));
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
// Silently fail - configuration is optional
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=proportional-friction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proportional-friction.js","sourceRoot":"","sources":["../../../src/infrastructure/ux/proportional-friction.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,mBAAmB,EAAgC,MAAM,2BAA2B,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAe5B;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,mBAAmB;IACnD,MAAM,CAAwB;IAC9B,UAAU,CAAS;IAE3B,YAAY,UAAmB;QAC7B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,sBAAsB,CAAC,CAAC;QACpF,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;IACzC,CAAC;IAED;;;OAGG;IACH,uBAAuB,CACrB,SAAiB,EACjB,OAMC;QAED,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE5D,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC,CAAC,qBAAqB;QACpC,CAAC;QAED,iDAAiD;QACjD,MAAM,aAAa,GAAG,IAAI,CAAC,mBAAmB,CAC5C,YAAY,CAAC,KAAK,EAClB,OAAO,CAAC,SAAS,IAAI,QAAQ,EAC7B,IAAI,CAAC,MAAM,CACZ,CAAC;QAEF,uDAAuD;QACvD,MAAM,oBAAoB,GAAG,IAAI,CAAC,yBAAyB,CACzD,YAAY,CAAC,4BAA4B,EACzC,aAAa,EACb,IAAI,CAAC,MAAM,CACZ,CAAC;QAEF,qCAAqC;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAChC,YAAY,CAAC,OAAO,EACpB,aAAa,E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QACH,CAAC;QAAC,MAAM,CAAC;YACP,wDAAwD;QAC1D,CAAC;QAED,OAAO;YACL,UAAU,EAAE,UAAU;YACtB,gBAAgB,EAAE,IAAI;SACvB,CAAC;IACJ,CAAC;IAEO,iBAAiB;QACvB,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAC9C,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC3B,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC5C,CAAC;YACD,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACvE,CAAC;QAAC,MAAM,CAAC;YACP,4CAA4C;QAC9C,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: Agent Feedback Module
|
|
3
|
+
* Unified evaluation & feedback capture layer for Validation Mode
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - Record success/failure, user approval, user modifications, errors
|
|
7
|
+
* - Store anonymously in local memory for pattern improvements
|
|
8
|
+
* - JSON-based, appended per operation
|
|
9
|
+
* - Privacy-first design with opt-out support
|
|
10
|
+
*/
|
|
11
|
+
export type FeedbackOutcome = 'success' | 'failure' | 'partial_success' | 'cancelled' | 'error';
|
|
12
|
+
export type UserAction = 'approved' | 'rejected' | 'modified' | 'skipped' | 'not_required';
|
|
13
|
+
export interface AgentFeedback {
|
|
14
|
+
feedbackId: string;
|
|
15
|
+
runId: string;
|
|
16
|
+
agentName: string;
|
|
17
|
+
timestamp: number;
|
|
18
|
+
operation: string;
|
|
19
|
+
query?: string;
|
|
20
|
+
outcome: FeedbackOutcome;
|
|
21
|
+
userAction: UserAction;
|
|
22
|
+
filesChanged?: string[];
|
|
23
|
+
filesCreated?: string[];
|
|
24
|
+
filesDeleted?: string[];
|
|
25
|
+
userModifications?: Array<{
|
|
26
|
+
filepath: string;
|
|
27
|
+
modificationType: 'edited' | 'reverted' | 'accepted' | 'rejected';
|
|
28
|
+
description?: string;
|
|
29
|
+
}>;
|
|
30
|
+
errors?: string[];
|
|
31
|
+
warnings?: string[];
|
|
32
|
+
validationChecks?: Array<{
|
|
33
|
+
check: string;
|
|
34
|
+
passed: boolean;
|
|
35
|
+
message?: string;
|
|
36
|
+
}>;
|
|
37
|
+
metrics?: {
|
|
38
|
+
tokensUsed?: number;
|
|
39
|
+
duration?: number;
|
|
40
|
+
filesAnalyzed?: number;
|
|
41
|
+
changesProposed?: number;
|
|
42
|
+
changesApplied?: number;
|
|
43
|
+
};
|
|
44
|
+
context?: {
|
|
45
|
+
codebaseType?: string;
|
|
46
|
+
fileCount?: number;
|
|
47
|
+
operationType?: string;
|
|
48
|
+
};
|
|
49
|
+
userFeedback?: {
|
|
50
|
+
rating?: number;
|
|
51
|
+
comment?: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface AgentFeedbackConfig {
|
|
55
|
+
enabled: boolean;
|
|
56
|
+
storagePath?: string;
|
|
57
|
+
anonymize: boolean;
|
|
58
|
+
optOut: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Agent Feedback Manager
|
|
62
|
+
* Lightweight, privacy-first feedback capture
|
|
63
|
+
*/
|
|
64
|
+
export declare class AgentFeedbackManager {
|
|
65
|
+
private config;
|
|
66
|
+
private feedbackDir;
|
|
67
|
+
private feedbackHistory;
|
|
68
|
+
constructor(config?: Partial<AgentFeedbackConfig>);
|
|
69
|
+
/**
|
|
70
|
+
* Record feedback for an agent operation
|
|
71
|
+
* userAction is required - must be provided by caller
|
|
72
|
+
*/
|
|
73
|
+
recordFeedback(feedback: Omit<AgentFeedback, 'feedbackId' | 'timestamp'> & {
|
|
74
|
+
userAction: UserAction;
|
|
75
|
+
}): string;
|
|
76
|
+
/**
|
|
77
|
+
* Get feedback for a run
|
|
78
|
+
*/
|
|
79
|
+
getFeedbackForRun(runId: string): AgentFeedback | null;
|
|
80
|
+
/**
|
|
81
|
+
* Get recent feedback patterns (for learning)
|
|
82
|
+
*/
|
|
83
|
+
getRecentFeedback(limit?: number): AgentFeedback[];
|
|
84
|
+
/**
|
|
85
|
+
* Get feedback statistics
|
|
86
|
+
*/
|
|
87
|
+
getFeedbackStats(): {
|
|
88
|
+
total: number;
|
|
89
|
+
byOutcome: Record<FeedbackOutcome, number>;
|
|
90
|
+
byAgent: Record<string, number>;
|
|
91
|
+
averageRating?: number;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Anonymize feedback (remove sensitive data)
|
|
95
|
+
*/
|
|
96
|
+
private anonymizeFeedback;
|
|
97
|
+
/**
|
|
98
|
+
* Anonymize file path (keep structure, not actual names)
|
|
99
|
+
*/
|
|
100
|
+
private anonymizePath;
|
|
101
|
+
/**
|
|
102
|
+
* Load recent feedback from disk
|
|
103
|
+
*/
|
|
104
|
+
private loadRecentFeedback;
|
|
105
|
+
/**
|
|
106
|
+
* Clear all feedback (privacy control)
|
|
107
|
+
*/
|
|
108
|
+
clearFeedback(): void;
|
|
109
|
+
/**
|
|
110
|
+
* Check if feedback collection is enabled
|
|
111
|
+
*/
|
|
112
|
+
isEnabled(): boolean;
|
|
113
|
+
}
|
|
114
|
+
export declare const agentFeedbackManager: AgentFeedbackManager;
|
|
115
|
+
//# sourceMappingURL=agent-feedback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-feedback.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/validation/agent-feedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,WAAW,GAAG,OAAO,CAAC;AAChG,MAAM,MAAM,UAAU,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CAAC"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: Agent Feedback Module
|
|
3
|
+
* Unified evaluation & feedback capture layer for Validation Mode
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - Record success/failure, user approval, user modifications, errors
|
|
7
|
+
* - Store anonymously in local memory for pattern improvements
|
|
8
|
+
* - JSON-based, appended per operation
|
|
9
|
+
* - Privacy-first design with opt-out support
|
|
10
|
+
*/
|
|
11
|
+
import { writeFileSync, readFileSync, existsSync, mkdirSync, appendFileSync } from 'fs';
|
|
12
|
+
import { join, dirname } from 'path';
|
|
13
|
+
import { fileURLToPath } from 'url';
|
|
14
|
+
import { randomUUID } from 'crypto';
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
const __dirname = dirname(__filename);
|
|
17
|
+
/**
|
|
18
|
+
* Agent Feedback Manager
|
|
19
|
+
* Lightweight, privacy-first feedback capture
|
|
20
|
+
*/
|
|
21
|
+
export class AgentFeedbackManager {
|
|
22
|
+
config;
|
|
23
|
+
feedbackDir = '';
|
|
24
|
+
feedbackHistory = [];
|
|
25
|
+
constructor(config) {
|
|
26
|
+
// Check opt-out preference
|
|
27
|
+
const optOut = process.env.CODEHERE_FEEDBACK_OPT_OUT === 'true' ||
|
|
28
|
+
process.env.CODEHERE_TELEMETRY_DISABLED === 'true';
|
|
29
|
+
this.config = {
|
|
30
|
+
enabled: !optOut && (config?.enabled !== false),
|
|
31
|
+
anonymize: config?.anonymize !== false,
|
|
32
|
+
optOut: optOut || (config?.optOut === true),
|
|
33
|
+
storagePath: config?.storagePath,
|
|
34
|
+
};
|
|
35
|
+
if (this.config.optOut || !this.config.enabled) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
// Set up feedback storage directory
|
|
39
|
+
if (this.config.storagePath) {
|
|
40
|
+
this.feedbackDir = this.config.storagePath;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const agentDir = join(__dirname, '../../..');
|
|
44
|
+
this.feedbackDir = join(agentDir, 'data', 'feedback');
|
|
45
|
+
}
|
|
46
|
+
if (!existsSync(this.feedbackDir)) {
|
|
47
|
+
mkdirSync(this.feedbackDir, { recursive: true });
|
|
48
|
+
}
|
|
49
|
+
// Load recent feedback history (for pattern analysis)
|
|
50
|
+
this.loadRecentFeedback();
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Record feedback for an agent operation
|
|
54
|
+
* userAction is required - must be provided by caller
|
|
55
|
+
*/
|
|
56
|
+
recordFeedback(feedback) {
|
|
57
|
+
if (this.config.optOut || !this.config.enabled) {
|
|
58
|
+
return 'feedback-disabled';
|
|
59
|
+
}
|
|
60
|
+
const feedbackId = randomUUID();
|
|
61
|
+
const fullFeedback = {
|
|
62
|
+
...feedback,
|
|
63
|
+
feedbackId,
|
|
64
|
+
timestamp: Date.now(),
|
|
65
|
+
};
|
|
66
|
+
// Anonymize if configured
|
|
67
|
+
const processedFeedback = this.config.anonymize
|
|
68
|
+
? this.anonymizeFeedback(fullFeedback)
|
|
69
|
+
: fullFeedback;
|
|
70
|
+
// Store in memory
|
|
71
|
+
this.feedbackHistory.push(processedFeedback);
|
|
72
|
+
if (this.feedbackHistory.length > 1000) {
|
|
73
|
+
// Keep only last 1000 in memory
|
|
74
|
+
this.feedbackHistory = this.feedbackHistory.slice(-1000);
|
|
75
|
+
}
|
|
76
|
+
// Append to JSON file (one JSON object per line for easy parsing)
|
|
77
|
+
const feedbackFile = join(this.feedbackDir, 'agent-feedback.jsonl');
|
|
78
|
+
try {
|
|
79
|
+
appendFileSync(feedbackFile, JSON.stringify(processedFeedback) + '\n', 'utf-8');
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
// Silent failure - don't break user workflow
|
|
83
|
+
console.error('[AgentFeedback] Failed to write feedback:', error);
|
|
84
|
+
}
|
|
85
|
+
return feedbackId;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get feedback for a run
|
|
89
|
+
*/
|
|
90
|
+
getFeedbackForRun(runId) {
|
|
91
|
+
return this.feedbackHistory.find(f => f.runId === runId) || null;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get recent feedback patterns (for learning)
|
|
95
|
+
*/
|
|
96
|
+
getRecentFeedback(limit = 100) {
|
|
97
|
+
return this.feedbackHistory.slice(-limit);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Get feedback statistics
|
|
101
|
+
*/
|
|
102
|
+
getFeedbackStats() {
|
|
103
|
+
const stats = {
|
|
104
|
+
total: this.feedbackHistory.length,
|
|
105
|
+
byOutcome: {},
|
|
106
|
+
byAgent: {},
|
|
107
|
+
averageRating: undefined,
|
|
108
|
+
};
|
|
109
|
+
let totalRating = 0;
|
|
110
|
+
let ratingCount = 0;
|
|
111
|
+
for (const feedback of this.feedbackHistory) {
|
|
112
|
+
// Count by outcome
|
|
113
|
+
stats.byOutcome[feedback.outcome] = (stats.byOutcome[feedback.outcome] || 0) + 1;
|
|
114
|
+
// Count by agent
|
|
115
|
+
stats.byAgent[feedback.agentName] = (stats.byAgent[feedback.agentName] || 0) + 1;
|
|
116
|
+
// Calculate average rating
|
|
117
|
+
if (feedback.userFeedback?.rating) {
|
|
118
|
+
totalRating += feedback.userFeedback.rating;
|
|
119
|
+
ratingCount++;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (ratingCount > 0) {
|
|
123
|
+
stats.averageRating = totalRating / ratingCount;
|
|
124
|
+
}
|
|
125
|
+
return stats;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Anonymize feedback (remove sensitive data)
|
|
129
|
+
*/
|
|
130
|
+
anonymizeFeedback(feedback) {
|
|
131
|
+
const anonymized = { ...feedback };
|
|
132
|
+
// Remove query content if it might contain sensitive info
|
|
133
|
+
if (anonymized.query) {
|
|
134
|
+
// Keep only intent keywords, not full query
|
|
135
|
+
const keywords = anonymized.query
|
|
136
|
+
.split(/\s+/)
|
|
137
|
+
.filter(w => w.length > 3)
|
|
138
|
+
.slice(0, 5)
|
|
139
|
+
.join(' ');
|
|
140
|
+
anonymized.query = keywords || '[anonymized]';
|
|
141
|
+
}
|
|
142
|
+
// Remove file contents from modifications
|
|
143
|
+
if (anonymized.userModifications) {
|
|
144
|
+
anonymized.userModifications = anonymized.userModifications.map(mod => ({
|
|
145
|
+
filepath: this.anonymizePath(mod.filepath),
|
|
146
|
+
modificationType: mod.modificationType,
|
|
147
|
+
description: mod.description ? '[anonymized]' : undefined,
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
// Anonymize file paths (keep structure, not names)
|
|
151
|
+
if (anonymized.filesChanged) {
|
|
152
|
+
anonymized.filesChanged = anonymized.filesChanged.map(p => this.anonymizePath(p));
|
|
153
|
+
}
|
|
154
|
+
if (anonymized.filesCreated) {
|
|
155
|
+
anonymized.filesCreated = anonymized.filesCreated.map(p => this.anonymizePath(p));
|
|
156
|
+
}
|
|
157
|
+
return anonymized;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Anonymize file path (keep structure, not actual names)
|
|
161
|
+
*/
|
|
162
|
+
anonymizePath(filepath) {
|
|
163
|
+
// Replace actual file names with placeholders but keep structure
|
|
164
|
+
const parts = filepath.split('/');
|
|
165
|
+
return parts.map((part, index) => {
|
|
166
|
+
if (index === parts.length - 1) {
|
|
167
|
+
// Last part is filename
|
|
168
|
+
const ext = part.split('.').pop();
|
|
169
|
+
return `file${ext ? '.' + ext : ''}`;
|
|
170
|
+
}
|
|
171
|
+
return part;
|
|
172
|
+
}).join('/');
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Load recent feedback from disk
|
|
176
|
+
*/
|
|
177
|
+
loadRecentFeedback() {
|
|
178
|
+
const feedbackFile = join(this.feedbackDir, 'agent-feedback.jsonl');
|
|
179
|
+
if (!existsSync(feedbackFile)) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
const content = readFileSync(feedbackFile, 'utf-8');
|
|
184
|
+
const lines = content.trim().split('\n').filter(line => line.trim());
|
|
185
|
+
// Load last 100 entries
|
|
186
|
+
const recentLines = lines.slice(-100);
|
|
187
|
+
this.feedbackHistory = recentLines
|
|
188
|
+
.map(line => {
|
|
189
|
+
try {
|
|
190
|
+
return JSON.parse(line);
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
})
|
|
196
|
+
.filter((f) => f !== null);
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
// Silent failure
|
|
200
|
+
console.error('[AgentFeedback] Failed to load feedback history:', error);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Clear all feedback (privacy control)
|
|
205
|
+
*/
|
|
206
|
+
clearFeedback() {
|
|
207
|
+
this.feedbackHistory = [];
|
|
208
|
+
const feedbackFile = join(this.feedbackDir, 'agent-feedback.jsonl');
|
|
209
|
+
if (existsSync(feedbackFile)) {
|
|
210
|
+
try {
|
|
211
|
+
writeFileSync(feedbackFile, '', 'utf-8');
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
// Silent failure
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Check if feedback collection is enabled
|
|
220
|
+
*/
|
|
221
|
+
isEnabled() {
|
|
222
|
+
return !this.config.optOut && this.config.enabled;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
// Singleton instance
|
|
226
|
+
export const agentFeedbackManager = new AgentFeedbackManager();
|
|
227
|
+
//# sourceMappingURL=agent-feedback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-feedback.js","sourceRoot":"","sources":["../../../src/infrastructure/validation/agent-feedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAA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