@su-record/vibe 2.7.18 → 2.7.20
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/.env.example +37 -37
- package/CLAUDE.md +153 -153
- package/LICENSE +21 -21
- package/README.md +451 -449
- package/agents/architect-low.md +41 -41
- package/agents/architect-medium.md +59 -59
- package/agents/architect.md +80 -80
- package/agents/build-error-resolver.md +115 -115
- package/agents/compounder.md +261 -261
- package/agents/diagrammer.md +178 -178
- package/agents/docs/api-documenter.md +99 -99
- package/agents/docs/changelog-writer.md +93 -93
- package/agents/e2e-tester.md +294 -294
- package/agents/event/event-comms.md +78 -0
- package/agents/event/event-content.md +68 -0
- package/agents/event/event-image.md +95 -0
- package/agents/event/event-ops.md +84 -0
- package/agents/event/event-scheduler.md +69 -0
- package/agents/event/event-speaker.md +86 -0
- package/agents/explorer-low.md +42 -42
- package/agents/explorer-medium.md +59 -59
- package/agents/explorer.md +48 -48
- package/agents/implementer-low.md +43 -43
- package/agents/implementer-medium.md +52 -52
- package/agents/implementer.md +54 -54
- package/agents/junior-mentor.md +141 -141
- package/agents/planning/requirements-analyst.md +84 -84
- package/agents/planning/ux-advisor.md +83 -83
- package/agents/qa/acceptance-tester.md +86 -86
- package/agents/qa/edge-case-finder.md +93 -93
- package/agents/refactor-cleaner.md +143 -143
- package/agents/research/best-practices-agent.md +199 -199
- package/agents/research/codebase-patterns-agent.md +157 -157
- package/agents/research/framework-docs-agent.md +188 -188
- package/agents/research/security-advisory-agent.md +213 -213
- package/agents/review/architecture-reviewer.md +107 -107
- package/agents/review/complexity-reviewer.md +116 -116
- package/agents/review/data-integrity-reviewer.md +88 -88
- package/agents/review/git-history-reviewer.md +103 -103
- package/agents/review/performance-reviewer.md +86 -86
- package/agents/review/python-reviewer.md +150 -150
- package/agents/review/rails-reviewer.md +139 -139
- package/agents/review/react-reviewer.md +144 -144
- package/agents/review/security-reviewer.md +80 -80
- package/agents/review/simplicity-reviewer.md +140 -140
- package/agents/review/test-coverage-reviewer.md +116 -116
- package/agents/review/typescript-reviewer.md +127 -127
- package/agents/searcher.md +54 -54
- package/agents/simplifier.md +120 -120
- package/agents/tester.md +49 -49
- package/agents/ui/ui-a11y-auditor.md +93 -93
- package/agents/ui/ui-antipattern-detector.md +94 -94
- package/agents/ui/ui-dataviz-advisor.md +69 -69
- package/agents/ui/ui-design-system-gen.md +57 -57
- package/agents/ui/ui-industry-analyzer.md +49 -49
- package/agents/ui/ui-layout-architect.md +65 -65
- package/agents/ui/ui-stack-implementer.md +68 -68
- package/agents/ui/ux-compliance-reviewer.md +81 -81
- package/agents/ui-previewer.md +258 -258
- package/commands/vibe.analyze.md +379 -379
- package/commands/vibe.event.md +163 -0
- package/commands/vibe.review.md +607 -607
- package/commands/vibe.run.md +2217 -2124
- package/commands/vibe.spec.md +1195 -1195
- package/commands/vibe.spec.review.md +569 -569
- package/commands/vibe.trace.md +50 -0
- package/commands/vibe.utils.md +413 -413
- package/commands/vibe.verify.md +484 -484
- package/dist/__tests__/architecture.test.d.ts +2 -0
- package/dist/__tests__/architecture.test.d.ts.map +1 -0
- package/dist/__tests__/architecture.test.js +207 -0
- package/dist/__tests__/architecture.test.js.map +1 -0
- package/dist/cli/auth.js +3 -3
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli/collaborator.js +52 -52
- package/dist/cli/commands/evolution.js +12 -12
- package/dist/cli/commands/info.d.ts.map +1 -1
- package/dist/cli/commands/info.js +45 -81
- package/dist/cli/commands/info.js.map +1 -1
- package/dist/cli/commands/init.js +5 -5
- package/dist/cli/commands/remove.js +14 -14
- package/dist/cli/commands/sentinel.js +27 -27
- package/dist/cli/commands/skills.js +5 -5
- package/dist/cli/commands/slack.js +10 -10
- package/dist/cli/commands/telegram.js +12 -12
- package/dist/cli/detect.d.ts.map +1 -1
- package/dist/cli/detect.js +55 -32
- package/dist/cli/detect.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +52 -52
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/llm/claude-commands.js +16 -16
- package/dist/cli/llm/config.js +18 -18
- package/dist/cli/llm/gemini-commands.js +16 -16
- package/dist/cli/llm/gpt-commands.js +19 -19
- package/dist/cli/llm/help.js +21 -21
- package/dist/cli/postinstall/constants.d.ts.map +1 -1
- package/dist/cli/postinstall/constants.js +24 -0
- package/dist/cli/postinstall/constants.js.map +1 -1
- package/dist/cli/postinstall/cursor-agents.js +32 -32
- package/dist/cli/postinstall/cursor-rules.js +83 -83
- package/dist/cli/postinstall/cursor-skills.js +743 -743
- package/dist/cli/setup/Provisioner.js +42 -42
- package/dist/infra/lib/AutomationLevel.d.ts +48 -0
- package/dist/infra/lib/AutomationLevel.d.ts.map +1 -0
- package/dist/infra/lib/AutomationLevel.js +157 -0
- package/dist/infra/lib/AutomationLevel.js.map +1 -0
- package/dist/infra/lib/DecisionTracer.d.ts +81 -0
- package/dist/infra/lib/DecisionTracer.d.ts.map +1 -0
- package/dist/infra/lib/DecisionTracer.js +135 -0
- package/dist/infra/lib/DecisionTracer.js.map +1 -0
- package/dist/infra/lib/DeepInit.js +24 -24
- package/dist/infra/lib/InteractiveCheckpoint.d.ts +75 -0
- package/dist/infra/lib/InteractiveCheckpoint.d.ts.map +1 -0
- package/dist/infra/lib/InteractiveCheckpoint.js +179 -0
- package/dist/infra/lib/InteractiveCheckpoint.js.map +1 -0
- package/dist/infra/lib/IterationTracker.d.ts +44 -0
- package/dist/infra/lib/IterationTracker.d.ts.map +1 -1
- package/dist/infra/lib/IterationTracker.js +267 -12
- package/dist/infra/lib/IterationTracker.js.map +1 -1
- package/dist/infra/lib/LoopBreaker.d.ts +56 -0
- package/dist/infra/lib/LoopBreaker.d.ts.map +1 -0
- package/dist/infra/lib/LoopBreaker.js +109 -0
- package/dist/infra/lib/LoopBreaker.js.map +1 -0
- package/dist/infra/lib/PythonParser.js +108 -108
- package/dist/infra/lib/ReviewRace.js +96 -96
- package/dist/infra/lib/SkillFrontmatter.js +28 -28
- package/dist/infra/lib/SkillQualityGate.js +9 -9
- package/dist/infra/lib/SkillRepository.js +159 -159
- package/dist/infra/lib/UltraQA.js +99 -99
- package/dist/infra/lib/VerificationLoop.d.ts +105 -0
- package/dist/infra/lib/VerificationLoop.d.ts.map +1 -0
- package/dist/infra/lib/VerificationLoop.js +189 -0
- package/dist/infra/lib/VerificationLoop.js.map +1 -0
- package/dist/infra/lib/__tests__/AutomationLevel.test.d.ts +2 -0
- package/dist/infra/lib/__tests__/AutomationLevel.test.d.ts.map +1 -0
- package/dist/infra/lib/__tests__/AutomationLevel.test.js +297 -0
- package/dist/infra/lib/__tests__/AutomationLevel.test.js.map +1 -0
- package/dist/infra/lib/__tests__/DecisionTracer.test.d.ts +2 -0
- package/dist/infra/lib/__tests__/DecisionTracer.test.d.ts.map +1 -0
- package/dist/infra/lib/__tests__/DecisionTracer.test.js +274 -0
- package/dist/infra/lib/__tests__/DecisionTracer.test.js.map +1 -0
- package/dist/infra/lib/__tests__/InteractiveCheckpoint.test.d.ts +2 -0
- package/dist/infra/lib/__tests__/InteractiveCheckpoint.test.d.ts.map +1 -0
- package/dist/infra/lib/__tests__/InteractiveCheckpoint.test.js +350 -0
- package/dist/infra/lib/__tests__/InteractiveCheckpoint.test.js.map +1 -0
- package/dist/infra/lib/__tests__/LoopBreaker.test.d.ts +2 -0
- package/dist/infra/lib/__tests__/LoopBreaker.test.d.ts.map +1 -0
- package/dist/infra/lib/__tests__/LoopBreaker.test.js +340 -0
- package/dist/infra/lib/__tests__/LoopBreaker.test.js.map +1 -0
- package/dist/infra/lib/__tests__/VerificationLoop.test.d.ts +2 -0
- package/dist/infra/lib/__tests__/VerificationLoop.test.d.ts.map +1 -0
- package/dist/infra/lib/__tests__/VerificationLoop.test.js +486 -0
- package/dist/infra/lib/__tests__/VerificationLoop.test.js.map +1 -0
- package/dist/infra/lib/autonomy/AuditStore.js +41 -41
- package/dist/infra/lib/autonomy/ConfirmationStore.js +30 -30
- package/dist/infra/lib/autonomy/EventOutbox.js +38 -38
- package/dist/infra/lib/autonomy/PolicyEngine.d.ts +3 -3
- package/dist/infra/lib/autonomy/PolicyEngine.js +18 -18
- package/dist/infra/lib/autonomy/SecuritySentinel.js +1 -1
- package/dist/infra/lib/autonomy/SuggestionStore.js +33 -33
- package/dist/infra/lib/embedding/VectorStore.js +22 -22
- package/dist/infra/lib/embedding/__tests__/EmbeddingProvider.test.js +4 -0
- package/dist/infra/lib/embedding/__tests__/EmbeddingProvider.test.js.map +1 -1
- package/dist/infra/lib/evolution/AgentAnalyzer.js +10 -10
- package/dist/infra/lib/evolution/DeprecationDetector.d.ts +68 -0
- package/dist/infra/lib/evolution/DeprecationDetector.d.ts.map +1 -0
- package/dist/infra/lib/evolution/DeprecationDetector.js +207 -0
- package/dist/infra/lib/evolution/DeprecationDetector.js.map +1 -0
- package/dist/infra/lib/evolution/DescriptionOptimizer.js +21 -21
- package/dist/infra/lib/evolution/GenerationRegistry.js +36 -36
- package/dist/infra/lib/evolution/InsightStore.js +90 -90
- package/dist/infra/lib/evolution/ParityTester.d.ts +74 -0
- package/dist/infra/lib/evolution/ParityTester.d.ts.map +1 -0
- package/dist/infra/lib/evolution/ParityTester.js +238 -0
- package/dist/infra/lib/evolution/ParityTester.js.map +1 -0
- package/dist/infra/lib/evolution/RollbackManager.js +5 -5
- package/dist/infra/lib/evolution/SkillBenchmark.js +23 -23
- package/dist/infra/lib/evolution/SkillEvalRunner.js +50 -50
- package/dist/infra/lib/evolution/SkillGapDetector.js +10 -10
- package/dist/infra/lib/evolution/UsageTracker.js +28 -28
- package/dist/infra/lib/evolution/__tests__/deprecation.test.d.ts +2 -0
- package/dist/infra/lib/evolution/__tests__/deprecation.test.d.ts.map +1 -0
- package/dist/infra/lib/evolution/__tests__/deprecation.test.js +251 -0
- package/dist/infra/lib/evolution/__tests__/deprecation.test.js.map +1 -0
- package/dist/infra/lib/evolution/__tests__/parity.test.d.ts +2 -0
- package/dist/infra/lib/evolution/__tests__/parity.test.d.ts.map +1 -0
- package/dist/infra/lib/evolution/__tests__/parity.test.js +319 -0
- package/dist/infra/lib/evolution/__tests__/parity.test.js.map +1 -0
- package/dist/infra/lib/evolution/index.d.ts +4 -0
- package/dist/infra/lib/evolution/index.d.ts.map +1 -1
- package/dist/infra/lib/evolution/index.js +3 -0
- package/dist/infra/lib/evolution/index.js.map +1 -1
- package/dist/infra/lib/gemini/orchestration.js +5 -5
- package/dist/infra/lib/gpt/orchestration.js +4 -4
- package/dist/infra/lib/gpt/specializations.d.ts +1 -1
- package/dist/infra/lib/gpt/specializations.js +1 -1
- package/dist/infra/lib/memory/KnowledgeGraph.js +4 -4
- package/dist/infra/lib/memory/MemorySearch.js +57 -57
- package/dist/infra/lib/memory/MemoryStorage.js +181 -181
- package/dist/infra/lib/memory/ObservationStore.js +28 -28
- package/dist/infra/lib/memory/ReflectionStore.js +30 -30
- package/dist/infra/lib/memory/SessionRAGRetriever.js +7 -7
- package/dist/infra/lib/memory/SessionRAGStore.js +225 -225
- package/dist/infra/lib/memory/SessionSummarizer.js +9 -9
- package/dist/infra/lib/telemetry/SkillTelemetry.d.ts +6 -0
- package/dist/infra/lib/telemetry/SkillTelemetry.d.ts.map +1 -1
- package/dist/infra/lib/telemetry/SkillTelemetry.js +11 -0
- package/dist/infra/lib/telemetry/SkillTelemetry.js.map +1 -1
- package/dist/infra/orchestrator/AgentManager.js +12 -12
- package/dist/infra/orchestrator/AgentRegistry.js +65 -65
- package/dist/infra/orchestrator/BackgroundManager.d.ts.map +1 -1
- package/dist/infra/orchestrator/BackgroundManager.js +2 -0
- package/dist/infra/orchestrator/BackgroundManager.js.map +1 -1
- package/dist/infra/orchestrator/MultiLlmResearch.js +8 -8
- package/dist/infra/orchestrator/PhasePipeline.js +1 -1
- package/dist/infra/orchestrator/PhasePipeline.js.map +1 -1
- package/dist/infra/orchestrator/SwarmOrchestrator.test.js +16 -16
- package/dist/infra/orchestrator/parallelResearch.js +24 -24
- package/dist/tools/convention/analyzeComplexity.test.js +115 -115
- package/dist/tools/convention/validateCodeQuality.test.js +104 -104
- package/dist/tools/index.d.ts +16 -19
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +15 -27
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/memory/createMemoryTimeline.js +10 -10
- package/dist/tools/memory/getMemoryGraph.js +12 -12
- package/dist/tools/memory/getSessionContext.js +9 -9
- package/dist/tools/memory/linkMemories.js +14 -14
- package/dist/tools/memory/listMemories.js +4 -4
- package/dist/tools/memory/recallMemory.js +4 -4
- package/dist/tools/memory/saveMemory.js +4 -4
- package/dist/tools/memory/searchMemoriesAdvanced.js +23 -23
- package/dist/tools/memory/startSession.js +1 -1
- package/dist/tools/memory/startSession.js.map +1 -1
- package/dist/tools/semantic/analyzeDependencyGraph.js +12 -12
- package/dist/tools/semantic/astGrep.test.js +6 -6
- package/dist/tools/spec/index.d.ts +0 -4
- package/dist/tools/spec/index.d.ts.map +1 -1
- package/dist/tools/spec/index.js +0 -4
- package/dist/tools/spec/index.js.map +1 -1
- package/dist/tools/spec/prdParser.test.js +171 -171
- package/dist/tools/spec/specGenerator.js +169 -169
- package/dist/tools/spec/traceabilityMatrix.js +64 -64
- package/dist/tools/spec/traceabilityMatrix.test.js +28 -28
- package/hooks/gemini-hooks.json +73 -73
- package/hooks/hooks.json +137 -137
- package/hooks/scripts/code-check.js +77 -77
- package/hooks/scripts/context-save.js +212 -212
- package/hooks/scripts/evolution-engine.js +69 -0
- package/hooks/scripts/hud-status.js +291 -291
- package/hooks/scripts/keyword-detector.js +214 -214
- package/hooks/scripts/llm-orchestrate.js +475 -475
- package/hooks/scripts/post-edit.js +32 -32
- package/hooks/scripts/pre-tool-guard.js +125 -125
- package/hooks/scripts/prompt-dispatcher.js +185 -185
- package/hooks/scripts/sentinel-guard.js +104 -104
- package/hooks/scripts/session-start.js +106 -106
- package/hooks/scripts/skill-injector.js +83 -0
- package/hooks/scripts/stop-notify.js +209 -209
- package/hooks/scripts/utils.js +100 -100
- package/languages/csharp-unity.md +515 -515
- package/languages/gdscript-godot.md +470 -470
- package/languages/ruby-rails.md +489 -489
- package/languages/typescript-angular.md +433 -433
- package/languages/typescript-astro.md +416 -416
- package/languages/typescript-electron.md +406 -406
- package/languages/typescript-nestjs.md +524 -524
- package/languages/typescript-svelte.md +407 -407
- package/languages/typescript-tauri.md +365 -365
- package/package.json +101 -123
- package/skills/agents-md/SKILL.md +120 -120
- package/skills/arch-guard/SKILL.md +180 -180
- package/skills/brand-assets/SKILL.md +146 -146
- package/skills/capability-loop/SKILL.md +167 -167
- package/skills/characterization-test/SKILL.md +206 -206
- package/skills/commerce-patterns/SKILL.md +63 -63
- package/skills/commit-push-pr/SKILL.md +75 -75
- package/skills/context7-usage/SKILL.md +105 -105
- package/skills/core-capabilities/SKILL.md +13 -13
- package/skills/e2e-commerce/SKILL.md +61 -61
- package/skills/event-comms/SKILL.md +161 -0
- package/skills/event-ops/SKILL.md +197 -0
- package/skills/event-planning/SKILL.md +131 -0
- package/skills/exec-plan/SKILL.md +147 -147
- package/skills/frontend-design/SKILL.md +12 -12
- package/skills/git-worktree/SKILL.md +72 -72
- package/skills/handoff/SKILL.md +109 -109
- package/skills/parallel-research/SKILL.md +87 -87
- package/skills/priority-todos/SKILL.md +63 -63
- package/skills/seo-checklist/SKILL.md +57 -57
- package/skills/techdebt/SKILL.md +122 -122
- package/skills/tool-fallback/SKILL.md +103 -103
- package/skills/typescript-advanced-types/SKILL.md +66 -66
- package/skills/ui-ux-pro-max/SKILL.md +221 -221
- package/skills/vercel-react-best-practices/SKILL.md +59 -59
- package/skills/video-production/SKILL.md +51 -51
- package/vibe/config.json +29 -29
- package/vibe/constitution.md +227 -227
- package/vibe/rules/principles/communication-guide.md +98 -98
- package/vibe/rules/principles/development-philosophy.md +52 -52
- package/vibe/rules/principles/quick-start.md +102 -102
- package/vibe/rules/quality/bdd-contract-testing.md +393 -393
- package/vibe/rules/quality/checklist.md +276 -276
- package/vibe/rules/quality/performance.md +236 -236
- package/vibe/rules/quality/testing-strategy.md +440 -440
- package/vibe/rules/standards/anti-patterns.md +541 -541
- package/vibe/rules/standards/code-structure.md +291 -291
- package/vibe/rules/standards/complexity-metrics.md +313 -313
- package/vibe/rules/standards/git-workflow.md +237 -237
- package/vibe/rules/standards/naming-conventions.md +198 -198
- package/vibe/rules/standards/security.md +305 -305
- package/vibe/rules/writing/document-style.md +74 -74
- package/vibe/setup.sh +31 -31
- package/vibe/templates/constitution-template.md +252 -252
- package/vibe/templates/contract-backend-template.md +526 -526
- package/vibe/templates/contract-frontend-template.md +599 -599
- package/vibe/templates/feature-template.md +96 -96
- package/vibe/templates/spec-template.md +221 -221
- package/vibe/ui-ux-data/charts.csv +26 -26
- package/vibe/ui-ux-data/colors.csv +97 -97
- package/vibe/ui-ux-data/icons.csv +101 -101
- package/vibe/ui-ux-data/landing.csv +31 -31
- package/vibe/ui-ux-data/products.csv +96 -96
- package/vibe/ui-ux-data/react-performance.csv +45 -45
- package/vibe/ui-ux-data/stacks/astro.csv +54 -54
- package/vibe/ui-ux-data/stacks/flutter.csv +53 -53
- package/vibe/ui-ux-data/stacks/html-tailwind.csv +56 -56
- package/vibe/ui-ux-data/stacks/jetpack-compose.csv +53 -53
- package/vibe/ui-ux-data/stacks/nextjs.csv +53 -53
- package/vibe/ui-ux-data/stacks/nuxt-ui.csv +51 -51
- package/vibe/ui-ux-data/stacks/nuxtjs.csv +59 -59
- package/vibe/ui-ux-data/stacks/react-native.csv +52 -52
- package/vibe/ui-ux-data/stacks/react.csv +54 -54
- package/vibe/ui-ux-data/stacks/shadcn.csv +61 -61
- package/vibe/ui-ux-data/stacks/svelte.csv +54 -54
- package/vibe/ui-ux-data/stacks/swiftui.csv +51 -51
- package/vibe/ui-ux-data/stacks/vue.csv +50 -50
- package/vibe/ui-ux-data/styles.csv +68 -68
- package/vibe/ui-ux-data/typography.csv +57 -57
- package/vibe/ui-ux-data/ui-reasoning.csv +101 -101
- package/vibe/ui-ux-data/ux-guidelines.csv +99 -99
- package/vibe/ui-ux-data/version.json +31 -31
- package/vibe/ui-ux-data/web-interface.csv +31 -31
|
@@ -20,41 +20,41 @@ export class ConfirmationStore {
|
|
|
20
20
|
constructor(storage) {
|
|
21
21
|
this.db = storage.getDatabase();
|
|
22
22
|
this.initTables();
|
|
23
|
-
this.insertStmt = this.db.prepare(`
|
|
24
|
-
INSERT INTO confirmations
|
|
25
|
-
(id, correlationId, actionType, actionSummary, riskLevel, riskScore, riskFactors,
|
|
26
|
-
status, expiresAt, idempotencyKey, createdAt)
|
|
27
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, 'pending', ?, ?, ?)
|
|
23
|
+
this.insertStmt = this.db.prepare(`
|
|
24
|
+
INSERT INTO confirmations
|
|
25
|
+
(id, correlationId, actionType, actionSummary, riskLevel, riskScore, riskFactors,
|
|
26
|
+
status, expiresAt, idempotencyKey, createdAt)
|
|
27
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, 'pending', ?, ?, ?)
|
|
28
28
|
`);
|
|
29
|
-
this.resolveStmt = this.db.prepare(`
|
|
30
|
-
UPDATE confirmations SET status = ?, respondedAt = ?, ownerResponse = ?
|
|
31
|
-
WHERE id = ? AND status = 'pending'
|
|
29
|
+
this.resolveStmt = this.db.prepare(`
|
|
30
|
+
UPDATE confirmations SET status = ?, respondedAt = ?, ownerResponse = ?
|
|
31
|
+
WHERE id = ? AND status = 'pending'
|
|
32
32
|
`);
|
|
33
33
|
this.getByIdStmt = this.db.prepare('SELECT * FROM confirmations WHERE id = ?');
|
|
34
34
|
}
|
|
35
35
|
initTables() {
|
|
36
|
-
this.db.exec(`
|
|
37
|
-
CREATE TABLE IF NOT EXISTS confirmations (
|
|
38
|
-
id TEXT PRIMARY KEY,
|
|
39
|
-
correlationId TEXT NOT NULL,
|
|
40
|
-
actionType TEXT NOT NULL,
|
|
41
|
-
actionSummary TEXT NOT NULL,
|
|
42
|
-
riskLevel TEXT NOT NULL,
|
|
43
|
-
riskScore INTEGER NOT NULL,
|
|
44
|
-
riskFactors TEXT NOT NULL,
|
|
45
|
-
status TEXT NOT NULL DEFAULT 'pending'
|
|
46
|
-
CHECK(status IN ('pending', 'approved', 'rejected', 'expired', 'cancelled')),
|
|
47
|
-
channel TEXT,
|
|
48
|
-
notifiedAt TEXT,
|
|
49
|
-
respondedAt TEXT,
|
|
50
|
-
ownerResponse TEXT,
|
|
51
|
-
expiresAt TEXT NOT NULL,
|
|
52
|
-
idempotencyKey TEXT UNIQUE,
|
|
53
|
-
createdAt TEXT NOT NULL
|
|
54
|
-
);
|
|
55
|
-
CREATE INDEX IF NOT EXISTS idx_confirmation_status_expires ON confirmations(status, expiresAt);
|
|
56
|
-
CREATE INDEX IF NOT EXISTS idx_confirmation_correlation ON confirmations(correlationId);
|
|
57
|
-
CREATE INDEX IF NOT EXISTS idx_confirmation_idempotency ON confirmations(idempotencyKey);
|
|
36
|
+
this.db.exec(`
|
|
37
|
+
CREATE TABLE IF NOT EXISTS confirmations (
|
|
38
|
+
id TEXT PRIMARY KEY,
|
|
39
|
+
correlationId TEXT NOT NULL,
|
|
40
|
+
actionType TEXT NOT NULL,
|
|
41
|
+
actionSummary TEXT NOT NULL,
|
|
42
|
+
riskLevel TEXT NOT NULL,
|
|
43
|
+
riskScore INTEGER NOT NULL,
|
|
44
|
+
riskFactors TEXT NOT NULL,
|
|
45
|
+
status TEXT NOT NULL DEFAULT 'pending'
|
|
46
|
+
CHECK(status IN ('pending', 'approved', 'rejected', 'expired', 'cancelled')),
|
|
47
|
+
channel TEXT,
|
|
48
|
+
notifiedAt TEXT,
|
|
49
|
+
respondedAt TEXT,
|
|
50
|
+
ownerResponse TEXT,
|
|
51
|
+
expiresAt TEXT NOT NULL,
|
|
52
|
+
idempotencyKey TEXT UNIQUE,
|
|
53
|
+
createdAt TEXT NOT NULL
|
|
54
|
+
);
|
|
55
|
+
CREATE INDEX IF NOT EXISTS idx_confirmation_status_expires ON confirmations(status, expiresAt);
|
|
56
|
+
CREATE INDEX IF NOT EXISTS idx_confirmation_correlation ON confirmations(correlationId);
|
|
57
|
+
CREATE INDEX IF NOT EXISTS idx_confirmation_idempotency ON confirmations(idempotencyKey);
|
|
58
58
|
`);
|
|
59
59
|
}
|
|
60
60
|
create(input) {
|
|
@@ -18,52 +18,52 @@ export class EventOutbox {
|
|
|
18
18
|
this.db = storage.getDatabase();
|
|
19
19
|
this.eventBus = eventBus;
|
|
20
20
|
this.initTables();
|
|
21
|
-
this.enqueueStmt = this.db.prepare(`
|
|
22
|
-
INSERT INTO event_outbox (id, eventType, payload, status, retryCount, createdAt)
|
|
23
|
-
VALUES (?, ?, ?, 'pending', 0, ?)
|
|
21
|
+
this.enqueueStmt = this.db.prepare(`
|
|
22
|
+
INSERT INTO event_outbox (id, eventType, payload, status, retryCount, createdAt)
|
|
23
|
+
VALUES (?, ?, ?, 'pending', 0, ?)
|
|
24
24
|
`);
|
|
25
|
-
this.markProcessingStmt = this.db.prepare(`
|
|
26
|
-
UPDATE event_outbox SET status = 'processing' WHERE id = ? AND status = 'pending'
|
|
25
|
+
this.markProcessingStmt = this.db.prepare(`
|
|
26
|
+
UPDATE event_outbox SET status = 'processing' WHERE id = ? AND status = 'pending'
|
|
27
27
|
`);
|
|
28
|
-
this.markPublishedStmt = this.db.prepare(`
|
|
29
|
-
UPDATE event_outbox SET status = 'published', publishedAt = ? WHERE id = ?
|
|
28
|
+
this.markPublishedStmt = this.db.prepare(`
|
|
29
|
+
UPDATE event_outbox SET status = 'published', publishedAt = ? WHERE id = ?
|
|
30
30
|
`);
|
|
31
|
-
this.markPendingRetryStmt = this.db.prepare(`
|
|
32
|
-
UPDATE event_outbox SET status = 'pending', retryCount = retryCount + 1, lastRetryAt = ? WHERE id = ?
|
|
31
|
+
this.markPendingRetryStmt = this.db.prepare(`
|
|
32
|
+
UPDATE event_outbox SET status = 'pending', retryCount = retryCount + 1, lastRetryAt = ? WHERE id = ?
|
|
33
33
|
`);
|
|
34
|
-
this.markFailedStmt = this.db.prepare(`
|
|
35
|
-
UPDATE event_outbox SET status = 'failed' WHERE id = ?
|
|
34
|
+
this.markFailedStmt = this.db.prepare(`
|
|
35
|
+
UPDATE event_outbox SET status = 'failed' WHERE id = ?
|
|
36
36
|
`);
|
|
37
|
-
this.moveToDeadLetterStmt = this.db.prepare(`
|
|
38
|
-
INSERT INTO dead_letter_events (id, originalEventId, eventType, payload, error, retryCount, failedAt)
|
|
39
|
-
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
37
|
+
this.moveToDeadLetterStmt = this.db.prepare(`
|
|
38
|
+
INSERT INTO dead_letter_events (id, originalEventId, eventType, payload, error, retryCount, failedAt)
|
|
39
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
40
40
|
`);
|
|
41
41
|
}
|
|
42
42
|
initTables() {
|
|
43
|
-
this.db.exec(`
|
|
44
|
-
CREATE TABLE IF NOT EXISTS event_outbox (
|
|
45
|
-
id TEXT PRIMARY KEY,
|
|
46
|
-
eventType TEXT NOT NULL,
|
|
47
|
-
payload TEXT NOT NULL,
|
|
48
|
-
status TEXT DEFAULT 'pending' CHECK(status IN ('pending', 'processing', 'published', 'failed')),
|
|
49
|
-
retryCount INTEGER DEFAULT 0,
|
|
50
|
-
lastRetryAt TEXT,
|
|
51
|
-
createdAt TEXT NOT NULL,
|
|
52
|
-
publishedAt TEXT
|
|
53
|
-
);
|
|
54
|
-
CREATE INDEX IF NOT EXISTS idx_outbox_status ON event_outbox(status, createdAt);
|
|
55
|
-
|
|
56
|
-
CREATE TABLE IF NOT EXISTS dead_letter_events (
|
|
57
|
-
id TEXT PRIMARY KEY,
|
|
58
|
-
originalEventId TEXT NOT NULL,
|
|
59
|
-
eventType TEXT NOT NULL,
|
|
60
|
-
payload TEXT NOT NULL,
|
|
61
|
-
error TEXT NOT NULL,
|
|
62
|
-
retryCount INTEGER NOT NULL,
|
|
63
|
-
failedAt TEXT NOT NULL,
|
|
64
|
-
resolvedAt TEXT,
|
|
65
|
-
status TEXT DEFAULT 'failed' CHECK(status IN ('failed', 'retried', 'discarded'))
|
|
66
|
-
);
|
|
43
|
+
this.db.exec(`
|
|
44
|
+
CREATE TABLE IF NOT EXISTS event_outbox (
|
|
45
|
+
id TEXT PRIMARY KEY,
|
|
46
|
+
eventType TEXT NOT NULL,
|
|
47
|
+
payload TEXT NOT NULL,
|
|
48
|
+
status TEXT DEFAULT 'pending' CHECK(status IN ('pending', 'processing', 'published', 'failed')),
|
|
49
|
+
retryCount INTEGER DEFAULT 0,
|
|
50
|
+
lastRetryAt TEXT,
|
|
51
|
+
createdAt TEXT NOT NULL,
|
|
52
|
+
publishedAt TEXT
|
|
53
|
+
);
|
|
54
|
+
CREATE INDEX IF NOT EXISTS idx_outbox_status ON event_outbox(status, createdAt);
|
|
55
|
+
|
|
56
|
+
CREATE TABLE IF NOT EXISTS dead_letter_events (
|
|
57
|
+
id TEXT PRIMARY KEY,
|
|
58
|
+
originalEventId TEXT NOT NULL,
|
|
59
|
+
eventType TEXT NOT NULL,
|
|
60
|
+
payload TEXT NOT NULL,
|
|
61
|
+
error TEXT NOT NULL,
|
|
62
|
+
retryCount INTEGER NOT NULL,
|
|
63
|
+
failedAt TEXT NOT NULL,
|
|
64
|
+
resolvedAt TEXT,
|
|
65
|
+
status TEXT DEFAULT 'failed' CHECK(status IN ('failed', 'retried', 'discarded'))
|
|
66
|
+
);
|
|
67
67
|
`);
|
|
68
68
|
}
|
|
69
69
|
enqueue(event) {
|
|
@@ -11,13 +11,13 @@ declare const PolicyRuleSchema: z.ZodObject<{
|
|
|
11
11
|
params: "params";
|
|
12
12
|
}>;
|
|
13
13
|
operator: z.ZodEnum<{
|
|
14
|
-
in: "in";
|
|
15
|
-
eq: "eq";
|
|
16
|
-
neq: "neq";
|
|
17
14
|
contains: "contains";
|
|
15
|
+
eq: "eq";
|
|
18
16
|
matches: "matches";
|
|
19
17
|
gt: "gt";
|
|
20
18
|
lt: "lt";
|
|
19
|
+
in: "in";
|
|
20
|
+
neq: "neq";
|
|
21
21
|
}>;
|
|
22
22
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNumber]>;
|
|
23
23
|
}, z.core.$strip>;
|
|
@@ -63,26 +63,26 @@ export class PolicyEngine {
|
|
|
63
63
|
this.allPoliciesStmt = this.db.prepare(`SELECT * FROM policies WHERE enabled = 1 ORDER BY priority DESC, createdAt ASC`);
|
|
64
64
|
}
|
|
65
65
|
initTables() {
|
|
66
|
-
this.db.exec(`
|
|
67
|
-
CREATE TABLE IF NOT EXISTS policies (
|
|
68
|
-
id TEXT PRIMARY KEY,
|
|
69
|
-
name TEXT NOT NULL UNIQUE,
|
|
70
|
-
description TEXT,
|
|
71
|
-
rules TEXT NOT NULL,
|
|
72
|
-
action TEXT NOT NULL DEFAULT 'block'
|
|
73
|
-
CHECK(action IN ('block', 'require_confirmation', 'allow')),
|
|
74
|
-
priority INTEGER DEFAULT 0,
|
|
75
|
-
enabled INTEGER DEFAULT 1,
|
|
76
|
-
version INTEGER DEFAULT 1,
|
|
77
|
-
createdAt TEXT NOT NULL,
|
|
78
|
-
updatedAt TEXT NOT NULL
|
|
79
|
-
);
|
|
66
|
+
this.db.exec(`
|
|
67
|
+
CREATE TABLE IF NOT EXISTS policies (
|
|
68
|
+
id TEXT PRIMARY KEY,
|
|
69
|
+
name TEXT NOT NULL UNIQUE,
|
|
70
|
+
description TEXT,
|
|
71
|
+
rules TEXT NOT NULL,
|
|
72
|
+
action TEXT NOT NULL DEFAULT 'block'
|
|
73
|
+
CHECK(action IN ('block', 'require_confirmation', 'allow')),
|
|
74
|
+
priority INTEGER DEFAULT 0,
|
|
75
|
+
enabled INTEGER DEFAULT 1,
|
|
76
|
+
version INTEGER DEFAULT 1,
|
|
77
|
+
createdAt TEXT NOT NULL,
|
|
78
|
+
updatedAt TEXT NOT NULL
|
|
79
|
+
);
|
|
80
80
|
`);
|
|
81
81
|
}
|
|
82
82
|
seedDefaultPolicies() {
|
|
83
|
-
const insertOrIgnore = this.db.prepare(`
|
|
84
|
-
INSERT OR IGNORE INTO policies (id, name, description, rules, action, priority, enabled, version, createdAt, updatedAt)
|
|
85
|
-
VALUES (?, ?, ?, ?, ?, ?, 1, 1, ?, ?)
|
|
83
|
+
const insertOrIgnore = this.db.prepare(`
|
|
84
|
+
INSERT OR IGNORE INTO policies (id, name, description, rules, action, priority, enabled, version, createdAt, updatedAt)
|
|
85
|
+
VALUES (?, ?, ?, ?, ?, ?, 1, 1, ?, ?)
|
|
86
86
|
`);
|
|
87
87
|
const now = new Date().toISOString();
|
|
88
88
|
const txn = this.db.transaction(() => {
|
|
@@ -114,7 +114,7 @@ export class PolicyEngine {
|
|
|
114
114
|
PolicyRuleSchema.parse(rule);
|
|
115
115
|
}
|
|
116
116
|
this.db
|
|
117
|
-
.prepare(`INSERT INTO policies (id, name, description, rules, action, priority, enabled, version, createdAt, updatedAt)
|
|
117
|
+
.prepare(`INSERT INTO policies (id, name, description, rules, action, priority, enabled, version, createdAt, updatedAt)
|
|
118
118
|
VALUES (?, ?, ?, ?, ?, ?, 1, 1, ?, ?)`)
|
|
119
119
|
.run(id, policy.name, policy.description ?? null, JSON.stringify(policy.rules), policy.action, policy.priority ?? 0, now, now);
|
|
120
120
|
return id;
|
|
@@ -30,7 +30,7 @@ export class SecuritySentinel {
|
|
|
30
30
|
this.auditStore = deps.auditStore;
|
|
31
31
|
this.db = deps.storage.getDatabase();
|
|
32
32
|
this.projectRoot = deps.projectRoot ?? process.cwd();
|
|
33
|
-
this.recentDeleteStmt = this.db.prepare(`SELECT COUNT(*) as count FROM audit_events
|
|
33
|
+
this.recentDeleteStmt = this.db.prepare(`SELECT COUNT(*) as count FROM audit_events
|
|
34
34
|
WHERE agentId = ? AND actionType = 'file_delete' AND createdAt >= ?`);
|
|
35
35
|
}
|
|
36
36
|
static getInstance(deps) {
|
|
@@ -8,41 +8,41 @@ export class SuggestionStore {
|
|
|
8
8
|
constructor(storage) {
|
|
9
9
|
this.db = storage.getDatabase();
|
|
10
10
|
this.initTables();
|
|
11
|
-
this.insertStmt = this.db.prepare(`
|
|
12
|
-
INSERT INTO suggestions
|
|
13
|
-
(id, type, title, description, priority, evidence, suggestedAction, status, riskLevel, sourceModule, createdAt)
|
|
14
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, 'pending', ?, ?, ?)
|
|
11
|
+
this.insertStmt = this.db.prepare(`
|
|
12
|
+
INSERT INTO suggestions
|
|
13
|
+
(id, type, title, description, priority, evidence, suggestedAction, status, riskLevel, sourceModule, createdAt)
|
|
14
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, 'pending', ?, ?, ?)
|
|
15
15
|
`);
|
|
16
16
|
}
|
|
17
17
|
initTables() {
|
|
18
|
-
this.db.exec(`
|
|
19
|
-
CREATE TABLE IF NOT EXISTS suggestions (
|
|
20
|
-
id TEXT PRIMARY KEY,
|
|
21
|
-
type TEXT NOT NULL CHECK(type IN ('security','performance','quality','dependency','pattern')),
|
|
22
|
-
title TEXT NOT NULL,
|
|
23
|
-
description TEXT NOT NULL,
|
|
24
|
-
priority INTEGER NOT NULL CHECK(priority BETWEEN 1 AND 5),
|
|
25
|
-
evidence TEXT NOT NULL,
|
|
26
|
-
suggestedAction TEXT,
|
|
27
|
-
status TEXT DEFAULT 'pending' CHECK(status IN ('pending','accepted','dismissed','auto_applied')),
|
|
28
|
-
riskLevel TEXT DEFAULT 'LOW',
|
|
29
|
-
sourceModule TEXT NOT NULL,
|
|
30
|
-
createdAt TEXT NOT NULL,
|
|
31
|
-
resolvedAt TEXT
|
|
32
|
-
);
|
|
33
|
-
CREATE INDEX IF NOT EXISTS idx_suggestion_status_priority ON suggestions(status, priority);
|
|
34
|
-
CREATE INDEX IF NOT EXISTS idx_suggestion_type_created ON suggestions(type, createdAt);
|
|
18
|
+
this.db.exec(`
|
|
19
|
+
CREATE TABLE IF NOT EXISTS suggestions (
|
|
20
|
+
id TEXT PRIMARY KEY,
|
|
21
|
+
type TEXT NOT NULL CHECK(type IN ('security','performance','quality','dependency','pattern')),
|
|
22
|
+
title TEXT NOT NULL,
|
|
23
|
+
description TEXT NOT NULL,
|
|
24
|
+
priority INTEGER NOT NULL CHECK(priority BETWEEN 1 AND 5),
|
|
25
|
+
evidence TEXT NOT NULL,
|
|
26
|
+
suggestedAction TEXT,
|
|
27
|
+
status TEXT DEFAULT 'pending' CHECK(status IN ('pending','accepted','dismissed','auto_applied')),
|
|
28
|
+
riskLevel TEXT DEFAULT 'LOW',
|
|
29
|
+
sourceModule TEXT NOT NULL,
|
|
30
|
+
createdAt TEXT NOT NULL,
|
|
31
|
+
resolvedAt TEXT
|
|
32
|
+
);
|
|
33
|
+
CREATE INDEX IF NOT EXISTS idx_suggestion_status_priority ON suggestions(status, priority);
|
|
34
|
+
CREATE INDEX IF NOT EXISTS idx_suggestion_type_created ON suggestions(type, createdAt);
|
|
35
35
|
`);
|
|
36
36
|
try {
|
|
37
|
-
this.db.exec(`
|
|
38
|
-
CREATE VIRTUAL TABLE IF NOT EXISTS suggestions_fts USING fts5(
|
|
39
|
-
title, description,
|
|
40
|
-
content='suggestions', content_rowid='rowid'
|
|
41
|
-
);
|
|
42
|
-
CREATE TRIGGER IF NOT EXISTS suggestions_fts_ai AFTER INSERT ON suggestions BEGIN
|
|
43
|
-
INSERT INTO suggestions_fts(rowid, title, description)
|
|
44
|
-
VALUES (new.rowid, new.title, new.description);
|
|
45
|
-
END;
|
|
37
|
+
this.db.exec(`
|
|
38
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS suggestions_fts USING fts5(
|
|
39
|
+
title, description,
|
|
40
|
+
content='suggestions', content_rowid='rowid'
|
|
41
|
+
);
|
|
42
|
+
CREATE TRIGGER IF NOT EXISTS suggestions_fts_ai AFTER INSERT ON suggestions BEGIN
|
|
43
|
+
INSERT INTO suggestions_fts(rowid, title, description)
|
|
44
|
+
VALUES (new.rowid, new.title, new.description);
|
|
45
|
+
END;
|
|
46
46
|
`);
|
|
47
47
|
this.fts5Available = true;
|
|
48
48
|
}
|
|
@@ -102,9 +102,9 @@ export class SuggestionStore {
|
|
|
102
102
|
return [];
|
|
103
103
|
try {
|
|
104
104
|
return this.db
|
|
105
|
-
.prepare(`SELECT s.* FROM suggestions s
|
|
106
|
-
JOIN suggestions_fts f ON s.rowid = f.rowid
|
|
107
|
-
WHERE suggestions_fts MATCH ?
|
|
105
|
+
.prepare(`SELECT s.* FROM suggestions s
|
|
106
|
+
JOIN suggestions_fts f ON s.rowid = f.rowid
|
|
107
|
+
WHERE suggestions_fts MATCH ?
|
|
108
108
|
ORDER BY rank LIMIT ?`)
|
|
109
109
|
.all(sanitized, limit);
|
|
110
110
|
}
|
|
@@ -13,22 +13,22 @@ export class VectorStore {
|
|
|
13
13
|
this.initializeTables();
|
|
14
14
|
}
|
|
15
15
|
initializeTables() {
|
|
16
|
-
this.db.exec(`
|
|
17
|
-
CREATE TABLE IF NOT EXISTS memory_vectors (
|
|
18
|
-
key TEXT PRIMARY KEY,
|
|
19
|
-
embedding BLOB NOT NULL,
|
|
20
|
-
dimension INTEGER NOT NULL,
|
|
21
|
-
updatedAt TEXT NOT NULL
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
CREATE TABLE IF NOT EXISTS session_vectors (
|
|
25
|
-
entityType TEXT NOT NULL,
|
|
26
|
-
entityId INTEGER NOT NULL,
|
|
27
|
-
embedding BLOB NOT NULL,
|
|
28
|
-
dimension INTEGER NOT NULL,
|
|
29
|
-
updatedAt TEXT NOT NULL,
|
|
30
|
-
PRIMARY KEY (entityType, entityId)
|
|
31
|
-
);
|
|
16
|
+
this.db.exec(`
|
|
17
|
+
CREATE TABLE IF NOT EXISTS memory_vectors (
|
|
18
|
+
key TEXT PRIMARY KEY,
|
|
19
|
+
embedding BLOB NOT NULL,
|
|
20
|
+
dimension INTEGER NOT NULL,
|
|
21
|
+
updatedAt TEXT NOT NULL
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
CREATE TABLE IF NOT EXISTS session_vectors (
|
|
25
|
+
entityType TEXT NOT NULL,
|
|
26
|
+
entityId INTEGER NOT NULL,
|
|
27
|
+
embedding BLOB NOT NULL,
|
|
28
|
+
dimension INTEGER NOT NULL,
|
|
29
|
+
updatedAt TEXT NOT NULL,
|
|
30
|
+
PRIMARY KEY (entityType, entityId)
|
|
31
|
+
);
|
|
32
32
|
`);
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
@@ -37,9 +37,9 @@ export class VectorStore {
|
|
|
37
37
|
saveMemoryVector(key, embedding) {
|
|
38
38
|
const blob = serializeVector(embedding);
|
|
39
39
|
const now = new Date().toISOString();
|
|
40
|
-
this.db.prepare(`
|
|
41
|
-
INSERT OR REPLACE INTO memory_vectors (key, embedding, dimension, updatedAt)
|
|
42
|
-
VALUES (?, ?, ?, ?)
|
|
40
|
+
this.db.prepare(`
|
|
41
|
+
INSERT OR REPLACE INTO memory_vectors (key, embedding, dimension, updatedAt)
|
|
42
|
+
VALUES (?, ?, ?, ?)
|
|
43
43
|
`).run(key, blob, embedding.length, now);
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
@@ -48,9 +48,9 @@ export class VectorStore {
|
|
|
48
48
|
saveSessionVector(entityType, entityId, embedding) {
|
|
49
49
|
const blob = serializeVector(embedding);
|
|
50
50
|
const now = new Date().toISOString();
|
|
51
|
-
this.db.prepare(`
|
|
52
|
-
INSERT OR REPLACE INTO session_vectors (entityType, entityId, embedding, dimension, updatedAt)
|
|
53
|
-
VALUES (?, ?, ?, ?, ?)
|
|
51
|
+
this.db.prepare(`
|
|
52
|
+
INSERT OR REPLACE INTO session_vectors (entityType, entityId, embedding, dimension, updatedAt)
|
|
53
|
+
VALUES (?, ?, ?, ?, ?)
|
|
54
54
|
`).run(entityType, entityId, blob, embedding.length, now);
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
2
2
|
import { EmbeddingProvider } from '../EmbeddingProvider.js';
|
|
3
|
+
vi.mock('../../config/GlobalConfigManager.js', () => ({
|
|
4
|
+
getGptApiKey: vi.fn().mockReturnValue(null),
|
|
5
|
+
readGlobalConfig: vi.fn().mockReturnValue({ version: '1' }),
|
|
6
|
+
}));
|
|
3
7
|
describe('EmbeddingProvider', () => {
|
|
4
8
|
const originalEnv = { ...process.env };
|
|
5
9
|
beforeEach(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbeddingProvider.test.js","sourceRoot":"","sources":["../../../../../src/infra/lib/embedding/__tests__/EmbeddingProvider.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,MAAM,WAAW,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAEvC,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,WAAW,EAAE,CAAC;QACjC,EAAE,CAAC,eAAe,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;YACtD,MAAM,QAAQ,GAAG,IAAI,iBAAiB,EAAE,CAAC;YACzC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;YACvD,OAAO,CAAC,GAAG,CAAC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I,CAAC,IAAI,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;QACrB,EAAE,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;YACnD,MAAM,QAAQ,GAAG,IAAI,iBAAiB,EAAE,CAAC;YACzC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACxC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0CAA0C,EAAE,KAAK,IAAI,EAAE;YACxD,MAAM,QAAQ,GAAG,IAAI,iBAAiB,EAAE,CAAC;YACzC,MAAM,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CACpD,gCAAgC,CACjC,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;YAChD,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;YAC5D,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -23,16 +23,16 @@ export class AgentAnalyzer {
|
|
|
23
23
|
if (!this.agentDb)
|
|
24
24
|
return result;
|
|
25
25
|
try {
|
|
26
|
-
const stats = this.agentDb.prepare(`
|
|
27
|
-
SELECT
|
|
28
|
-
agentName,
|
|
29
|
-
COUNT(*) as totalRuns,
|
|
30
|
-
SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) as failedRuns,
|
|
31
|
-
AVG(duration) as avgDuration
|
|
32
|
-
FROM agent_executions
|
|
33
|
-
WHERE createdAt > datetime('now', '-7 days')
|
|
34
|
-
GROUP BY agentName
|
|
35
|
-
HAVING totalRuns >= 5
|
|
26
|
+
const stats = this.agentDb.prepare(`
|
|
27
|
+
SELECT
|
|
28
|
+
agentName,
|
|
29
|
+
COUNT(*) as totalRuns,
|
|
30
|
+
SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) as failedRuns,
|
|
31
|
+
AVG(duration) as avgDuration
|
|
32
|
+
FROM agent_executions
|
|
33
|
+
WHERE createdAt > datetime('now', '-7 days')
|
|
34
|
+
GROUP BY agentName
|
|
35
|
+
HAVING totalRuns >= 5
|
|
36
36
|
`).all();
|
|
37
37
|
result.agentsAnalyzed = stats.length;
|
|
38
38
|
for (const stat of stats) {
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { MemoryStorage } from '../memory/MemoryStorage.js';
|
|
2
|
+
import { ClassificationResult } from './SkillClassifier.js';
|
|
3
|
+
import { BenchmarkResult } from './SkillBenchmark.js';
|
|
4
|
+
export interface DeprecationCandidate {
|
|
5
|
+
skillName: string;
|
|
6
|
+
classification: ClassificationResult;
|
|
7
|
+
/** Latest benchmark if available */
|
|
8
|
+
latestBenchmark: BenchmarkResult | null;
|
|
9
|
+
/** Reason for deprecation candidacy */
|
|
10
|
+
reason: string;
|
|
11
|
+
/** Severity: how urgent is deprecation */
|
|
12
|
+
severity: 'immediate' | 'soon' | 'monitor';
|
|
13
|
+
/** Suggested action */
|
|
14
|
+
action: string;
|
|
15
|
+
}
|
|
16
|
+
export interface DeprecationReport {
|
|
17
|
+
/** Report ID */
|
|
18
|
+
id: string;
|
|
19
|
+
/** Timestamp */
|
|
20
|
+
timestamp: string;
|
|
21
|
+
/** All skills analyzed */
|
|
22
|
+
totalSkills: number;
|
|
23
|
+
/** Skills with eval data */
|
|
24
|
+
evaluatedSkills: number;
|
|
25
|
+
/** Deprecation candidates found */
|
|
26
|
+
candidates: DeprecationCandidate[];
|
|
27
|
+
/** Skills that are safe (encoded preference) */
|
|
28
|
+
safeSkills: string[];
|
|
29
|
+
/** Skills with no eval data (unknown) */
|
|
30
|
+
unevaluatedSkills: string[];
|
|
31
|
+
/** Summary stats */
|
|
32
|
+
summary: {
|
|
33
|
+
immediate: number;
|
|
34
|
+
soon: number;
|
|
35
|
+
monitor: number;
|
|
36
|
+
safe: number;
|
|
37
|
+
unknown: number;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export declare class DeprecationDetector {
|
|
41
|
+
private classifier;
|
|
42
|
+
private benchmark;
|
|
43
|
+
private evalRunner;
|
|
44
|
+
private db;
|
|
45
|
+
constructor(storage: MemoryStorage);
|
|
46
|
+
/**
|
|
47
|
+
* Scan all skills that have eval cases and produce deprecation report.
|
|
48
|
+
*/
|
|
49
|
+
scan(): DeprecationReport;
|
|
50
|
+
/**
|
|
51
|
+
* Check a single skill for deprecation candidacy.
|
|
52
|
+
* Returns null if the skill is not a deprecation candidate.
|
|
53
|
+
*/
|
|
54
|
+
checkSkill(skillName: string): DeprecationCandidate | null;
|
|
55
|
+
/**
|
|
56
|
+
* Get all skill names that have eval cases in the DB.
|
|
57
|
+
*/
|
|
58
|
+
getEvaluatedSkills(): string[];
|
|
59
|
+
/**
|
|
60
|
+
* Format deprecation report as markdown.
|
|
61
|
+
*/
|
|
62
|
+
formatReport(report: DeprecationReport): string;
|
|
63
|
+
/**
|
|
64
|
+
* Determine severity based on classification and benchmark data.
|
|
65
|
+
*/
|
|
66
|
+
private determineSeverity;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=DeprecationDetector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeprecationDetector.d.ts","sourceRoot":"","sources":["../../../../src/infra/lib/evolution/DeprecationDetector.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAmB,oBAAoB,E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