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
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Helper functions for creating and updating tasks (non-breaking)
|
|
4
4
|
*
|
|
5
5
|
* Phase 1: v0.5.0-alpha
|
|
6
|
-
* See:
|
|
6
|
+
* See: .internal/ARCHITECTURE.md (internal docs)
|
|
7
7
|
*/
|
|
8
8
|
import { getTaskRepository } from './task-repository.js';
|
|
9
|
-
import { TaskMode, TaskStatus, ReviewStatus } from '../../domain/entities/task.js';
|
|
9
|
+
import { TaskMode, TaskStatus, RiskTier, ReviewStatus } from '../../domain/entities/task.js';
|
|
10
10
|
import { getCurrentEnvironmentMode } from '../../domain/services/environment-mode-manager.js';
|
|
11
11
|
import { detectRiskTier, detectRiskTierFromPlan } from '../../domain/services/risk-tier-detector.js';
|
|
12
12
|
import { randomUUID } from 'crypto';
|
|
@@ -44,6 +44,40 @@ export async function createPlanTask(options) {
|
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Create task for suggest command
|
|
49
|
+
* Non-breaking: silent failure, doesn't affect user workflow
|
|
50
|
+
* Suggest tasks are ephemeral (T1, always low risk)
|
|
51
|
+
*/
|
|
52
|
+
export async function createSuggestTask(options) {
|
|
53
|
+
const { query, filePath, codebaseInfo, runId } = options;
|
|
54
|
+
try {
|
|
55
|
+
const taskRepo = getTaskRepository();
|
|
56
|
+
const environment = getCurrentEnvironmentMode();
|
|
57
|
+
// Suggest mode is always T1 (low risk, read-only)
|
|
58
|
+
const taskId = `task-${randomUUID()}`;
|
|
59
|
+
const fullQuery = filePath ? `${query} (file: ${filePath})` : query;
|
|
60
|
+
await taskRepo.create({
|
|
61
|
+
id: taskId,
|
|
62
|
+
createdAt: Date.now(),
|
|
63
|
+
updatedAt: Date.now(),
|
|
64
|
+
codebaseId: codebaseInfo?.codebaseId || codebaseInfo?.rootPath || process.cwd(),
|
|
65
|
+
cwd: process.cwd(),
|
|
66
|
+
mode: TaskMode.SUGGEST,
|
|
67
|
+
goal: fullQuery,
|
|
68
|
+
command: 'suggest',
|
|
69
|
+
status: TaskStatus.CREATED,
|
|
70
|
+
riskTier: RiskTier.T1, // Always low risk for read-only operations
|
|
71
|
+
environment,
|
|
72
|
+
traceSummaryId: runId,
|
|
73
|
+
});
|
|
74
|
+
return taskId;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// Silent failure - task creation is optional
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
47
81
|
/**
|
|
48
82
|
* Create task for fix/run command
|
|
49
83
|
* Non-breaking: silent failure, doesn't affect user workflow
|
|
@@ -83,13 +117,15 @@ export async function createRunTask(options) {
|
|
|
83
117
|
* Non-breaking: silent failure
|
|
84
118
|
*/
|
|
85
119
|
export async function updateTaskStatus(taskId, status, updates) {
|
|
86
|
-
if (!taskId)
|
|
120
|
+
if (!taskId) {
|
|
87
121
|
return;
|
|
122
|
+
}
|
|
88
123
|
try {
|
|
89
124
|
const taskRepo = getTaskRepository();
|
|
90
125
|
const existing = await taskRepo.getById(taskId);
|
|
91
|
-
if (!existing)
|
|
126
|
+
if (!existing) {
|
|
92
127
|
return;
|
|
128
|
+
}
|
|
93
129
|
await taskRepo.update({
|
|
94
130
|
...existing,
|
|
95
131
|
...updates,
|
|
@@ -106,13 +142,15 @@ export async function updateTaskStatus(taskId, status, updates) {
|
|
|
106
142
|
* Non-breaking: silent failure
|
|
107
143
|
*/
|
|
108
144
|
export async function updateTaskWithResults(taskId, results) {
|
|
109
|
-
if (!taskId)
|
|
145
|
+
if (!taskId) {
|
|
110
146
|
return;
|
|
147
|
+
}
|
|
111
148
|
try {
|
|
112
149
|
const taskRepo = getTaskRepository();
|
|
113
150
|
const existing = await taskRepo.getById(taskId);
|
|
114
|
-
if (!existing)
|
|
151
|
+
if (!existing) {
|
|
115
152
|
return;
|
|
153
|
+
}
|
|
116
154
|
await taskRepo.update({
|
|
117
155
|
...existing,
|
|
118
156
|
...results,
|
|
@@ -128,13 +166,15 @@ export async function updateTaskWithResults(taskId, results) {
|
|
|
128
166
|
* Non-breaking: silent failure
|
|
129
167
|
*/
|
|
130
168
|
export async function updateTaskReview(taskId, reviewStatus, reviewedBy, comments) {
|
|
131
|
-
if (!taskId)
|
|
169
|
+
if (!taskId) {
|
|
132
170
|
return;
|
|
171
|
+
}
|
|
133
172
|
try {
|
|
134
173
|
const taskRepo = getTaskRepository();
|
|
135
174
|
const existing = await taskRepo.getById(taskId);
|
|
136
|
-
if (!existing)
|
|
175
|
+
if (!existing) {
|
|
137
176
|
return;
|
|
177
|
+
}
|
|
138
178
|
const newStatus = reviewStatus === ReviewStatus.APPROVED
|
|
139
179
|
? TaskStatus.APPROVED
|
|
140
180
|
: reviewStatus === ReviewStatus.REJECTED
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-helpers.js","sourceRoot":"","sources":["../../../src/infrastructure/storage/task-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAA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,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;IACT,CAAC;IACD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,iBAAiB,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO;QACT,CAAC;QACD,MAAM,SAAS,GACb,YAAY,KAAK,YAAY,CAAC,QAAQ;YACpC,CAAC,CAAC,UAAU,CAAC,QAAQ;YACrB,CAAC,CAAC,YAAY,KAAK,YAAY,CAAC,QAAQ;gBACxC,CAAC,CAAC,UAAU,CAAC,QAAQ;gBACrB,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;QACtB,MAAM,QAAQ,CAAC,MAAM,CAAC;YACpB,GAAG,QAAQ;YACX,YAAY;YACZ,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;YACtB,UAAU;YACV,cAAc,EAAE,QAAQ;YACxB,MAAM,EAAE,SAAS;YACjB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,iBAAiB;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Task storage and retrieval using JSONL format
|
|
4
4
|
*
|
|
5
5
|
* Phase 1: v0.5.0-alpha
|
|
6
|
-
* See:
|
|
6
|
+
* See: .internal/ARCHITECTURE.md (internal docs)
|
|
7
7
|
*/
|
|
8
8
|
import type { CodehereTask } from '../../domain/entities/task.js';
|
|
9
9
|
import { TaskStatus, TaskMode } from '../../domain/entities/task.js';
|
|
@@ -28,6 +28,7 @@ export declare class JsonlTaskRepository implements TaskRepository {
|
|
|
28
28
|
/**
|
|
29
29
|
* Load tasks from JSONL file into cache
|
|
30
30
|
* For duplicate IDs, keeps the latest version (by updatedAt)
|
|
31
|
+
* Optimized for large files with early exit on timeout
|
|
31
32
|
*/
|
|
32
33
|
private loadTasks;
|
|
33
34
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-repository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/storage/task-repository.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"task-repository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/storage/task-repository.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAGrE,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAClD,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IACzD,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IACnD,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IAClD,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;CACnC;AAED;;;GAGG;AACH,qBAAa,mBAAoB,YAAW,cAAc;IACxD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,UAAU,CAAwC;IAC1D,OAAO,CAAC,WAAW,CAAkB;gBAEzB,UAAU,CAAC,EAAE,MAAM;IA2B/B;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAmDjB;;OAEG;IACG,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB/C;;OAEG;IACG,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAcvD;;OAEG;IACG,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAM9D;;OAEG;IACG,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAMxD;;OAEG;IACG,SAAS,CAAC,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAQ5D;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAKvC;;;OAGG;IACG,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CAuBhD;AAKD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,cAAc,CAKrE"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Task storage and retrieval using JSONL format
|
|
4
4
|
*
|
|
5
5
|
* Phase 1: v0.5.0-alpha
|
|
6
|
-
* See:
|
|
6
|
+
* See: .internal/ARCHITECTURE.md (internal docs)
|
|
7
7
|
*/
|
|
8
8
|
import { appendFileSync, readFileSync, existsSync, mkdirSync } from 'fs';
|
|
9
9
|
import { join, dirname } from 'path';
|
|
@@ -47,6 +47,7 @@ export class JsonlTaskRepository {
|
|
|
47
47
|
/**
|
|
48
48
|
* Load tasks from JSONL file into cache
|
|
49
49
|
* For duplicate IDs, keeps the latest version (by updatedAt)
|
|
50
|
+
* Optimized for large files with early exit on timeout
|
|
50
51
|
*/
|
|
51
52
|
loadTasks() {
|
|
52
53
|
if (this.cacheLoaded) {
|
|
@@ -57,11 +58,21 @@ export class JsonlTaskRepository {
|
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
60
|
try {
|
|
61
|
+
// Use streaming read for large files (limit to 10MB)
|
|
62
|
+
const { statSync } = require('fs');
|
|
63
|
+
const stats = statSync(this.tasksPath);
|
|
64
|
+
if (stats.size > 10 * 1024 * 1024) {
|
|
65
|
+
// File too large, use empty cache
|
|
66
|
+
this.cacheLoaded = true;
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
60
69
|
const content = readFileSync(this.tasksPath, 'utf-8');
|
|
61
70
|
const lines = content.trim().split('\n').filter(line => line.trim());
|
|
71
|
+
// Limit processing to first 10000 lines to prevent timeout
|
|
72
|
+
const linesToProcess = lines.slice(0, 10000);
|
|
62
73
|
// Load all tasks, then keep only the latest version of each ID
|
|
63
74
|
const allTasks = [];
|
|
64
|
-
for (const line of
|
|
75
|
+
for (const line of linesToProcess) {
|
|
65
76
|
try {
|
|
66
77
|
const task = JSON.parse(line);
|
|
67
78
|
allTasks.push(task);
|
|
@@ -83,8 +94,8 @@ export class JsonlTaskRepository {
|
|
|
83
94
|
}
|
|
84
95
|
catch (error) {
|
|
85
96
|
// Silent failure - don't break user workflow
|
|
86
|
-
console.error('[TaskRepository] Failed to load tasks:', error);
|
|
87
97
|
this.cacheLoaded = true;
|
|
98
|
+
// Don't log errors in production to avoid noise
|
|
88
99
|
}
|
|
89
100
|
}
|
|
90
101
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-repository.js","sourceRoot":"","sources":["../../../src/infrastructure/storage/task-repository.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"task-repository.js","sourceRoot":"","sources":["../../../src/infrastructure/storage/task-repository.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGrC,OAAO,EAAE,gBAAgB,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I,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;YACzC,CAAC;YACD,OAAO,CAAC,KAAK,CAAC,yCAAyC,EAAE,KAAK,CAAC,CAAC;YAChE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAED,mEAAmE;AACnE,IAAI,sBAAsB,GAA0B,IAAI,CAAC;AAEzD;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAmB;IACnD,IAAI,CAAC,sBAAsB,IAAI,UAAU,EAAE,CAAC;QAC1C,sBAAsB,GAAG,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,sBAAsB,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: Telemetry Service
|
|
3
|
+
* Privacy-first, opt-in telemetry for understanding usage patterns
|
|
4
|
+
*
|
|
5
|
+
* Principles:
|
|
6
|
+
* - Opt-in only (CODEHERE_TELEMETRY_ENABLED=true)
|
|
7
|
+
* - No code/content transmitted
|
|
8
|
+
* - Anonymized data only
|
|
9
|
+
* - Local-first (stores locally, syncs if enabled)
|
|
10
|
+
*
|
|
11
|
+
* Clean Architecture: Infrastructure Layer
|
|
12
|
+
*/
|
|
13
|
+
export interface TelemetryEvent {
|
|
14
|
+
id: string;
|
|
15
|
+
timestamp: number;
|
|
16
|
+
eventType: 'install' | 'command' | 'error' | 'feature_use';
|
|
17
|
+
data: {
|
|
18
|
+
command?: string;
|
|
19
|
+
version?: string;
|
|
20
|
+
os?: string;
|
|
21
|
+
nodeVersion?: string;
|
|
22
|
+
errorType?: string;
|
|
23
|
+
feature?: string;
|
|
24
|
+
};
|
|
25
|
+
sessionId: string;
|
|
26
|
+
anonymousId: string;
|
|
27
|
+
}
|
|
28
|
+
export declare class TelemetryService {
|
|
29
|
+
private telemetryDir;
|
|
30
|
+
private eventsFile;
|
|
31
|
+
private configFile;
|
|
32
|
+
private enabled;
|
|
33
|
+
private anonymousId;
|
|
34
|
+
private sessionId;
|
|
35
|
+
constructor();
|
|
36
|
+
private findCodebaseRoot;
|
|
37
|
+
private loadConfig;
|
|
38
|
+
private generateAnonymousId;
|
|
39
|
+
private saveConfig;
|
|
40
|
+
/**
|
|
41
|
+
* Check if telemetry is enabled
|
|
42
|
+
*/
|
|
43
|
+
isEnabled(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Enable telemetry (opt-in)
|
|
46
|
+
*/
|
|
47
|
+
enable(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Disable telemetry
|
|
50
|
+
*/
|
|
51
|
+
disable(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Track an event
|
|
54
|
+
*/
|
|
55
|
+
track(eventType: TelemetryEvent['eventType'], data?: TelemetryEvent['data']): void;
|
|
56
|
+
/**
|
|
57
|
+
* Track command usage
|
|
58
|
+
*/
|
|
59
|
+
trackCommand(command: string): void;
|
|
60
|
+
/**
|
|
61
|
+
* Track error
|
|
62
|
+
*/
|
|
63
|
+
trackError(errorType: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Track feature usage
|
|
66
|
+
*/
|
|
67
|
+
trackFeature(feature: string): void;
|
|
68
|
+
/**
|
|
69
|
+
* Get telemetry status message
|
|
70
|
+
*/
|
|
71
|
+
getStatusMessage(): string;
|
|
72
|
+
}
|
|
73
|
+
export declare function getTelemetryService(): TelemetryService;
|
|
74
|
+
//# sourceMappingURL=telemetry-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-service.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/telemetry/telemetry-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG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
* Privacy-first, opt-in telemetry for understanding usage patterns
|
|
4
|
+
*
|
|
5
|
+
* Principles:
|
|
6
|
+
* - Opt-in only (CODEHERE_TELEMETRY_ENABLED=true)
|
|
7
|
+
* - No code/content transmitted
|
|
8
|
+
* - Anonymized data only
|
|
9
|
+
* - Local-first (stores locally, syncs if enabled)
|
|
10
|
+
*
|
|
11
|
+
* Clean Architecture: Infrastructure Layer
|
|
12
|
+
*/
|
|
13
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, appendFileSync } from 'fs';
|
|
14
|
+
import { join, dirname } from 'path';
|
|
15
|
+
import { fileURLToPath } from 'url';
|
|
16
|
+
import { randomUUID } from 'crypto';
|
|
17
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
18
|
+
const __dirname = dirname(__filename);
|
|
19
|
+
export class TelemetryService {
|
|
20
|
+
telemetryDir;
|
|
21
|
+
eventsFile;
|
|
22
|
+
configFile;
|
|
23
|
+
enabled = false;
|
|
24
|
+
anonymousId = '';
|
|
25
|
+
sessionId = '';
|
|
26
|
+
constructor() {
|
|
27
|
+
// Find codebase root
|
|
28
|
+
const codebaseRoot = this.findCodebaseRoot();
|
|
29
|
+
this.telemetryDir = join(codebaseRoot, '.codehere', 'telemetry');
|
|
30
|
+
this.eventsFile = join(this.telemetryDir, 'events.jsonl');
|
|
31
|
+
this.configFile = join(this.telemetryDir, 'config.json');
|
|
32
|
+
this.sessionId = randomUUID();
|
|
33
|
+
this.loadConfig();
|
|
34
|
+
}
|
|
35
|
+
findCodebaseRoot() {
|
|
36
|
+
let current = process.cwd();
|
|
37
|
+
while (current !== '/') {
|
|
38
|
+
if (existsSync(join(current, '.codehere'))) {
|
|
39
|
+
return current;
|
|
40
|
+
}
|
|
41
|
+
current = join(current, '..');
|
|
42
|
+
}
|
|
43
|
+
return process.cwd();
|
|
44
|
+
}
|
|
45
|
+
loadConfig() {
|
|
46
|
+
// Check environment variable first
|
|
47
|
+
const envEnabled = process.env.CODEHERE_TELEMETRY_ENABLED === 'true';
|
|
48
|
+
if (existsSync(this.configFile)) {
|
|
49
|
+
try {
|
|
50
|
+
const config = JSON.parse(readFileSync(this.configFile, 'utf-8'));
|
|
51
|
+
this.enabled = config.enabled || envEnabled;
|
|
52
|
+
this.anonymousId = config.anonymousId || this.generateAnonymousId();
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
this.enabled = envEnabled;
|
|
56
|
+
this.anonymousId = this.generateAnonymousId();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
this.enabled = envEnabled;
|
|
61
|
+
this.anonymousId = this.generateAnonymousId();
|
|
62
|
+
}
|
|
63
|
+
// Save config
|
|
64
|
+
this.saveConfig();
|
|
65
|
+
}
|
|
66
|
+
generateAnonymousId() {
|
|
67
|
+
// Generate a persistent anonymous ID (not tied to user identity)
|
|
68
|
+
return randomUUID();
|
|
69
|
+
}
|
|
70
|
+
saveConfig() {
|
|
71
|
+
if (!existsSync(this.telemetryDir)) {
|
|
72
|
+
mkdirSync(this.telemetryDir, { recursive: true });
|
|
73
|
+
}
|
|
74
|
+
writeFileSync(this.configFile, JSON.stringify({
|
|
75
|
+
enabled: this.enabled,
|
|
76
|
+
anonymousId: this.anonymousId,
|
|
77
|
+
enabledAt: this.enabled ? Date.now() : null,
|
|
78
|
+
}, null, 2));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Check if telemetry is enabled
|
|
82
|
+
*/
|
|
83
|
+
isEnabled() {
|
|
84
|
+
return this.enabled;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Enable telemetry (opt-in)
|
|
88
|
+
*/
|
|
89
|
+
enable() {
|
|
90
|
+
this.enabled = true;
|
|
91
|
+
this.saveConfig();
|
|
92
|
+
this.track('install', {
|
|
93
|
+
version: process.env.npm_package_version || 'unknown',
|
|
94
|
+
os: process.platform,
|
|
95
|
+
nodeVersion: process.version,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Disable telemetry
|
|
100
|
+
*/
|
|
101
|
+
disable() {
|
|
102
|
+
this.enabled = false;
|
|
103
|
+
this.saveConfig();
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Track an event
|
|
107
|
+
*/
|
|
108
|
+
track(eventType, data = {}) {
|
|
109
|
+
if (!this.enabled) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const event = {
|
|
113
|
+
id: randomUUID(),
|
|
114
|
+
timestamp: Date.now(),
|
|
115
|
+
eventType,
|
|
116
|
+
data: {
|
|
117
|
+
...data,
|
|
118
|
+
version: data.version || process.env.npm_package_version || 'unknown',
|
|
119
|
+
os: data.os || process.platform,
|
|
120
|
+
nodeVersion: data.nodeVersion || process.version,
|
|
121
|
+
},
|
|
122
|
+
sessionId: this.sessionId,
|
|
123
|
+
anonymousId: this.anonymousId,
|
|
124
|
+
};
|
|
125
|
+
// Write to local file
|
|
126
|
+
if (!existsSync(this.telemetryDir)) {
|
|
127
|
+
mkdirSync(this.telemetryDir, { recursive: true });
|
|
128
|
+
}
|
|
129
|
+
appendFileSync(this.eventsFile, JSON.stringify(event) + '\n');
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Track command usage
|
|
133
|
+
*/
|
|
134
|
+
trackCommand(command) {
|
|
135
|
+
this.track('command', { command });
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Track error
|
|
139
|
+
*/
|
|
140
|
+
trackError(errorType) {
|
|
141
|
+
this.track('error', { errorType });
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Track feature usage
|
|
145
|
+
*/
|
|
146
|
+
trackFeature(feature) {
|
|
147
|
+
this.track('feature_use', { feature });
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get telemetry status message
|
|
151
|
+
*/
|
|
152
|
+
getStatusMessage() {
|
|
153
|
+
if (this.enabled) {
|
|
154
|
+
return 'Telemetry: Enabled (opt-in)';
|
|
155
|
+
}
|
|
156
|
+
return 'Telemetry: Disabled (set CODEHERE_TELEMETRY_ENABLED=true to enable)';
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Singleton instance
|
|
160
|
+
let telemetryService = null;
|
|
161
|
+
export function getTelemetryService() {
|
|
162
|
+
if (!telemetryService) {
|
|
163
|
+
telemetryService = new TelemetryService();
|
|
164
|
+
}
|
|
165
|
+
return telemetryService;
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=telemetry-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-service.js","sourceRoot":"","sources":["../../../src/infrastructure/telemetry/telemetry-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AACxF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAkBtC,MAAM,OAAO,gBAAgB;IACnB,YAAY,CAAS;IACrB,UAAU,CAAS;IACnB,UAAU,CAAS;IACnB,OAAO,GAAY,KAAK,CAAC;IACzB,WAAW,GAAW,EAAE,CAAC;IACzB,SAAS,GAAW,EAAE,CAAC;IAE/B;QACE,qBAAqB;QACrB,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC7C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QACjE,IAAI,CAAC,UAAU,GAAG,IAAI,CAA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,CAAC;YACjB,OAAO,6BAA6B,CAAC;QACvC,CAAC;QACD,OAAO,qEAAqE,CAAC;IAC/E,CAAC;CACF;AAED,qBAAqB;AACrB,IAAI,gBAAgB,GAA4B,IAAI,CAAC;AAErD,MAAM,UAAU,mBAAmB;IACjC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;IAC5C,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -1,50 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Capability Boundaries
|
|
3
|
+
* Detects unsupported operations and displays boundaries
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* - Detects unsupported operation requests
|
|
7
|
-
* - Shows clear capability boundaries
|
|
8
|
-
* - Suggests alternatives when capabilities exceeded
|
|
5
|
+
* Phase 1: v0.5.0-alpha.0
|
|
9
6
|
*/
|
|
10
7
|
export interface CapabilityBoundary {
|
|
11
|
-
|
|
8
|
+
operation: string;
|
|
12
9
|
reason: string;
|
|
13
|
-
|
|
14
|
-
canSuggest?: boolean;
|
|
10
|
+
alternative?: string;
|
|
15
11
|
}
|
|
16
|
-
export
|
|
17
|
-
detectUnsupported(query: string): CapabilityBoundary | null;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Display capability boundary message when unsupported operation detected
|
|
21
|
-
*/
|
|
22
|
-
export declare function displayCapabilityBoundary(boundary: CapabilityBoundary): void;
|
|
23
|
-
/**
|
|
24
|
-
* Detect unsupported operations in user queries
|
|
25
|
-
*/
|
|
26
|
-
export declare class CapabilityBoundaryDetector implements UnsupportedOperationDetector {
|
|
27
|
-
private unsupportedPatterns;
|
|
28
|
-
constructor();
|
|
12
|
+
export declare class CapabilityBoundaryDetector {
|
|
29
13
|
/**
|
|
30
|
-
* Detect
|
|
14
|
+
* Detect unsupported operations
|
|
31
15
|
*/
|
|
32
16
|
detectUnsupported(query: string): CapabilityBoundary | null;
|
|
33
|
-
/**
|
|
34
|
-
* Extract operation from query
|
|
35
|
-
*/
|
|
36
|
-
private extractOperation;
|
|
37
|
-
/**
|
|
38
|
-
* Initialize unsupported operation patterns
|
|
39
|
-
*/
|
|
40
|
-
private initializePatterns;
|
|
41
|
-
/**
|
|
42
|
-
* Register custom unsupported pattern
|
|
43
|
-
*/
|
|
44
|
-
registerPattern(pattern: RegExp, reason: string, alternatives: string[]): void;
|
|
45
17
|
}
|
|
46
18
|
/**
|
|
47
|
-
*
|
|
19
|
+
* Display capability boundary message
|
|
48
20
|
*/
|
|
49
|
-
export declare function
|
|
21
|
+
export declare function displayCapabilityBoundary(boundary: CapabilityBoundary): void;
|
|
50
22
|
//# sourceMappingURL=capability-boundaries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability-boundaries.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/ux/capability-boundaries.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"capability-boundaries.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/ux/capability-boundaries.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,0BAA0B;IACrC;;OAEG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI;CAoB5D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAQ5E"}
|