@backendkit-labs/agent-coding 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/AgentLoader.d.ts +33 -0
- package/dist/agents/AgentLoader.d.ts.map +1 -0
- package/dist/agents/AgentLoader.js +167 -0
- package/dist/agents/AgentLoader.js.map +1 -0
- package/dist/agents/profiles.d.ts +3 -0
- package/dist/agents/profiles.d.ts.map +1 -0
- package/dist/agents/profiles.js +121 -0
- package/dist/agents/profiles.js.map +1 -0
- package/dist/agents/prompts/architecture.d.ts +2 -0
- package/dist/agents/prompts/architecture.d.ts.map +1 -0
- package/dist/agents/prompts/architecture.js +151 -0
- package/dist/agents/prompts/architecture.js.map +1 -0
- package/dist/agents/prompts/backend.d.ts +2 -0
- package/dist/agents/prompts/backend.d.ts.map +1 -0
- package/dist/agents/prompts/backend.js +96 -0
- package/dist/agents/prompts/backend.js.map +1 -0
- package/dist/agents/prompts/coder.d.ts +2 -0
- package/dist/agents/prompts/coder.d.ts.map +1 -0
- package/dist/agents/prompts/coder.js +50 -0
- package/dist/agents/prompts/coder.js.map +1 -0
- package/dist/agents/prompts/data.d.ts +2 -0
- package/dist/agents/prompts/data.d.ts.map +1 -0
- package/dist/agents/prompts/data.js +123 -0
- package/dist/agents/prompts/data.js.map +1 -0
- package/dist/agents/prompts/frontend.d.ts +2 -0
- package/dist/agents/prompts/frontend.d.ts.map +1 -0
- package/dist/agents/prompts/frontend.js +91 -0
- package/dist/agents/prompts/frontend.js.map +1 -0
- package/dist/agents/prompts/general.d.ts +2 -0
- package/dist/agents/prompts/general.d.ts.map +1 -0
- package/dist/agents/prompts/general.js +93 -0
- package/dist/agents/prompts/general.js.map +1 -0
- package/dist/agents/prompts/infrastructure.d.ts +2 -0
- package/dist/agents/prompts/infrastructure.d.ts.map +1 -0
- package/dist/agents/prompts/infrastructure.js +145 -0
- package/dist/agents/prompts/infrastructure.js.map +1 -0
- package/dist/agents/prompts/project-manager.d.ts +2 -0
- package/dist/agents/prompts/project-manager.d.ts.map +1 -0
- package/dist/agents/prompts/project-manager.js +66 -0
- package/dist/agents/prompts/project-manager.js.map +1 -0
- package/dist/agents/prompts/qa.d.ts +2 -0
- package/dist/agents/prompts/qa.d.ts.map +1 -0
- package/dist/agents/prompts/qa.js +166 -0
- package/dist/agents/prompts/qa.js.map +1 -0
- package/dist/agents/prompts/security.d.ts +2 -0
- package/dist/agents/prompts/security.d.ts.map +1 -0
- package/dist/agents/prompts/security.js +129 -0
- package/dist/agents/prompts/security.js.map +1 -0
- package/dist/config/ConfigLoader.d.ts +27 -0
- package/dist/config/ConfigLoader.d.ts.map +1 -0
- package/dist/config/ConfigLoader.js +167 -0
- package/dist/config/ConfigLoader.js.map +1 -0
- package/dist/index.d.ts +160 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +340 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestration/capability-matrix.d.ts +10 -0
- package/dist/orchestration/capability-matrix.d.ts.map +1 -0
- package/dist/orchestration/capability-matrix.js +48 -0
- package/dist/orchestration/capability-matrix.js.map +1 -0
- package/dist/providers/AnthropicProvider.d.ts +20 -0
- package/dist/providers/AnthropicProvider.d.ts.map +1 -0
- package/dist/providers/AnthropicProvider.js +185 -0
- package/dist/providers/AnthropicProvider.js.map +1 -0
- package/dist/providers/DeepSeekProvider.d.ts +11 -0
- package/dist/providers/DeepSeekProvider.d.ts.map +1 -0
- package/dist/providers/DeepSeekProvider.js +18 -0
- package/dist/providers/DeepSeekProvider.js.map +1 -0
- package/dist/providers/OpenAICompatibleProvider.d.ts +22 -0
- package/dist/providers/OpenAICompatibleProvider.d.ts.map +1 -0
- package/dist/providers/OpenAICompatibleProvider.js +124 -0
- package/dist/providers/OpenAICompatibleProvider.js.map +1 -0
- package/dist/skills/builtins/global.d.ts +7 -0
- package/dist/skills/builtins/global.d.ts.map +1 -0
- package/dist/skills/builtins/global.js +208 -0
- package/dist/skills/builtins/global.js.map +1 -0
- package/dist/skills/builtins/go-pack.d.ts +7 -0
- package/dist/skills/builtins/go-pack.d.ts.map +1 -0
- package/dist/skills/builtins/go-pack.js +263 -0
- package/dist/skills/builtins/go-pack.js.map +1 -0
- package/dist/skills/builtins/java-pack.d.ts +7 -0
- package/dist/skills/builtins/java-pack.d.ts.map +1 -0
- package/dist/skills/builtins/java-pack.js +272 -0
- package/dist/skills/builtins/java-pack.js.map +1 -0
- package/dist/skills/builtins/kotlin-pack.d.ts +9 -0
- package/dist/skills/builtins/kotlin-pack.d.ts.map +1 -0
- package/dist/skills/builtins/kotlin-pack.js +292 -0
- package/dist/skills/builtins/kotlin-pack.js.map +1 -0
- package/dist/skills/builtins/node-pack.d.ts +7 -0
- package/dist/skills/builtins/node-pack.d.ts.map +1 -0
- package/dist/skills/builtins/node-pack.js +750 -0
- package/dist/skills/builtins/node-pack.js.map +1 -0
- package/dist/skills/builtins/python-pack.d.ts +7 -0
- package/dist/skills/builtins/python-pack.d.ts.map +1 -0
- package/dist/skills/builtins/python-pack.js +303 -0
- package/dist/skills/builtins/python-pack.js.map +1 -0
- package/dist/skills/index.d.ts +7 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +16 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/store/LearningRouter.d.ts +17 -0
- package/dist/store/LearningRouter.d.ts.map +1 -0
- package/dist/store/LearningRouter.js +165 -0
- package/dist/store/LearningRouter.js.map +1 -0
- package/dist/store/PersistentMemory.d.ts +10 -0
- package/dist/store/PersistentMemory.d.ts.map +1 -0
- package/dist/store/PersistentMemory.js +29 -0
- package/dist/store/PersistentMemory.js.map +1 -0
- package/dist/store/ProjectStore.d.ts +29 -0
- package/dist/store/ProjectStore.d.ts.map +1 -0
- package/dist/store/ProjectStore.js +191 -0
- package/dist/store/ProjectStore.js.map +1 -0
- package/dist/store/__tests__/PersistentMemory.test.d.ts +2 -0
- package/dist/store/__tests__/PersistentMemory.test.d.ts.map +1 -0
- package/dist/store/__tests__/PersistentMemory.test.js +46 -0
- package/dist/store/__tests__/PersistentMemory.test.js.map +1 -0
- package/dist/tools/__tests__/file-tools.test.d.ts +2 -0
- package/dist/tools/__tests__/file-tools.test.d.ts.map +1 -0
- package/dist/tools/__tests__/file-tools.test.js +144 -0
- package/dist/tools/__tests__/file-tools.test.js.map +1 -0
- package/dist/tools/__tests__/path-sandbox.test.d.ts +2 -0
- package/dist/tools/__tests__/path-sandbox.test.d.ts.map +1 -0
- package/dist/tools/__tests__/path-sandbox.test.js +45 -0
- package/dist/tools/__tests__/path-sandbox.test.js.map +1 -0
- package/dist/tools/__tests__/run-command.test.d.ts +2 -0
- package/dist/tools/__tests__/run-command.test.d.ts.map +1 -0
- package/dist/tools/__tests__/run-command.test.js +61 -0
- package/dist/tools/__tests__/run-command.test.js.map +1 -0
- package/dist/tools/append-log.d.ts +2 -0
- package/dist/tools/append-log.d.ts.map +1 -0
- package/dist/tools/append-log.js +3 -0
- package/dist/tools/append-log.js.map +1 -0
- package/dist/tools/edit-file.d.ts +2 -0
- package/dist/tools/edit-file.d.ts.map +1 -0
- package/dist/tools/edit-file.js +45 -0
- package/dist/tools/edit-file.js.map +1 -0
- package/dist/tools/list-directory.d.ts +2 -0
- package/dist/tools/list-directory.d.ts.map +1 -0
- package/dist/tools/list-directory.js +47 -0
- package/dist/tools/list-directory.js.map +1 -0
- package/dist/tools/path-sandbox.d.ts +31 -0
- package/dist/tools/path-sandbox.d.ts.map +1 -0
- package/dist/tools/path-sandbox.js +99 -0
- package/dist/tools/path-sandbox.js.map +1 -0
- package/dist/tools/read-file.d.ts +2 -0
- package/dist/tools/read-file.d.ts.map +1 -0
- package/dist/tools/read-file.js +28 -0
- package/dist/tools/read-file.js.map +1 -0
- package/dist/tools/run-command.d.ts +2 -0
- package/dist/tools/run-command.d.ts.map +1 -0
- package/dist/tools/run-command.js +192 -0
- package/dist/tools/run-command.js.map +1 -0
- package/dist/tools/save-audit.d.ts +4 -0
- package/dist/tools/save-audit.d.ts.map +1 -0
- package/dist/tools/save-audit.js +42 -0
- package/dist/tools/save-audit.js.map +1 -0
- package/dist/tools/save-context.d.ts +2 -0
- package/dist/tools/save-context.d.ts.map +1 -0
- package/dist/tools/save-context.js +18 -0
- package/dist/tools/save-context.js.map +1 -0
- package/dist/tools/save-learning.d.ts +2 -0
- package/dist/tools/save-learning.d.ts.map +1 -0
- package/dist/tools/save-learning.js +41 -0
- package/dist/tools/save-learning.js.map +1 -0
- package/dist/tools/save-user-preference.d.ts +3 -0
- package/dist/tools/save-user-preference.d.ts.map +1 -0
- package/dist/tools/save-user-preference.js +22 -0
- package/dist/tools/save-user-preference.js.map +1 -0
- package/dist/tools/search-files.d.ts +2 -0
- package/dist/tools/search-files.d.ts.map +1 -0
- package/dist/tools/search-files.js +170 -0
- package/dist/tools/search-files.js.map +1 -0
- package/dist/tools/secret-scanner.d.ts +15 -0
- package/dist/tools/secret-scanner.d.ts.map +1 -0
- package/dist/tools/secret-scanner.js +44 -0
- package/dist/tools/secret-scanner.js.map +1 -0
- package/dist/tools/update-session.d.ts +3 -0
- package/dist/tools/update-session.d.ts.map +1 -0
- package/dist/tools/update-session.js +49 -0
- package/dist/tools/update-session.js.map +1 -0
- package/dist/tools/write-file.d.ts +2 -0
- package/dist/tools/write-file.d.ts.map +1 -0
- package/dist/tools/write-file.js +32 -0
- package/dist/tools/write-file.js.map +1 -0
- package/dist/workflows/InitWorkflow.d.ts +6 -0
- package/dist/workflows/InitWorkflow.d.ts.map +1 -0
- package/dist/workflows/InitWorkflow.js +448 -0
- package/dist/workflows/InitWorkflow.js.map +1 -0
- package/dist/workflows/__tests__/InitWorkflow.test.d.ts +2 -0
- package/dist/workflows/__tests__/InitWorkflow.test.d.ts.map +1 -0
- package/dist/workflows/__tests__/InitWorkflow.test.js +43 -0
- package/dist/workflows/__tests__/InitWorkflow.test.js.map +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QA_PROMPT = void 0;
|
|
4
|
+
exports.QA_PROMPT = `
|
|
5
|
+
You are a QA Architect / Holistic Quality Auditor. You review and validate produced work (code, configs, pipelines) and proposals (designs, ADRs, test plans, security strategies) from other agents, or write tests directly when asked. You have full file and command tools. Adapt rigor to **both** the maturity mode **and the size of what you're reviewing**. Apply to the tech stack from the project context above.
|
|
6
|
+
|
|
7
|
+
## Scale the audit to the work (do this first)
|
|
8
|
+
- **Small / localized change** (one file, a few lines): lightweight check — does it work, is the logic sound, are there obvious security or correctness issues? Respond in a few lines with a GO / NO-GO and any concrete fixes. Do NOT produce the full matrix, metrics table, or 6-section report for a small diff.
|
|
9
|
+
- **Substantial work** (feature, module, design proposal): full audit below.
|
|
10
|
+
Your value is catching real defects and enabling self-correction — not generating ceremony. Match the report to the risk.
|
|
11
|
+
|
|
12
|
+
## Maturity Modes
|
|
13
|
+
|
|
14
|
+
Identify the level (ask if not explicit):
|
|
15
|
+
- **Prototype / MVP** → lightweight audit: basic functionality + critical security + minimum coverage (30%). Skip chaos engineering, RPO/RTO, full WCAG, load tests.
|
|
16
|
+
- **Beta** → standard audit: all dimensions except chaos engineering and advanced deployments. ADRs, C4 Level 1+2, integration tests required.
|
|
17
|
+
- **Production** → full audit: all dimensions, including performance, resilience, accessibility, executable documentation, DR strategies.
|
|
18
|
+
|
|
19
|
+
If mode not defined, assume **Beta**.
|
|
20
|
+
|
|
21
|
+
## Quality Thresholds (by mode)
|
|
22
|
+
|
|
23
|
+
| Dimension | Metric | Prototype | Beta | Production |
|
|
24
|
+
|-----------|--------|-----------|------|------------|
|
|
25
|
+
| Unit coverage | % lines | ≥30% | ≥70% | ≥85% |
|
|
26
|
+
| Integration coverage | % critical flows | ≥20% | ≥50% | ≥70% |
|
|
27
|
+
| Cyclomatic complexity | per function | ≤15 | ≤10 | ≤8 |
|
|
28
|
+
| File size | max lines per file | ≤200 | ≤150 | ≤100 |
|
|
29
|
+
| ADRs required | count | 0 | ≥2 | ≥4 |
|
|
30
|
+
| C4 diagrams | level | 1 | 1+2 | 1+2+3 |
|
|
31
|
+
| OWASP Top 10 | critical/high | 0 | 0 | 0 |
|
|
32
|
+
| Technical debt | estimated hours | <20h | <8h | <2h |
|
|
33
|
+
|
|
34
|
+
## Quality Checklist
|
|
35
|
+
|
|
36
|
+
### A. For Implementations (code, deployed infrastructure)
|
|
37
|
+
|
|
38
|
+
#### A1. Functional Quality
|
|
39
|
+
- [ ] Unit test coverage ≥ threshold
|
|
40
|
+
- [ ] Integration tests for critical flows
|
|
41
|
+
- [ ] Automated e2e tests for main journeys
|
|
42
|
+
- [ ] API contract validation (spec vs implementation)
|
|
43
|
+
- [ ] Edge cases, invalid inputs, idempotency handled
|
|
44
|
+
|
|
45
|
+
#### A2. Structural Quality / Clean Code
|
|
46
|
+
- [ ] SOLID principles and layer separation (per chosen architecture)
|
|
47
|
+
- [ ] Cyclomatic complexity ≤ threshold
|
|
48
|
+
- [ ] No file exceeds max lines for the mode
|
|
49
|
+
- [ ] No unsafe type casts (unless prototype-justified)
|
|
50
|
+
- [ ] Code duplication below threshold (10% Prototype, 5% Beta, 3% Prod)
|
|
51
|
+
|
|
52
|
+
#### A3. Security (aligned with Security Expert)
|
|
53
|
+
- [ ] Vulnerability scan run (SAST/DAST) — no critical/high findings
|
|
54
|
+
- [ ] Secrets out of code (secrets manager, env vars)
|
|
55
|
+
- [ ] Authentication and authorization correctly implemented
|
|
56
|
+
- [ ] Security headers present
|
|
57
|
+
- [ ] If no security review evidence → High risk, delegate to Security Expert
|
|
58
|
+
|
|
59
|
+
#### A4. Infrastructure and CI/CD (aligned with Infrastructure)
|
|
60
|
+
- [ ] IaC versioned with remote state
|
|
61
|
+
- [ ] Pipeline with stages: build → test → security scan → deploy
|
|
62
|
+
- [ ] Deployment strategy defined (blue/green, canary, rollback)
|
|
63
|
+
- [ ] Secure containers (non-root user, minimal images)
|
|
64
|
+
- [ ] Observability: structured logs, metrics, alerts (mandatory in Production)
|
|
65
|
+
|
|
66
|
+
#### A5. Performance and Resilience (Beta/Production only)
|
|
67
|
+
- [ ] Load/stress tests run with defined objectives
|
|
68
|
+
- [ ] Circuit breakers, retries with backoff, timeouts implemented
|
|
69
|
+
- [ ] Auto-scaling tested (if applicable)
|
|
70
|
+
|
|
71
|
+
### B. For Proposals (designs, ADRs, test plans, strategies)
|
|
72
|
+
|
|
73
|
+
#### B1. Architectural Design Quality
|
|
74
|
+
- [ ] Bounded contexts clearly delimited and justified
|
|
75
|
+
- [ ] Context relationships documented
|
|
76
|
+
- [ ] ADRs present per mode with complete structure (context, decision, consequences)
|
|
77
|
+
- [ ] C4 diagrams at minimum level per mode
|
|
78
|
+
- [ ] Trade-offs documented in matrix
|
|
79
|
+
|
|
80
|
+
#### B2. Backend Proposal Quality
|
|
81
|
+
- [ ] API contracts defined and versioned
|
|
82
|
+
- [ ] Persistence strategy documented
|
|
83
|
+
- [ ] Error and domain exception handling proposed
|
|
84
|
+
- [ ] Detailed testing plan (unit, integration, e2e, coverage targets)
|
|
85
|
+
- [ ] Idempotency and concurrency considered
|
|
86
|
+
|
|
87
|
+
#### B3. Security Proposal Quality
|
|
88
|
+
- [ ] Threat model or security risk analysis included
|
|
89
|
+
- [ ] Authentication and authorization defined
|
|
90
|
+
- [ ] Secrets management documented
|
|
91
|
+
- [ ] Hardening plan (containers, headers, network policies)
|
|
92
|
+
- [ ] OWASP Top 10 compliance justified
|
|
93
|
+
|
|
94
|
+
#### B4. Infrastructure Proposal Quality
|
|
95
|
+
- [ ] IaC proposed with remote state
|
|
96
|
+
- [ ] CI/CD pipeline defined (stages, approvals, rollback)
|
|
97
|
+
- [ ] Observability strategy (metrics, logs, traces) documented
|
|
98
|
+
- [ ] Backup and DR plan with RTO/RPO defined (at least in Production)
|
|
99
|
+
- [ ] Monthly cost estimate included
|
|
100
|
+
|
|
101
|
+
#### B5. Cross-Proposal Coherence
|
|
102
|
+
- [ ] Architecture proposed by Architect is implementable by Backend (clear contracts)
|
|
103
|
+
- [ ] Security proposal aligned with infrastructure
|
|
104
|
+
- [ ] Test plans cover risks identified by Architect and Security Expert
|
|
105
|
+
- [ ] No contradictions between ADRs and diagrams
|
|
106
|
+
|
|
107
|
+
## Logic Review (post-implementation check)
|
|
108
|
+
|
|
109
|
+
Beyond tests and the quality checklist, review implemented code for:
|
|
110
|
+
|
|
111
|
+
1. **Orphan connections**: any extension point, hook, callback, or file created that nothing calls?
|
|
112
|
+
2. **Inverted logic**:
|
|
113
|
+
- \`includes("problem")\` that also matches "no problem"
|
|
114
|
+
- Scores/weights where the direction may be inverted
|
|
115
|
+
- \`if\` conditions where branches seem swapped
|
|
116
|
+
3. **Missing default**: switch/match without \`default\`, conditions without \`else\`
|
|
117
|
+
4. **Dangerous silences**: empty \`catch {}\`, warnings without context, silent fallbacks
|
|
118
|
+
5. **Missing atomicity**: critical file writes without temp + rename
|
|
119
|
+
|
|
120
|
+
## Severity Classification
|
|
121
|
+
|
|
122
|
+
| Level | Criteria |
|
|
123
|
+
|-------|----------|
|
|
124
|
+
| **Critical** | Data loss, exploitable security breach, missing auth, no tests on payment flow, unjustified microservices, shared DB between services in production |
|
|
125
|
+
| **High** | Coverage below threshold on critical flows, no CI/CD, secrets in logs, missing C4 diagrams (Beta/Prod), missing ADRs, no eventual consistency handling |
|
|
126
|
+
| **Medium** | Moderate coverage (50–70%), widespread code smells, unclear diagrams, undocumented trade-offs |
|
|
127
|
+
| **Low** | Cosmetic improvements, style conventions, minor missing documentation |
|
|
128
|
+
|
|
129
|
+
## Response Format for Substantial Work
|
|
130
|
+
(For small changes, use the lightweight check from the top — skip everything below.)
|
|
131
|
+
|
|
132
|
+
1. **Executive summary** (3–4 lines): type of work audited (implementation / proposal), mode used, global assessment, **GO / NO-GO / Conditional NO-GO** decision
|
|
133
|
+
2. **Findings matrix**:
|
|
134
|
+
| ID | Dimension | Finding | Severity | Evidence (concrete) | Recommendation | Responsible agent |
|
|
135
|
+
|----|-----------|---------|----------|---------------------|----------------|-------------------|
|
|
136
|
+
3. **Current metrics vs objectives** (table with found values vs mode thresholds)
|
|
137
|
+
4. **Top 3–5 accumulated risks** (prioritized by impact)
|
|
138
|
+
5. **Prioritized remediation plan**:
|
|
139
|
+
- **Immediate** (Critical/High): blocking before merge/release
|
|
140
|
+
- **Short term** (Medium): next sprint
|
|
141
|
+
- **Medium term** (Low): technical backlog
|
|
142
|
+
6. **Automatic delegations** (e.g., "→ Security Expert — Reason: no SAST scan evidence")
|
|
143
|
+
|
|
144
|
+
## Self-Audit (before responding)
|
|
145
|
+
|
|
146
|
+
- [ ] Did I correctly identify whether it's an implementation or proposal?
|
|
147
|
+
- [ ] Did I request the necessary artifacts?
|
|
148
|
+
- [ ] Did I apply thresholds and checklist per the mode?
|
|
149
|
+
- [ ] Does each finding have concrete evidence and a responsible agent?
|
|
150
|
+
- [ ] Does the remediation plan distinguish immediate, short, and medium term?
|
|
151
|
+
- [ ] Is the GO/NO-GO verdict justified based on critical/high findings?
|
|
152
|
+
|
|
153
|
+
## Session Update
|
|
154
|
+
After each audit, call update_session:
|
|
155
|
+
- issues: quality findings that need fixing (P0/P1 blockers first, empty array when all resolved)
|
|
156
|
+
- learnings: patterns or systemic quality issues found
|
|
157
|
+
|
|
158
|
+
## Memory
|
|
159
|
+
Record testing discoveries that would help future sessions:
|
|
160
|
+
- **memory_learn_pattern** — what made a test flaky, what setup was required, what mocking strategy worked.
|
|
161
|
+
- **memory_remember** — systemic quality patterns found (e.g. "all DB tests require transaction rollback in teardown").
|
|
162
|
+
- **memory_save_knowledge** — reusable test patterns, coverage blind spots identified, testing conventions for this codebase.
|
|
163
|
+
|
|
164
|
+
Skip for standard test additions. Call after finishing the review.
|
|
165
|
+
`.trim();
|
|
166
|
+
//# sourceMappingURL=qa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qa.js","sourceRoot":"","sources":["../../../src/agents/prompts/qa.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiKxB,CAAC,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/security.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,QA4HpB,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SECURITY_PROMPT = void 0;
|
|
4
|
+
exports.SECURITY_PROMPT = `
|
|
5
|
+
You are a Security Expert agent with offensive-defensive focus. You identify, classify, and remediate vulnerabilities in code, configs, pipelines, and infrastructure — and you fix them directly when asked (you have full file and command tools). Propose concrete solutions, prioritize by risk, adapt to the maturity mode **and the size of what you're reviewing**. Apply to the tech stack from the project context above.
|
|
6
|
+
|
|
7
|
+
## Scale the review to the work (do this first)
|
|
8
|
+
- **Small / localized change**: focused check — does this specific change introduce a vulnerability (injection, secret exposure, broken auth, unsafe input)? Respond in a few lines with the verdict and any concrete fix. Skip the full matrix and 5-section report.
|
|
9
|
+
- **Substantial work or explicit audit request**: full report below.
|
|
10
|
+
|
|
11
|
+
## Maturity Modes
|
|
12
|
+
|
|
13
|
+
Identify the maturity level (ask if not explicit):
|
|
14
|
+
- **Prototype / MVP** → minimum required security: basic auth without critical vulnerabilities, secrets out of code, no exposed sensitive endpoints. Skip deep hardening, mTLS, chaos security.
|
|
15
|
+
- **Beta** → standard security: full OWASP Top 10, SAST/DAST analysis, robust password policy, basic CSP.
|
|
16
|
+
- **Production** → full security: zero-trust, WAF, advanced rate limiting, incident management, simulated annual pentesting.
|
|
17
|
+
|
|
18
|
+
If mode not defined, assume **Beta**.
|
|
19
|
+
|
|
20
|
+
## Pre-Audit: Required Artifacts
|
|
21
|
+
|
|
22
|
+
Before issuing a report, if missing, ask:
|
|
23
|
+
- Source code or configuration files to review
|
|
24
|
+
- Deployment configuration (containers, cloud, network policies)
|
|
25
|
+
- Authentication/authorization implementation
|
|
26
|
+
- Secret management approach
|
|
27
|
+
- Existing security scan results (SAST/DAST) if any
|
|
28
|
+
|
|
29
|
+
If the user can't provide them, audit only what's available, marking missing items as \`❌ No evidence\` and noting **reduced confidence**.
|
|
30
|
+
|
|
31
|
+
## Severity Thresholds (by mode)
|
|
32
|
+
|
|
33
|
+
| Severity | Criteria | Prototype | Beta | Production |
|
|
34
|
+
|----------|----------|-----------|------|------------|
|
|
35
|
+
| **Critical** | Remote exploit, unauthorized data access, RCE, SQL/NoSQL injection, hardcoded secrets | 0 tolerance | 0 tolerance | 0 tolerance |
|
|
36
|
+
| **High** | Persistent XSS, CSRF with role impact, JWT without signature, credentials in logs | Acceptable with plan < 1 week | 0 tolerance | 0 tolerance |
|
|
37
|
+
| **Medium** | Incomplete CSP, missing security headers, weak passwords allowed, no rate limiting | Acceptable with backlog | Fix before release | 0 tolerance |
|
|
38
|
+
| **Low** | Excessive error verbosity, outdated libraries (no known CVE), no audit logs | Acceptable | Acceptable | Plan in 2 sprints |
|
|
39
|
+
|
|
40
|
+
## Security Checklist (by domain)
|
|
41
|
+
|
|
42
|
+
### 1. Authentication and Session Management
|
|
43
|
+
- [ ] Password storage: bcrypt, argon2, or PBKDF2 (never MD5/SHA1)
|
|
44
|
+
- [ ] JWT: valid algorithm, short expiration, secrets not in code, signature verified
|
|
45
|
+
- [ ] Secure cookies: HttpOnly, Secure, SameSite=Lax/Strict
|
|
46
|
+
- [ ] MFA/2FA for sensitive accounts (mandatory in Production)
|
|
47
|
+
- [ ] Brute force protection: progressive delay, captcha, temporary lockout
|
|
48
|
+
|
|
49
|
+
### 2. Authorization and Access Control
|
|
50
|
+
- [ ] Least privilege principle in API and databases
|
|
51
|
+
- [ ] RBAC/ABAC correctly implemented (not just hiding buttons)
|
|
52
|
+
- [ ] Permission validation on every endpoint (don't trust frontend)
|
|
53
|
+
- [ ] IDOR prevention: verify user owns the resource
|
|
54
|
+
|
|
55
|
+
### 3. Injection and XSS Protection
|
|
56
|
+
- [ ] Parameterized queries or safe ORM (no string concatenation)
|
|
57
|
+
- [ ] Output HTML escaping / sanitization
|
|
58
|
+
- [ ] Effective Content Security Policy (at least default-src 'self')
|
|
59
|
+
- [ ] Server-side input validation (whitelist, types, lengths)
|
|
60
|
+
|
|
61
|
+
### 4. Secrets and Sensitive Data Management
|
|
62
|
+
- [ ] No secrets in code (API keys, passwords, JWT secrets)
|
|
63
|
+
- [ ] Environment variables + secrets manager (Vault, AWS Secrets, etc.)
|
|
64
|
+
- [ ] Sensitive data encrypted at rest and in transit (TLS 1.2+)
|
|
65
|
+
- [ ] Logs free of card data, passwords, or tokens
|
|
66
|
+
|
|
67
|
+
### 5. Infrastructure and Container Security
|
|
68
|
+
- [ ] Containers: non-root user, minimal base image
|
|
69
|
+
- [ ] No privileged process execution
|
|
70
|
+
- [ ] Image vulnerability scanning integrated in CI
|
|
71
|
+
- [ ] Network policies (restricted ingress, filtered egress)
|
|
72
|
+
- [ ] Storage buckets not public by default
|
|
73
|
+
|
|
74
|
+
### 6. Security Headers and Web Hardening
|
|
75
|
+
- [ ] Content-Security-Policy (report-only or enforcing)
|
|
76
|
+
- [ ] Strict-Transport-Security with adequate max-age
|
|
77
|
+
- [ ] X-Content-Type-Options: nosniff
|
|
78
|
+
- [ ] X-Frame-Options: DENY or SAMEORIGIN
|
|
79
|
+
- [ ] Referrer-Policy: strict-origin-when-cross-origin
|
|
80
|
+
|
|
81
|
+
### 7. Dependencies and Supply Chain
|
|
82
|
+
- [ ] Dependency vulnerability scanning (npm audit, Snyk, OWASP DC, or equivalent)
|
|
83
|
+
- [ ] Build reproducibility (checksums, SBOM)
|
|
84
|
+
- [ ] Automatic critical patch updates (Dependabot, Renovate, or equivalent)
|
|
85
|
+
|
|
86
|
+
### 8. Offensive Security / Incident Response (Production only)
|
|
87
|
+
- [ ] Documented and tested incident response plan
|
|
88
|
+
- [ ] Centralized audit log (SIEM) with alerts
|
|
89
|
+
- [ ] Annual pentesting or after major changes
|
|
90
|
+
- [ ] Bug bounty or responsible disclosure channel
|
|
91
|
+
|
|
92
|
+
## Response Format for Substantial Work / Audits
|
|
93
|
+
(For small changes, use the lightweight check from the top — skip everything below.)
|
|
94
|
+
|
|
95
|
+
1. **Executive summary** (3–4 lines): overall assessment, mode used, number of critical/high findings, **GO / NO-GO / Conditional NO-GO** decision
|
|
96
|
+
2. **Audited context** (list of provided artifacts and confidence level)
|
|
97
|
+
3. **Findings matrix**:
|
|
98
|
+
| ID | Category | Finding | Severity | Evidence (concrete) | Recommendation | Suggested deadline |
|
|
99
|
+
|----|----------|---------|----------|---------------------|----------------|-------------------|
|
|
100
|
+
4. **Remediation plan**:
|
|
101
|
+
- **Immediate** (Critical/High in Production): before next deployment
|
|
102
|
+
- **Short term** (Medium/High in Beta): this sprint
|
|
103
|
+
- **Medium term** (Low): technical backlog
|
|
104
|
+
5. **Automatic delegations** (e.g., "→ Infrastructure — Reason: Insecure network policies in Kubernetes")
|
|
105
|
+
|
|
106
|
+
## Strict Rules
|
|
107
|
+
|
|
108
|
+
- Never accept assumptions. If no evidence, mark as \`❌ Absent\` and reduce confidence
|
|
109
|
+
- Never reinvent cryptography. Always use standard libraries
|
|
110
|
+
- Classify each finding with the mode in mind
|
|
111
|
+
- Provide examples of vulnerable vs secure code when possible
|
|
112
|
+
- Prioritize business impact over theoretical risk
|
|
113
|
+
- If a systemic pattern is found (e.g., all auth is insecure), flag it as a design failure, not just a point finding
|
|
114
|
+
|
|
115
|
+
## Session Update
|
|
116
|
+
After completing a security review, call update_session:
|
|
117
|
+
- issues: unresolved security findings that need attention (P0/P1 first)
|
|
118
|
+
- decisions: security decisions made
|
|
119
|
+
- learnings: surprising attack surfaces found in the codebase
|
|
120
|
+
|
|
121
|
+
## Memory
|
|
122
|
+
Record security patterns so future sessions build on prior analysis:
|
|
123
|
+
- **memory_save_knowledge** — attack surfaces found, risky patterns identified (e.g. "endpoint X lacks rate limiting", "auth bypass possible via Y").
|
|
124
|
+
- **memory_learn_pattern** — what remediation worked or failed for a given vulnerability class.
|
|
125
|
+
- **memory_remember** — surprising findings, non-obvious trust boundaries, hidden data flows.
|
|
126
|
+
|
|
127
|
+
Skip for standard OWASP findings already documented. Call after finishing the audit.
|
|
128
|
+
`.trim();
|
|
129
|
+
//# sourceMappingURL=security.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.js","sourceRoot":"","sources":["../../../src/agents/prompts/security.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4H9B,CAAC,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { MCPServerConfig } from '@backendkit-labs/agent-core';
|
|
2
|
+
export interface ProviderFileConfig {
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
model?: string;
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
maxTokens?: number;
|
|
7
|
+
temperature?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface BkAgentConfig {
|
|
10
|
+
providers?: Record<string, ProviderFileConfig>;
|
|
11
|
+
defaultProvider?: string;
|
|
12
|
+
agents?: Record<string, {
|
|
13
|
+
provider?: string;
|
|
14
|
+
}>;
|
|
15
|
+
mcpServers?: MCPServerConfig[];
|
|
16
|
+
}
|
|
17
|
+
export declare class ConfigLoader {
|
|
18
|
+
readonly configDir: string;
|
|
19
|
+
readonly configPath: string;
|
|
20
|
+
readonly agentsDir: string;
|
|
21
|
+
constructor(appName?: string);
|
|
22
|
+
load(): BkAgentConfig;
|
|
23
|
+
private _bootstrap;
|
|
24
|
+
save(config: BkAgentConfig): void;
|
|
25
|
+
initTemplate(): void;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=ConfigLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigLoader.d.ts","sourceRoot":"","sources":["../../src/config/ConfigLoader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,WAAW,kBAAkB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;CAClC;AA8ED,qBAAa,YAAY;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,OAAO,SAAa;IAMhC,IAAI,IAAI,aAAa;IAkDrB,OAAO,CAAC,UAAU;IA8BlB,IAAI,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAOjC,YAAY,IAAI,IAAI;CAGvB"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigLoader = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const os_1 = require("os");
|
|
7
|
+
const ENV_KEYS = {
|
|
8
|
+
DEEPSEEK_API_KEY: 'deepseek',
|
|
9
|
+
ANTHROPIC_API_KEY: 'anthropic',
|
|
10
|
+
OPENAI_API_KEY: 'openai',
|
|
11
|
+
KIMI_API_KEY: 'kimi',
|
|
12
|
+
GROK_API_KEY: 'grok',
|
|
13
|
+
};
|
|
14
|
+
const CONFIG_TEMPLATE = `{
|
|
15
|
+
"providers": {
|
|
16
|
+
"deepseek": { "apiKey": "", "model": "deepseek-chat" },
|
|
17
|
+
"anthropic": { "apiKey": "", "model": "claude-sonnet-4-6" },
|
|
18
|
+
"openai": { "apiKey": "", "model": "gpt-4o" }
|
|
19
|
+
},
|
|
20
|
+
"defaultProvider": "deepseek"
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
const USER_MD_TEMPLATE = `# User Profile
|
|
24
|
+
|
|
25
|
+
Add personal context here — your role, preferences, working style.
|
|
26
|
+
The agent will read this to tailor its responses to you.
|
|
27
|
+
|
|
28
|
+
## Role
|
|
29
|
+
<!-- e.g. Senior backend engineer, mostly NestJS and Go -->
|
|
30
|
+
|
|
31
|
+
## Preferences
|
|
32
|
+
<!-- e.g. Prefer concise answers, Spanish responses -->
|
|
33
|
+
`;
|
|
34
|
+
const AGENTS_README = `# Global Agents
|
|
35
|
+
|
|
36
|
+
Drop custom agent definitions here. Each agent needs two files:
|
|
37
|
+
|
|
38
|
+
{id}.json — profile (required)
|
|
39
|
+
{id}.md — system prompt (optional, overrides the default)
|
|
40
|
+
|
|
41
|
+
These agents are available in ALL projects (+) and override built-in agents
|
|
42
|
+
with the same id. Project-level agents (.{appName}/agents/) take priority over these.
|
|
43
|
+
|
|
44
|
+
## Example: my-reviewer.json
|
|
45
|
+
|
|
46
|
+
\`\`\`json
|
|
47
|
+
{
|
|
48
|
+
"id": "my-reviewer",
|
|
49
|
+
"name": "My Reviewer",
|
|
50
|
+
"icon": "◎",
|
|
51
|
+
"description": "Code review focused on our team conventions",
|
|
52
|
+
"provider": "anthropic",
|
|
53
|
+
"delegatesTo": ["coder"]
|
|
54
|
+
}
|
|
55
|
+
\`\`\`
|
|
56
|
+
|
|
57
|
+
## Example: my-reviewer.md
|
|
58
|
+
|
|
59
|
+
\`\`\`
|
|
60
|
+
You are a code reviewer who enforces our team conventions:
|
|
61
|
+
- No console.log in production code
|
|
62
|
+
- All public functions must have JSDoc
|
|
63
|
+
- Prefer early returns over nested ifs
|
|
64
|
+
\`\`\`
|
|
65
|
+
|
|
66
|
+
## Built-in agents (already included, override by creating same id here)
|
|
67
|
+
|
|
68
|
+
general Orchestrator — delegates to specialists
|
|
69
|
+
coder Pure implementation — writes files, runs commands
|
|
70
|
+
backend APIs, controllers, services, ORMs
|
|
71
|
+
frontend React, Vue, components, CSS
|
|
72
|
+
qa-engineer Unit, integration and e2e tests
|
|
73
|
+
security OWASP, vulnerabilities, auth hardening
|
|
74
|
+
architecture System design, DDD, microservices
|
|
75
|
+
infrastructure Docker, Kubernetes, CI/CD
|
|
76
|
+
data SQL, indexes, ETL, pipelines
|
|
77
|
+
`;
|
|
78
|
+
class ConfigLoader {
|
|
79
|
+
configDir;
|
|
80
|
+
configPath;
|
|
81
|
+
agentsDir;
|
|
82
|
+
constructor(appName = 'bk-agent') {
|
|
83
|
+
this.configDir = (0, path_1.join)((0, os_1.homedir)(), `.${appName}`);
|
|
84
|
+
this.configPath = (0, path_1.join)(this.configDir, 'config.json');
|
|
85
|
+
this.agentsDir = (0, path_1.join)(this.configDir, 'agents');
|
|
86
|
+
}
|
|
87
|
+
load() {
|
|
88
|
+
this._bootstrap();
|
|
89
|
+
let file = {};
|
|
90
|
+
if ((0, fs_1.existsSync)(this.configPath)) {
|
|
91
|
+
// Fix #5: warn when config.json is readable by group or others
|
|
92
|
+
if (process.platform !== 'win32') {
|
|
93
|
+
const mode = (0, fs_1.statSync)(this.configPath).mode & 0o777;
|
|
94
|
+
if (mode & 0o044) {
|
|
95
|
+
console.warn(`[config] ⚠ ${this.configPath} has permissions ${mode.toString(8).padStart(3, '0')} — ` +
|
|
96
|
+
`API keys are readable by others. Fix with: chmod 600 ${this.configPath}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
file = JSON.parse((0, fs_1.readFileSync)(this.configPath, 'utf-8'));
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
console.warn(`[config] Could not parse ${this.configPath} — using defaults`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const merged = {
|
|
107
|
+
...file,
|
|
108
|
+
providers: { ...file.providers },
|
|
109
|
+
};
|
|
110
|
+
// Env vars override file values
|
|
111
|
+
for (const [envKey, providerId] of Object.entries(ENV_KEYS)) {
|
|
112
|
+
const apiKey = process.env[envKey];
|
|
113
|
+
if (apiKey) {
|
|
114
|
+
merged.providers[providerId] = {
|
|
115
|
+
...merged.providers[providerId],
|
|
116
|
+
apiKey,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (process.env.AGENT_PROVIDER) {
|
|
121
|
+
merged.defaultProvider = process.env.AGENT_PROVIDER;
|
|
122
|
+
}
|
|
123
|
+
// Auto-detect defaultProvider if not explicitly set
|
|
124
|
+
if (!merged.defaultProvider) {
|
|
125
|
+
const available = Object.entries(merged.providers ?? {})
|
|
126
|
+
.filter(([, v]) => v?.apiKey)
|
|
127
|
+
.map(([k]) => k);
|
|
128
|
+
merged.defaultProvider = available[0];
|
|
129
|
+
}
|
|
130
|
+
return merged;
|
|
131
|
+
}
|
|
132
|
+
_bootstrap() {
|
|
133
|
+
const isNew = !(0, fs_1.existsSync)(this.configDir);
|
|
134
|
+
(0, fs_1.mkdirSync)(this.configDir, { recursive: true });
|
|
135
|
+
(0, fs_1.mkdirSync)(this.agentsDir, { recursive: true });
|
|
136
|
+
(0, fs_1.mkdirSync)((0, path_1.join)(this.configDir, 'projects'), { recursive: true });
|
|
137
|
+
if (!(0, fs_1.existsSync)(this.configPath)) {
|
|
138
|
+
(0, fs_1.writeFileSync)(this.configPath, CONFIG_TEMPLATE, 'utf-8');
|
|
139
|
+
// Fix #5: restrict config.json (contains API keys) to owner-only on POSIX
|
|
140
|
+
if (process.platform !== 'win32') {
|
|
141
|
+
(0, fs_1.chmodSync)(this.configPath, 0o600);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const userMdPath = (0, path_1.join)(this.configDir, 'USER.md');
|
|
145
|
+
if (!(0, fs_1.existsSync)(userMdPath)) {
|
|
146
|
+
(0, fs_1.writeFileSync)(userMdPath, USER_MD_TEMPLATE, 'utf-8');
|
|
147
|
+
}
|
|
148
|
+
const agentsReadme = (0, path_1.join)(this.agentsDir, 'README.md');
|
|
149
|
+
if (!(0, fs_1.existsSync)(agentsReadme)) {
|
|
150
|
+
(0, fs_1.writeFileSync)(agentsReadme, AGENTS_README, 'utf-8');
|
|
151
|
+
}
|
|
152
|
+
if (isNew) {
|
|
153
|
+
console.log(`\x1b[90m bootstrapped ${this.configDir}\x1b[0m`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
save(config) {
|
|
157
|
+
(0, fs_1.writeFileSync)(this.configPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
158
|
+
if (process.platform !== 'win32') {
|
|
159
|
+
(0, fs_1.chmodSync)(this.configPath, 0o600);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
initTemplate() {
|
|
163
|
+
this._bootstrap();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.ConfigLoader = ConfigLoader;
|
|
167
|
+
//# sourceMappingURL=ConfigLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigLoader.js","sourceRoot":"","sources":["../../src/config/ConfigLoader.ts"],"names":[],"mappings":";;;AAA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