@backendkit-labs/agent-coding 0.28.5 → 0.29.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/__tests__/context-hooks.test.d.ts +2 -0
- package/dist/__tests__/context-hooks.test.d.ts.map +1 -0
- package/dist/__tests__/context-hooks.test.js +21 -0
- package/dist/__tests__/context-hooks.test.js.map +1 -0
- package/dist/__tests__/sandbox.test.js +1 -1
- package/dist/__tests__/sandbox.test.js.map +1 -1
- package/dist/context-hooks.d.ts +11 -0
- package/dist/context-hooks.d.ts.map +1 -0
- package/dist/context-hooks.js +23 -0
- package/dist/context-hooks.js.map +1 -0
- package/dist/context-services.d.ts +12 -0
- package/dist/context-services.d.ts.map +1 -0
- package/dist/context-services.js +20 -0
- package/dist/context-services.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -8
- package/dist/index.js.map +1 -1
- package/dist/orchestration/capability-matrix.d.ts +1 -1
- package/dist/orchestration/capability-matrix.d.ts.map +1 -1
- package/dist/pipeline/__tests__/AgentEngine.orchestratorFailure.test.d.ts +2 -0
- package/dist/pipeline/__tests__/AgentEngine.orchestratorFailure.test.d.ts.map +1 -0
- package/dist/pipeline/__tests__/AgentEngine.orchestratorFailure.test.js +42 -0
- package/dist/pipeline/__tests__/AgentEngine.orchestratorFailure.test.js.map +1 -0
- package/dist/pipeline/__tests__/coding-pipeline-hooks.test.d.ts +2 -0
- package/dist/pipeline/__tests__/coding-pipeline-hooks.test.d.ts.map +1 -0
- package/dist/pipeline/__tests__/coding-pipeline-hooks.test.js +64 -0
- package/dist/pipeline/__tests__/coding-pipeline-hooks.test.js.map +1 -0
- package/dist/pipeline/__tests__/engine-brief.test.d.ts +2 -0
- package/dist/pipeline/__tests__/engine-brief.test.d.ts.map +1 -0
- package/dist/pipeline/__tests__/engine-brief.test.js +159 -0
- package/dist/pipeline/__tests__/engine-brief.test.js.map +1 -0
- package/dist/pipeline/__tests__/qa-orchestrator.test.d.ts +2 -0
- package/dist/pipeline/__tests__/qa-orchestrator.test.d.ts.map +1 -0
- package/dist/pipeline/__tests__/qa-orchestrator.test.js +276 -0
- package/dist/pipeline/__tests__/qa-orchestrator.test.js.map +1 -0
- package/dist/pipeline/coding-pipeline-hooks.d.ts +28 -0
- package/dist/pipeline/coding-pipeline-hooks.d.ts.map +1 -0
- package/dist/pipeline/coding-pipeline-hooks.js +91 -0
- package/dist/pipeline/coding-pipeline-hooks.js.map +1 -0
- package/dist/pipeline/index.d.ts +13 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +44 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/orchestration/__tests__/agent-id-consistency.test.d.ts +11 -0
- package/dist/pipeline/orchestration/__tests__/agent-id-consistency.test.d.ts.map +1 -0
- package/dist/pipeline/orchestration/__tests__/agent-id-consistency.test.js +105 -0
- package/dist/pipeline/orchestration/__tests__/agent-id-consistency.test.js.map +1 -0
- package/dist/pipeline/orchestration/__tests__/fsm-commit-skipped.test.d.ts +2 -0
- package/dist/pipeline/orchestration/__tests__/fsm-commit-skipped.test.d.ts.map +1 -0
- package/dist/pipeline/orchestration/__tests__/fsm-commit-skipped.test.js +21 -0
- package/dist/pipeline/orchestration/__tests__/fsm-commit-skipped.test.js.map +1 -0
- package/dist/pipeline/orchestration/__tests__/fsm-critical-path.test.d.ts +9 -0
- package/dist/pipeline/orchestration/__tests__/fsm-critical-path.test.d.ts.map +1 -0
- package/dist/pipeline/orchestration/__tests__/fsm-critical-path.test.js +101 -0
- package/dist/pipeline/orchestration/__tests__/fsm-critical-path.test.js.map +1 -0
- package/dist/pipeline/orchestration/__tests__/fsm-rework-and-regression.test.d.ts +2 -0
- package/dist/pipeline/orchestration/__tests__/fsm-rework-and-regression.test.d.ts.map +1 -0
- package/dist/pipeline/orchestration/__tests__/fsm-rework-and-regression.test.js +54 -0
- package/dist/pipeline/orchestration/__tests__/fsm-rework-and-regression.test.js.map +1 -0
- package/dist/pipeline/orchestration/__tests__/intent-detector-llm.test.d.ts +2 -0
- package/dist/pipeline/orchestration/__tests__/intent-detector-llm.test.d.ts.map +1 -0
- package/dist/pipeline/orchestration/__tests__/intent-detector-llm.test.js +57 -0
- package/dist/pipeline/orchestration/__tests__/intent-detector-llm.test.js.map +1 -0
- package/dist/pipeline/orchestration/__tests__/intent-detector-scores.test.d.ts +9 -0
- package/dist/pipeline/orchestration/__tests__/intent-detector-scores.test.d.ts.map +1 -0
- package/dist/pipeline/orchestration/__tests__/intent-detector-scores.test.js +43 -0
- package/dist/pipeline/orchestration/__tests__/intent-detector-scores.test.js.map +1 -0
- package/dist/pipeline/orchestration/__tests__/reflection-cycle.test.d.ts +10 -0
- package/dist/pipeline/orchestration/__tests__/reflection-cycle.test.d.ts.map +1 -0
- package/dist/pipeline/orchestration/__tests__/reflection-cycle.test.js +264 -0
- package/dist/pipeline/orchestration/__tests__/reflection-cycle.test.js.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-ci-blocker.d.ts +31 -0
- package/dist/pipeline/orchestration/audit/audit-ci-blocker.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-ci-blocker.js +120 -0
- package/dist/pipeline/orchestration/audit/audit-ci-blocker.js.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-finding-tracer.d.ts +33 -0
- package/dist/pipeline/orchestration/audit/audit-finding-tracer.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-finding-tracer.js +126 -0
- package/dist/pipeline/orchestration/audit/audit-finding-tracer.js.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-lessons-learned.d.ts +27 -0
- package/dist/pipeline/orchestration/audit/audit-lessons-learned.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-lessons-learned.js +155 -0
- package/dist/pipeline/orchestration/audit/audit-lessons-learned.js.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-pending-issues.d.ts +21 -0
- package/dist/pipeline/orchestration/audit/audit-pending-issues.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-pending-issues.js +110 -0
- package/dist/pipeline/orchestration/audit/audit-pending-issues.js.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-reflection-bridge.d.ts +39 -0
- package/dist/pipeline/orchestration/audit/audit-reflection-bridge.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-reflection-bridge.js +65 -0
- package/dist/pipeline/orchestration/audit/audit-reflection-bridge.js.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-report-renderer.d.ts +30 -0
- package/dist/pipeline/orchestration/audit/audit-report-renderer.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-report-renderer.js +249 -0
- package/dist/pipeline/orchestration/audit/audit-report-renderer.js.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-report-version-manager.d.ts +52 -0
- package/dist/pipeline/orchestration/audit/audit-report-version-manager.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-report-version-manager.js +144 -0
- package/dist/pipeline/orchestration/audit/audit-report-version-manager.js.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-silent-gates-buffer.d.ts +37 -0
- package/dist/pipeline/orchestration/audit/audit-silent-gates-buffer.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-silent-gates-buffer.js +129 -0
- package/dist/pipeline/orchestration/audit/audit-silent-gates-buffer.js.map +1 -0
- package/dist/pipeline/orchestration/audit/index.d.ts +17 -0
- package/dist/pipeline/orchestration/audit/index.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/index.js +26 -0
- package/dist/pipeline/orchestration/audit/index.js.map +1 -0
- package/dist/pipeline/orchestration/audit/types.d.ts +79 -0
- package/dist/pipeline/orchestration/audit/types.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/types.js +10 -0
- package/dist/pipeline/orchestration/audit/types.js.map +1 -0
- package/dist/pipeline/orchestration/audit-reporter.d.ts +133 -0
- package/dist/pipeline/orchestration/audit-reporter.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit-reporter.js +322 -0
- package/dist/pipeline/orchestration/audit-reporter.js.map +1 -0
- package/dist/pipeline/orchestration/config-loader.d.ts +51 -0
- package/dist/pipeline/orchestration/config-loader.d.ts.map +1 -0
- package/dist/pipeline/orchestration/config-loader.js +215 -0
- package/dist/pipeline/orchestration/config-loader.js.map +1 -0
- package/dist/pipeline/orchestration/domain-detector.d.ts +36 -0
- package/dist/pipeline/orchestration/domain-detector.d.ts.map +1 -0
- package/dist/pipeline/orchestration/domain-detector.js +157 -0
- package/dist/pipeline/orchestration/domain-detector.js.map +1 -0
- package/dist/pipeline/orchestration/fsm.d.ts +92 -0
- package/dist/pipeline/orchestration/fsm.d.ts.map +1 -0
- package/dist/pipeline/orchestration/fsm.js +243 -0
- package/dist/pipeline/orchestration/fsm.js.map +1 -0
- package/dist/pipeline/orchestration/gate-resolver.d.ts +52 -0
- package/dist/pipeline/orchestration/gate-resolver.d.ts.map +1 -0
- package/dist/pipeline/orchestration/gate-resolver.js +120 -0
- package/dist/pipeline/orchestration/gate-resolver.js.map +1 -0
- package/dist/pipeline/orchestration/index.d.ts +16 -0
- package/dist/pipeline/orchestration/index.d.ts.map +1 -0
- package/dist/pipeline/orchestration/index.js +32 -0
- package/dist/pipeline/orchestration/index.js.map +1 -0
- package/dist/pipeline/orchestration/intent-detector.d.ts +37 -0
- package/dist/pipeline/orchestration/intent-detector.d.ts.map +1 -0
- package/dist/pipeline/orchestration/intent-detector.js +248 -0
- package/dist/pipeline/orchestration/intent-detector.js.map +1 -0
- package/dist/pipeline/orchestration/keyword-match.d.ts +17 -0
- package/dist/pipeline/orchestration/keyword-match.d.ts.map +1 -0
- package/dist/pipeline/orchestration/keyword-match.js +26 -0
- package/dist/pipeline/orchestration/keyword-match.js.map +1 -0
- package/dist/pipeline/orchestration/orchestrator.d.ts +158 -0
- package/dist/pipeline/orchestration/orchestrator.d.ts.map +1 -0
- package/dist/pipeline/orchestration/orchestrator.js +414 -0
- package/dist/pipeline/orchestration/orchestrator.js.map +1 -0
- package/dist/pipeline/orchestration/policy-engine.d.ts +54 -0
- package/dist/pipeline/orchestration/policy-engine.d.ts.map +1 -0
- package/dist/pipeline/orchestration/policy-engine.js +278 -0
- package/dist/pipeline/orchestration/policy-engine.js.map +1 -0
- package/dist/pipeline/orchestration/risk-scorer.d.ts +38 -0
- package/dist/pipeline/orchestration/risk-scorer.d.ts.map +1 -0
- package/dist/pipeline/orchestration/risk-scorer.js +145 -0
- package/dist/pipeline/orchestration/risk-scorer.js.map +1 -0
- package/dist/pipeline/orchestration/task-context.d.ts +205 -0
- package/dist/pipeline/orchestration/task-context.d.ts.map +1 -0
- package/dist/pipeline/orchestration/task-context.js +162 -0
- package/dist/pipeline/orchestration/task-context.js.map +1 -0
- package/dist/pipeline/orchestration/types.d.ts +111 -0
- package/dist/pipeline/orchestration/types.d.ts.map +1 -0
- package/dist/pipeline/orchestration/types.js +37 -0
- package/dist/pipeline/orchestration/types.js.map +1 -0
- package/dist/pipeline/qa/__tests__/QAService.test.d.ts +2 -0
- package/dist/pipeline/qa/__tests__/QAService.test.d.ts.map +1 -0
- package/dist/pipeline/qa/__tests__/QAService.test.js +170 -0
- package/dist/pipeline/qa/__tests__/QAService.test.js.map +1 -0
- package/dist/pipeline/qa/__tests__/QAService.verdict.test.d.ts +2 -0
- package/dist/pipeline/qa/__tests__/QAService.verdict.test.d.ts.map +1 -0
- package/dist/pipeline/qa/__tests__/QAService.verdict.test.js +39 -0
- package/dist/pipeline/qa/__tests__/QAService.verdict.test.js.map +1 -0
- package/dist/pipeline/qa/index.d.ts +3 -0
- package/dist/pipeline/qa/index.d.ts.map +1 -0
- package/dist/pipeline/qa/index.js +6 -0
- package/dist/pipeline/qa/index.js.map +1 -0
- package/dist/pipeline/qa/qa-service.d.ts +33 -0
- package/dist/pipeline/qa/qa-service.d.ts.map +1 -0
- package/dist/pipeline/qa/qa-service.js +239 -0
- package/dist/pipeline/qa/qa-service.js.map +1 -0
- package/dist/pipeline/qa-orchestrator.d.ts +60 -0
- package/dist/pipeline/qa-orchestrator.d.ts.map +1 -0
- package/dist/pipeline/qa-orchestrator.js +177 -0
- package/dist/pipeline/qa-orchestrator.js.map +1 -0
- package/dist/pipeline/reflection/domains/agent-domain.d.ts +40 -0
- package/dist/pipeline/reflection/domains/agent-domain.d.ts.map +1 -0
- package/dist/pipeline/reflection/domains/agent-domain.js +161 -0
- package/dist/pipeline/reflection/domains/agent-domain.js.map +1 -0
- package/dist/pipeline/reflection/domains/audit-domain.d.ts +46 -0
- package/dist/pipeline/reflection/domains/audit-domain.d.ts.map +1 -0
- package/dist/pipeline/reflection/domains/audit-domain.js +241 -0
- package/dist/pipeline/reflection/domains/audit-domain.js.map +1 -0
- package/dist/pipeline/reflection/domains/bootstrap-domain.d.ts +40 -0
- package/dist/pipeline/reflection/domains/bootstrap-domain.d.ts.map +1 -0
- package/dist/pipeline/reflection/domains/bootstrap-domain.js +156 -0
- package/dist/pipeline/reflection/domains/bootstrap-domain.js.map +1 -0
- package/dist/pipeline/reflection/domains/commit-domain.d.ts +40 -0
- package/dist/pipeline/reflection/domains/commit-domain.d.ts.map +1 -0
- package/dist/pipeline/reflection/domains/commit-domain.js +174 -0
- package/dist/pipeline/reflection/domains/commit-domain.js.map +1 -0
- package/dist/pipeline/reflection/domains/test-domain.d.ts +40 -0
- package/dist/pipeline/reflection/domains/test-domain.d.ts.map +1 -0
- package/dist/pipeline/reflection/domains/test-domain.js +194 -0
- package/dist/pipeline/reflection/domains/test-domain.js.map +1 -0
- package/dist/pipeline/reflection/historical-loader.d.ts +105 -0
- package/dist/pipeline/reflection/historical-loader.d.ts.map +1 -0
- package/dist/pipeline/reflection/historical-loader.js +462 -0
- package/dist/pipeline/reflection/historical-loader.js.map +1 -0
- package/dist/pipeline/reflection/hooks/agent-hook.d.ts +72 -0
- package/dist/pipeline/reflection/hooks/agent-hook.d.ts.map +1 -0
- package/dist/pipeline/reflection/hooks/agent-hook.js +98 -0
- package/dist/pipeline/reflection/hooks/agent-hook.js.map +1 -0
- package/dist/pipeline/reflection/hooks/audit-hook.d.ts +72 -0
- package/dist/pipeline/reflection/hooks/audit-hook.d.ts.map +1 -0
- package/dist/pipeline/reflection/hooks/audit-hook.js +112 -0
- package/dist/pipeline/reflection/hooks/audit-hook.js.map +1 -0
- package/dist/pipeline/reflection/hooks/bootstrap-hook.d.ts +71 -0
- package/dist/pipeline/reflection/hooks/bootstrap-hook.d.ts.map +1 -0
- package/dist/pipeline/reflection/hooks/bootstrap-hook.js +97 -0
- package/dist/pipeline/reflection/hooks/bootstrap-hook.js.map +1 -0
- package/dist/pipeline/reflection/hooks/commit-hook.d.ts +63 -0
- package/dist/pipeline/reflection/hooks/commit-hook.d.ts.map +1 -0
- package/dist/pipeline/reflection/hooks/commit-hook.js +90 -0
- package/dist/pipeline/reflection/hooks/commit-hook.js.map +1 -0
- package/dist/pipeline/reflection/hooks/test-hook.d.ts +65 -0
- package/dist/pipeline/reflection/hooks/test-hook.d.ts.map +1 -0
- package/dist/pipeline/reflection/hooks/test-hook.js +99 -0
- package/dist/pipeline/reflection/hooks/test-hook.js.map +1 -0
- package/dist/pipeline/reflection/lessons-memo-generator.d.ts +60 -0
- package/dist/pipeline/reflection/lessons-memo-generator.d.ts.map +1 -0
- package/dist/pipeline/reflection/lessons-memo-generator.js +286 -0
- package/dist/pipeline/reflection/lessons-memo-generator.js.map +1 -0
- package/dist/store/ProjectStore.d.ts +1 -1
- package/dist/store/ProjectStore.d.ts.map +1 -1
- package/dist/store/types.d.ts +28 -0
- package/dist/store/types.d.ts.map +1 -0
- package/dist/store/types.js +3 -0
- package/dist/store/types.js.map +1 -0
- package/dist/tools/__tests__/command-parser.test.js +1 -1
- package/dist/tools/__tests__/command-parser.test.js.map +1 -1
- package/dist/tools/__tests__/declared-facts.test.d.ts +2 -0
- package/dist/tools/__tests__/declared-facts.test.d.ts.map +1 -0
- package/dist/tools/__tests__/declared-facts.test.js +21 -0
- package/dist/tools/__tests__/declared-facts.test.js.map +1 -0
- package/dist/tools/__tests__/package-install.test.d.ts +2 -0
- package/dist/tools/__tests__/package-install.test.d.ts.map +1 -0
- package/dist/tools/__tests__/package-install.test.js +56 -0
- package/dist/tools/__tests__/package-install.test.js.map +1 -0
- package/dist/tools/__tests__/save-tools.secrets.test.js +1 -1
- package/dist/tools/__tests__/save-tools.secrets.test.js.map +1 -1
- package/dist/tools/edit-file.d.ts.map +1 -1
- package/dist/tools/edit-file.js +1 -0
- package/dist/tools/edit-file.js.map +1 -1
- package/dist/tools/list-directory.d.ts.map +1 -1
- package/dist/tools/list-directory.js +1 -0
- package/dist/tools/list-directory.js.map +1 -1
- package/dist/tools/package-install.d.ts +11 -0
- package/dist/tools/package-install.d.ts.map +1 -0
- package/dist/tools/package-install.js +112 -0
- package/dist/tools/package-install.js.map +1 -0
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +1 -0
- package/dist/tools/read-file.js.map +1 -1
- package/dist/tools/run-command.d.ts.map +1 -1
- package/dist/tools/run-command.js +5 -1
- package/dist/tools/run-command.js.map +1 -1
- package/dist/tools/save-audit.d.ts.map +1 -1
- package/dist/tools/save-audit.js +7 -6
- package/dist/tools/save-audit.js.map +1 -1
- package/dist/tools/save-context.d.ts.map +1 -1
- package/dist/tools/save-context.js +3 -2
- package/dist/tools/save-context.js.map +1 -1
- package/dist/tools/save-learning.d.ts.map +1 -1
- package/dist/tools/save-learning.js +4 -3
- package/dist/tools/save-learning.js.map +1 -1
- package/dist/tools/save-user-preference.d.ts.map +1 -1
- package/dist/tools/save-user-preference.js +3 -2
- package/dist/tools/save-user-preference.js.map +1 -1
- package/dist/tools/search-files.d.ts.map +1 -1
- package/dist/tools/search-files.js +1 -0
- package/dist/tools/search-files.js.map +1 -1
- package/dist/tools/update-session.d.ts.map +1 -1
- package/dist/tools/update-session.js +3 -2
- package/dist/tools/update-session.js.map +1 -1
- package/dist/tools/write-file.d.ts.map +1 -1
- package/dist/tools/write-file.js +1 -0
- package/dist/tools/write-file.js.map +1 -1
- package/package.json +63 -44
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const agent_core_1 = require("@backendkit-labs/agent-core");
|
|
4
|
+
const coding_pipeline_hooks_1 = require("../coding-pipeline-hooks");
|
|
5
|
+
const testAgent = {
|
|
6
|
+
id: 'test-agent', name: 'Test Agent', icon: '🤖', description: 'test',
|
|
7
|
+
systemPrompt: 'You are a test agent.', allowedTools: [], delegatesTo: [],
|
|
8
|
+
};
|
|
9
|
+
function buildRegistries(provider) {
|
|
10
|
+
const agents = new agent_core_1.AgentRegistry();
|
|
11
|
+
agents.upsert(testAgent);
|
|
12
|
+
const providers = new agent_core_1.ProviderRegistry();
|
|
13
|
+
providers.register('mock', provider);
|
|
14
|
+
return { agents, tools: new agent_core_1.ToolRegistry(), providers };
|
|
15
|
+
}
|
|
16
|
+
function createMockTransport() {
|
|
17
|
+
return { transport: { emit: () => undefined, onInput: () => () => undefined, close: () => undefined } };
|
|
18
|
+
}
|
|
19
|
+
// ── Orchestration brief injection ─────────────────────────────────────────────
|
|
20
|
+
describe('AgentEngine — orchestration brief in system prompt', () => {
|
|
21
|
+
/**
|
|
22
|
+
* Creates a mock Orchestrator that returns a fixed OrchestrationResult.
|
|
23
|
+
* The mock is minimal — only the orchestrate() method is needed.
|
|
24
|
+
*/
|
|
25
|
+
function makeMockOrchestrator(result) {
|
|
26
|
+
return { orchestrate: async () => result };
|
|
27
|
+
}
|
|
28
|
+
/** Captures the system message content passed to the LLM on each chat() call. */
|
|
29
|
+
function captureSystemMessages() {
|
|
30
|
+
const captured = [];
|
|
31
|
+
const provider = {
|
|
32
|
+
async chat(messages, _tools, callbacks) {
|
|
33
|
+
const sys = messages.find(m => m.role === 'system');
|
|
34
|
+
if (sys?.content)
|
|
35
|
+
captured.push(sys.content);
|
|
36
|
+
callbacks.onChunk?.('done');
|
|
37
|
+
callbacks.onDone({ role: 'assistant', content: 'done' });
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
return { provider, captured };
|
|
41
|
+
}
|
|
42
|
+
it('injects the orchestration brief into the default agent system prompt', async () => {
|
|
43
|
+
const { provider, captured } = captureSystemMessages();
|
|
44
|
+
const { agents, tools, providers } = buildRegistries(provider);
|
|
45
|
+
const { transport } = createMockTransport();
|
|
46
|
+
const orchResult = {
|
|
47
|
+
task: {
|
|
48
|
+
taskId: 't1',
|
|
49
|
+
rawPrompt: 'add circuit breaker',
|
|
50
|
+
actionType: 'implementation',
|
|
51
|
+
domains: ['resilience', 'backend'],
|
|
52
|
+
riskLevel: 'high',
|
|
53
|
+
riskFactors: { breaking_change: false, security_sensitive: false, cross_service_impact: true, db_transactional: false, production_critical: false, complexity: 5 },
|
|
54
|
+
requiresQaApproval: true,
|
|
55
|
+
requiresSecurityReview: false,
|
|
56
|
+
requiresArchitectureReview: false,
|
|
57
|
+
customGates: {},
|
|
58
|
+
completedCustomGates: [],
|
|
59
|
+
assignedAgents: ['backend-agent'],
|
|
60
|
+
targetServices: [],
|
|
61
|
+
relatedPatterns: [],
|
|
62
|
+
status: 'classified',
|
|
63
|
+
createdAt: new Date(),
|
|
64
|
+
updatedAt: new Date(),
|
|
65
|
+
},
|
|
66
|
+
selectedAgents: [
|
|
67
|
+
{ agentId: 'backend-agent', score: 100, reason: 'Politica obligatoria' },
|
|
68
|
+
{ agentId: 'qa-engineer', score: 100, reason: 'riskLevel=high | critical' },
|
|
69
|
+
],
|
|
70
|
+
agentPipeline: [
|
|
71
|
+
{ phase: 'implement', agentId: 'backend-agent', purpose: 'Implement circuit breaker', optional: false },
|
|
72
|
+
{ phase: 'verify', agentId: 'qa-engineer', purpose: 'Verify implementation quality', optional: false },
|
|
73
|
+
],
|
|
74
|
+
appliedPolicies: [{ rule: 'riskLevel=high | critical', reason: 'riskLevel=high | critical' }],
|
|
75
|
+
requiredGates: ['qa'],
|
|
76
|
+
commitAllowed: false,
|
|
77
|
+
};
|
|
78
|
+
const engine = new agent_core_1.AgentEngine({
|
|
79
|
+
model: { provider: 'mock', id: 'mock' },
|
|
80
|
+
agents, tools, providers,
|
|
81
|
+
defaultProvider: 'mock',
|
|
82
|
+
transport,
|
|
83
|
+
defaultAgentId: 'test-agent',
|
|
84
|
+
maxIterations: 1,
|
|
85
|
+
hooks: [(0, coding_pipeline_hooks_1.codingPipelineHooks)({ orchestrator: makeMockOrchestrator(orchResult), defaultAgentId: 'test-agent' })],
|
|
86
|
+
});
|
|
87
|
+
await engine.run('add circuit breaker to the resilience module');
|
|
88
|
+
expect(captured.length).toBeGreaterThan(0);
|
|
89
|
+
const systemPrompt = captured[0];
|
|
90
|
+
// Brief must be present
|
|
91
|
+
expect(systemPrompt).toContain('Orchestrator Analysis');
|
|
92
|
+
// Task metadata
|
|
93
|
+
expect(systemPrompt).toContain('implementation');
|
|
94
|
+
expect(systemPrompt).toContain('high');
|
|
95
|
+
expect(systemPrompt).toContain('resilience');
|
|
96
|
+
// Recommended agents
|
|
97
|
+
expect(systemPrompt).toContain('backend-agent');
|
|
98
|
+
expect(systemPrompt).toContain('qa-engineer');
|
|
99
|
+
// Pipeline
|
|
100
|
+
expect(systemPrompt).toContain('[implement]');
|
|
101
|
+
expect(systemPrompt).toContain('[verify]');
|
|
102
|
+
// Gate
|
|
103
|
+
expect(systemPrompt).toContain('qa');
|
|
104
|
+
});
|
|
105
|
+
it('does not inject orchestration brief when orchestrator is not configured', async () => {
|
|
106
|
+
const { provider, captured } = captureSystemMessages();
|
|
107
|
+
const { agents, tools, providers } = buildRegistries(provider);
|
|
108
|
+
const { transport } = createMockTransport();
|
|
109
|
+
const engine = new agent_core_1.AgentEngine({
|
|
110
|
+
model: { provider: 'mock', id: 'mock' },
|
|
111
|
+
agents, tools, providers,
|
|
112
|
+
defaultProvider: 'mock',
|
|
113
|
+
transport,
|
|
114
|
+
defaultAgentId: 'test-agent',
|
|
115
|
+
maxIterations: 1,
|
|
116
|
+
// No orchestrator
|
|
117
|
+
});
|
|
118
|
+
await engine.run('simple question');
|
|
119
|
+
expect(captured[0]).not.toContain('Orchestrator Analysis');
|
|
120
|
+
});
|
|
121
|
+
it('does not inject orchestration brief for sole-fallback general agent selection', async () => {
|
|
122
|
+
const { provider, captured } = captureSystemMessages();
|
|
123
|
+
const { agents, tools, providers } = buildRegistries(provider);
|
|
124
|
+
const { transport } = createMockTransport();
|
|
125
|
+
const orchResult = {
|
|
126
|
+
task: {
|
|
127
|
+
taskId: 't2', rawPrompt: 'hello', actionType: 'unknown', domains: [],
|
|
128
|
+
riskLevel: 'low',
|
|
129
|
+
riskFactors: { breaking_change: false, security_sensitive: false, cross_service_impact: false, db_transactional: false, production_critical: false, complexity: 1 },
|
|
130
|
+
requiresQaApproval: false, requiresSecurityReview: false, requiresArchitectureReview: false,
|
|
131
|
+
customGates: {}, completedCustomGates: [],
|
|
132
|
+
assignedAgents: [], targetServices: [], relatedPatterns: [],
|
|
133
|
+
status: 'classified', createdAt: new Date(), updatedAt: new Date(),
|
|
134
|
+
},
|
|
135
|
+
// Only the fallback — should not appear in the brief
|
|
136
|
+
selectedAgents: [{ agentId: 'general', score: 50, reason: 'Fallback: agente general' }],
|
|
137
|
+
agentPipeline: undefined,
|
|
138
|
+
appliedPolicies: [],
|
|
139
|
+
requiredGates: [],
|
|
140
|
+
commitAllowed: true,
|
|
141
|
+
};
|
|
142
|
+
const engine = new agent_core_1.AgentEngine({
|
|
143
|
+
model: { provider: 'mock', id: 'mock' },
|
|
144
|
+
agents, tools, providers,
|
|
145
|
+
defaultProvider: 'mock',
|
|
146
|
+
transport,
|
|
147
|
+
defaultAgentId: 'test-agent',
|
|
148
|
+
maxIterations: 1,
|
|
149
|
+
hooks: [(0, coding_pipeline_hooks_1.codingPipelineHooks)({ orchestrator: makeMockOrchestrator(orchResult), defaultAgentId: 'test-agent' })],
|
|
150
|
+
});
|
|
151
|
+
await engine.run('hello');
|
|
152
|
+
// Brief header still present (it always renders task metadata),
|
|
153
|
+
// but no recommended-agents section since it's just the fallback
|
|
154
|
+
const systemPrompt = captured[0];
|
|
155
|
+
expect(systemPrompt).toContain('Orchestrator Analysis');
|
|
156
|
+
expect(systemPrompt).not.toContain('Recommended agents');
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
//# sourceMappingURL=engine-brief.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-brief.test.js","sourceRoot":"","sources":["../../../src/pipeline/__tests__/engine-brief.test.ts"],"names":[],"mappings":";;AAAA,4DAA8J;AAC9J,oEAA+D;AAE/D,MAAM,SAAS,GAAiB;IAC5B,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM;IACrE,YAAY,EAAE,uBAAuB,EAAE,YAAY,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE;CAC3E,CAAC;AAEF,SAAS,eAAe,CAAC,QAAqB;IAC1C,MAAM,MAAM,GAAG,IAAI,0BAAa,EAAE,CAAC;IAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7D,MAAM,SAAS,GAAG,IAAI,6BAAgB,EAAE,CAAC;IAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC/E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,yBAAY,EAAE,EAAE,SAAS,EAAE,CAAC;AAC5D,CAAC;AAED,SAAS,mBAAmB;IACxB,OAAO,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC;AAC5G,CAAC;AAED,iFAAiF;AAEjF,QAAQ,CAAC,oDAAoD,EAAE,GAAG,EAAE;IAChE;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C,CAAC;IAC7D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qa-orchestrator.test.d.ts","sourceRoot":"","sources":["../../../src/pipeline/__tests__/qa-orchestrator.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const qa_orchestrator_1 = require("../qa-orchestrator");
|
|
4
|
+
const fsm_1 = require("../orchestration/fsm");
|
|
5
|
+
const task_context_1 = require("../orchestration/task-context");
|
|
6
|
+
// ── Harness ─────────────────────────────────────────────────────────────────
|
|
7
|
+
/** Builds a real FSM-backed orchestrator stub plus spies for the audit reporter. */
|
|
8
|
+
function makeOrchestrator() {
|
|
9
|
+
const fsm = new fsm_1.TaskFSM();
|
|
10
|
+
const recordGate = jest.fn().mockResolvedValue('');
|
|
11
|
+
const completeSprint = jest.fn().mockResolvedValue(undefined);
|
|
12
|
+
const reporter = { recordGate, completeSprint };
|
|
13
|
+
const orchestrator = {
|
|
14
|
+
transitionTask: (task, to) => fsm.transition(task, to),
|
|
15
|
+
getAuditReporter: () => reporter,
|
|
16
|
+
};
|
|
17
|
+
return { orchestrator, recordGate, completeSprint };
|
|
18
|
+
}
|
|
19
|
+
function makeQaService(overrides = {}) {
|
|
20
|
+
return {
|
|
21
|
+
countCodeLines: jest.fn().mockReturnValue(20),
|
|
22
|
+
reviewResponse: jest.fn().mockResolvedValue('aprobado, se ve bien'),
|
|
23
|
+
evaluateReview: jest.fn().mockReturnValue(true),
|
|
24
|
+
extractFindings: jest.fn().mockReturnValue([]),
|
|
25
|
+
...overrides,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function makeResult(task) {
|
|
29
|
+
return {
|
|
30
|
+
task,
|
|
31
|
+
selectedAgents: [],
|
|
32
|
+
appliedPolicies: [],
|
|
33
|
+
requiredGates: [],
|
|
34
|
+
commitAllowed: false,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function makeCtx(opts) {
|
|
38
|
+
return {
|
|
39
|
+
clean: opts.clean ?? '```ts\nconst x = 1;\n```',
|
|
40
|
+
orchestrationResult: makeResult(opts.task),
|
|
41
|
+
orchestrator: opts.orchestrator,
|
|
42
|
+
qaService: opts.qaService,
|
|
43
|
+
hasAgent: () => false,
|
|
44
|
+
effectiveAgentId: 'backend',
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** A task fresh out of implementation with substantial, non-informational code. */
|
|
48
|
+
function implTask(flags = {}) {
|
|
49
|
+
const task = (0, task_context_1.createTaskContext)('Implementar el endpoint de pagos');
|
|
50
|
+
task.status = 'implementation';
|
|
51
|
+
task.requiresArchitectureReview = flags.requiresArchitectureReview ?? false;
|
|
52
|
+
task.requiresSecurityReview = flags.requiresSecurityReview ?? false;
|
|
53
|
+
task.requiresQaApproval = flags.requiresQaApproval ?? false;
|
|
54
|
+
return task;
|
|
55
|
+
}
|
|
56
|
+
const gatesRecorded = (recordGate) => recordGate.mock.calls.map(c => c[0]);
|
|
57
|
+
// ── H-003: advanceRequiredGates respeta los flags requiresX ──────────────────
|
|
58
|
+
describe('advanceRequiredGates (H-003)', () => {
|
|
59
|
+
it('no transiciona ni registra gates cuando la tarea no requiere ninguno', async () => {
|
|
60
|
+
const { orchestrator, recordGate } = makeOrchestrator();
|
|
61
|
+
const qaService = makeQaService();
|
|
62
|
+
const ctx = makeCtx({ task: implTask(), orchestrator, qaService });
|
|
63
|
+
await (0, qa_orchestrator_1.advanceRequiredGates)(ctx);
|
|
64
|
+
expect(ctx.orchestrationResult.task.status).toBe('implementation');
|
|
65
|
+
expect(recordGate).not.toHaveBeenCalled();
|
|
66
|
+
});
|
|
67
|
+
it('posiciona en qa_review SIN registrar GO de QA (lo decide el reviewer real)', async () => {
|
|
68
|
+
const { orchestrator, recordGate } = makeOrchestrator();
|
|
69
|
+
const qaService = makeQaService();
|
|
70
|
+
const ctx = makeCtx({ task: implTask({ requiresQaApproval: true }), orchestrator, qaService });
|
|
71
|
+
await (0, qa_orchestrator_1.advanceRequiredGates)(ctx);
|
|
72
|
+
// Mueve a qa_review para que corra el reviewer, pero no fabrica un GO:
|
|
73
|
+
// si el reviewer no existe, NO debe quedar un "GO sin revisiones pendientes" falso.
|
|
74
|
+
expect(ctx.orchestrationResult.task.status).toBe('qa_review');
|
|
75
|
+
expect(recordGate).not.toHaveBeenCalled();
|
|
76
|
+
});
|
|
77
|
+
it('registra architecture pero NO security/qa cuando solo requiresArchitectureReview', async () => {
|
|
78
|
+
const { orchestrator, recordGate } = makeOrchestrator();
|
|
79
|
+
const qaService = makeQaService();
|
|
80
|
+
const ctx = makeCtx({ task: implTask({ requiresArchitectureReview: true }), orchestrator, qaService });
|
|
81
|
+
await (0, qa_orchestrator_1.advanceRequiredGates)(ctx);
|
|
82
|
+
expect(ctx.orchestrationResult.task.status).toBe('design_review');
|
|
83
|
+
expect(gatesRecorded(recordGate)).toEqual(['architecture']);
|
|
84
|
+
});
|
|
85
|
+
it('auto-pasa security y posiciona en qa_review (solo security registra GO) satisfaciendo el guard del FSM', async () => {
|
|
86
|
+
const { orchestrator, recordGate } = makeOrchestrator();
|
|
87
|
+
const qaService = makeQaService();
|
|
88
|
+
const ctx = makeCtx({
|
|
89
|
+
task: implTask({ requiresSecurityReview: true, requiresQaApproval: true }),
|
|
90
|
+
orchestrator, qaService,
|
|
91
|
+
});
|
|
92
|
+
await (0, qa_orchestrator_1.advanceRequiredGates)(ctx);
|
|
93
|
+
// security se auto-pasa con GO; qa solo se posiciona (sin GO automático).
|
|
94
|
+
expect(ctx.orchestrationResult.task.status).toBe('qa_review');
|
|
95
|
+
expect(gatesRecorded(recordGate)).toEqual(['security']);
|
|
96
|
+
});
|
|
97
|
+
it('no hace nada con código trivial (< 8 líneas)', async () => {
|
|
98
|
+
const { orchestrator, recordGate } = makeOrchestrator();
|
|
99
|
+
const qaService = makeQaService({ countCodeLines: jest.fn().mockReturnValue(3) });
|
|
100
|
+
const ctx = makeCtx({ task: implTask({ requiresQaApproval: true }), orchestrator, qaService });
|
|
101
|
+
await (0, qa_orchestrator_1.advanceRequiredGates)(ctx);
|
|
102
|
+
expect(ctx.orchestrationResult.task.status).toBe('implementation');
|
|
103
|
+
expect(recordGate).not.toHaveBeenCalled();
|
|
104
|
+
});
|
|
105
|
+
it('no hace nada en solicitudes informativas', async () => {
|
|
106
|
+
const { orchestrator, recordGate } = makeOrchestrator();
|
|
107
|
+
const qaService = makeQaService();
|
|
108
|
+
const task = implTask({ requiresQaApproval: true });
|
|
109
|
+
task.rawPrompt = 'explica cómo funciona el flujo de pagos';
|
|
110
|
+
const ctx = makeCtx({ task, orchestrator, qaService });
|
|
111
|
+
await (0, qa_orchestrator_1.advanceRequiredGates)(ctx);
|
|
112
|
+
expect(ctx.orchestrationResult.task.status).toBe('implementation');
|
|
113
|
+
expect(recordGate).not.toHaveBeenCalled();
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
// ── H-004: processInlineQaReview no fuerza qa_review cuando no se requiere ────
|
|
117
|
+
describe('processInlineQaReview (H-004)', () => {
|
|
118
|
+
it('NO fuerza qa_review→approved cuando la tarea no requiere QA (review informativa)', async () => {
|
|
119
|
+
const { orchestrator, recordGate, completeSprint } = makeOrchestrator();
|
|
120
|
+
const qaService = makeQaService(); // review aprobada por defecto
|
|
121
|
+
const ctx = makeCtx({ task: implTask(), orchestrator, qaService });
|
|
122
|
+
await (0, qa_orchestrator_1.processInlineQaReview)(ctx);
|
|
123
|
+
// El estado NO debe avanzar a approved: una tarea sin gates commitea directo.
|
|
124
|
+
expect(ctx.orchestrationResult.task.status).toBe('implementation');
|
|
125
|
+
// Pero la review inline sí queda registrada como gate de QA.
|
|
126
|
+
expect(gatesRecorded(recordGate)).toEqual(['qa']);
|
|
127
|
+
expect(completeSprint).not.toHaveBeenCalled();
|
|
128
|
+
});
|
|
129
|
+
it('sí avanza qa_review→approved cuando la tarea requiere QA y la review aprueba', async () => {
|
|
130
|
+
const { orchestrator, completeSprint } = makeOrchestrator();
|
|
131
|
+
const qaService = makeQaService();
|
|
132
|
+
const ctx = makeCtx({ task: implTask({ requiresQaApproval: true }), orchestrator, qaService });
|
|
133
|
+
await (0, qa_orchestrator_1.processInlineQaReview)(ctx);
|
|
134
|
+
expect(ctx.orchestrationResult.task.status).toBe('approved');
|
|
135
|
+
expect(completeSprint).toHaveBeenCalledTimes(1);
|
|
136
|
+
});
|
|
137
|
+
it('transiciona a rework_required cuando la review rechaza', async () => {
|
|
138
|
+
const { orchestrator, completeSprint } = makeOrchestrator();
|
|
139
|
+
const qaService = makeQaService({ evaluateReview: jest.fn().mockReturnValue(false) });
|
|
140
|
+
const ctx = makeCtx({ task: implTask({ requiresQaApproval: true }), orchestrator, qaService });
|
|
141
|
+
await (0, qa_orchestrator_1.processInlineQaReview)(ctx);
|
|
142
|
+
expect(ctx.orchestrationResult.task.status).toBe('rework_required');
|
|
143
|
+
expect(completeSprint).not.toHaveBeenCalled();
|
|
144
|
+
});
|
|
145
|
+
it('hace early-return sin tocar el estado cuando no hay review disponible', async () => {
|
|
146
|
+
const { orchestrator, recordGate } = makeOrchestrator();
|
|
147
|
+
const qaService = makeQaService({ reviewResponse: jest.fn().mockResolvedValue(null) });
|
|
148
|
+
const ctx = makeCtx({ task: implTask({ requiresQaApproval: true }), orchestrator, qaService });
|
|
149
|
+
await (0, qa_orchestrator_1.processInlineQaReview)(ctx);
|
|
150
|
+
expect(ctx.orchestrationResult.task.status).toBe('implementation');
|
|
151
|
+
expect(recordGate).not.toHaveBeenCalled();
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
const qaEngineerProfile = {
|
|
155
|
+
id: 'qa-engineer',
|
|
156
|
+
name: 'QA Engineer',
|
|
157
|
+
icon: '🧪',
|
|
158
|
+
description: 'Reviews code quality',
|
|
159
|
+
systemPrompt: 'You are a QA engineer.',
|
|
160
|
+
allowedTools: [],
|
|
161
|
+
};
|
|
162
|
+
describe('activateQaEngineerIfNeeded', () => {
|
|
163
|
+
it('returns null when task status is not qa_review', () => {
|
|
164
|
+
const { orchestrator } = makeOrchestrator();
|
|
165
|
+
const qaService = makeQaService();
|
|
166
|
+
const task = implTask({ requiresQaApproval: true });
|
|
167
|
+
// status remains 'implementation'
|
|
168
|
+
const ctx = makeCtx({ task, orchestrator, qaService });
|
|
169
|
+
ctx.hasAgent = (id) => id === 'qa-engineer';
|
|
170
|
+
const result = (0, qa_orchestrator_1.activateQaEngineerIfNeeded)(ctx);
|
|
171
|
+
expect(result).toBeNull();
|
|
172
|
+
});
|
|
173
|
+
it('returns null when noQA is true even if task is in qa_review', () => {
|
|
174
|
+
const { orchestrator } = makeOrchestrator();
|
|
175
|
+
const qaService = makeQaService();
|
|
176
|
+
const task = implTask({ requiresQaApproval: true });
|
|
177
|
+
task.status = 'qa_review';
|
|
178
|
+
const ctx = { ...makeCtx({ task, orchestrator, qaService }), hasAgent: (id) => id === 'qa-engineer', noQA: true };
|
|
179
|
+
const result = (0, qa_orchestrator_1.activateQaEngineerIfNeeded)(ctx);
|
|
180
|
+
expect(result).toBeNull();
|
|
181
|
+
});
|
|
182
|
+
it('returns null when qa-engineer agent is not in roster', () => {
|
|
183
|
+
const { orchestrator } = makeOrchestrator();
|
|
184
|
+
const qaService = makeQaService();
|
|
185
|
+
const task = implTask({ requiresQaApproval: true });
|
|
186
|
+
task.status = 'qa_review';
|
|
187
|
+
const ctx = makeCtx({ task, orchestrator, qaService });
|
|
188
|
+
// allAgents = [] by default in makeCtx
|
|
189
|
+
const result = (0, qa_orchestrator_1.activateQaEngineerIfNeeded)(ctx);
|
|
190
|
+
expect(result).toBeNull();
|
|
191
|
+
});
|
|
192
|
+
it('returns null when code is trivial (< 8 lines)', () => {
|
|
193
|
+
const { orchestrator } = makeOrchestrator();
|
|
194
|
+
const qaService = makeQaService({ countCodeLines: jest.fn().mockReturnValue(3) });
|
|
195
|
+
const task = implTask({ requiresQaApproval: true });
|
|
196
|
+
task.status = 'qa_review';
|
|
197
|
+
const ctx = makeCtx({ task, orchestrator, qaService });
|
|
198
|
+
ctx.hasAgent = (id) => id === 'qa-engineer';
|
|
199
|
+
const result = (0, qa_orchestrator_1.activateQaEngineerIfNeeded)(ctx);
|
|
200
|
+
expect(result).toBeNull();
|
|
201
|
+
});
|
|
202
|
+
it('returns null for informational requests', () => {
|
|
203
|
+
const { orchestrator } = makeOrchestrator();
|
|
204
|
+
const qaService = makeQaService();
|
|
205
|
+
const task = implTask({ requiresQaApproval: true });
|
|
206
|
+
task.status = 'qa_review';
|
|
207
|
+
task.rawPrompt = 'explica cómo funciona este módulo';
|
|
208
|
+
const ctx = makeCtx({ task, orchestrator, qaService });
|
|
209
|
+
ctx.hasAgent = (id) => id === 'qa-engineer';
|
|
210
|
+
const result = (0, qa_orchestrator_1.activateQaEngineerIfNeeded)(ctx);
|
|
211
|
+
expect(result).toBeNull();
|
|
212
|
+
});
|
|
213
|
+
it('returns null when effectiveAgentId is already qa-engineer', () => {
|
|
214
|
+
const { orchestrator } = makeOrchestrator();
|
|
215
|
+
const qaService = makeQaService();
|
|
216
|
+
const task = implTask({ requiresQaApproval: true });
|
|
217
|
+
task.status = 'qa_review';
|
|
218
|
+
const ctx = { ...makeCtx({ task, orchestrator, qaService }), hasAgent: (id) => id === 'qa-engineer', effectiveAgentId: 'qa-engineer' };
|
|
219
|
+
const result = (0, qa_orchestrator_1.activateQaEngineerIfNeeded)(ctx);
|
|
220
|
+
expect(result).toBeNull();
|
|
221
|
+
});
|
|
222
|
+
it('activates qa-engineer: returns the agent and the review message', () => {
|
|
223
|
+
const { orchestrator } = makeOrchestrator();
|
|
224
|
+
const qaService = makeQaService();
|
|
225
|
+
const task = implTask({ requiresQaApproval: true });
|
|
226
|
+
task.status = 'qa_review';
|
|
227
|
+
const ctx = makeCtx({ task, orchestrator, qaService });
|
|
228
|
+
ctx.hasAgent = (id) => id === 'qa-engineer';
|
|
229
|
+
const result = (0, qa_orchestrator_1.activateQaEngineerIfNeeded)(ctx);
|
|
230
|
+
expect(result).toEqual({ agentId: 'qa-engineer', message: expect.stringContaining('Review the following generated code') });
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
// ── processQaEngineerResponse ──────────────────────────────────────────────────
|
|
234
|
+
describe('processQaEngineerResponse', () => {
|
|
235
|
+
it('transitions to approved and calls completeSprint when review approves', async () => {
|
|
236
|
+
const { orchestrator, completeSprint } = makeOrchestrator();
|
|
237
|
+
const qaService = makeQaService({ evaluateReview: jest.fn().mockReturnValue(true) });
|
|
238
|
+
const task = implTask({ requiresQaApproval: true });
|
|
239
|
+
task.status = 'qa_review';
|
|
240
|
+
const ctx = makeCtx({ task, orchestrator, qaService });
|
|
241
|
+
ctx.effectiveAgentId = 'qa-engineer';
|
|
242
|
+
await (0, qa_orchestrator_1.processQaEngineerResponse)(ctx);
|
|
243
|
+
expect(ctx.orchestrationResult.task.status).toBe('approved');
|
|
244
|
+
expect(completeSprint).toHaveBeenCalledTimes(1);
|
|
245
|
+
});
|
|
246
|
+
it('transitions to rework_required when review rejects', async () => {
|
|
247
|
+
const { orchestrator, completeSprint } = makeOrchestrator();
|
|
248
|
+
const qaService = makeQaService({ evaluateReview: jest.fn().mockReturnValue(false) });
|
|
249
|
+
const task = implTask({ requiresQaApproval: true });
|
|
250
|
+
task.status = 'qa_review';
|
|
251
|
+
const ctx = makeCtx({ task, orchestrator, qaService });
|
|
252
|
+
await (0, qa_orchestrator_1.processQaEngineerResponse)(ctx);
|
|
253
|
+
expect(ctx.orchestrationResult.task.status).toBe('rework_required');
|
|
254
|
+
expect(completeSprint).not.toHaveBeenCalled();
|
|
255
|
+
});
|
|
256
|
+
it('records a QA gate in the audit reporter', async () => {
|
|
257
|
+
const { orchestrator, recordGate } = makeOrchestrator();
|
|
258
|
+
const qaService = makeQaService();
|
|
259
|
+
const task = implTask({ requiresQaApproval: true });
|
|
260
|
+
task.status = 'qa_review';
|
|
261
|
+
const ctx = makeCtx({ task, orchestrator, qaService });
|
|
262
|
+
await (0, qa_orchestrator_1.processQaEngineerResponse)(ctx);
|
|
263
|
+
expect(gatesRecorded(recordGate)).toContain('qa');
|
|
264
|
+
});
|
|
265
|
+
it('calls onQAReview with the clean response text', async () => {
|
|
266
|
+
const { orchestrator } = makeOrchestrator();
|
|
267
|
+
const qaService = makeQaService();
|
|
268
|
+
const task = implTask({ requiresQaApproval: true });
|
|
269
|
+
task.status = 'qa_review';
|
|
270
|
+
const onQAReview = jest.fn();
|
|
271
|
+
const ctx = { ...makeCtx({ task, orchestrator, qaService }), clean: 'aprobado', onQAReview };
|
|
272
|
+
await (0, qa_orchestrator_1.processQaEngineerResponse)(ctx);
|
|
273
|
+
expect(onQAReview).toHaveBeenCalledWith('aprobado');
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
//# sourceMappingURL=qa-orchestrator.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qa-orchestrator.test.js","sourceRoot":"","sources":["../../../src/pipeline/__tests__/qa-orchestrator.test.ts"],"names":[],"mappings":";;AAAA,wDAK4B;AAC5B,8CAA+C;AAC/C,gEAAqG;AAMrG,+EAA+E;AAE/E,oFAAoF;AACpF,SAAS,gBAAgB;IACrB,MAAM,GAAG,GAAG,IAAI,aAAO,EAAE,CAAC;IAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;IACnD,MAAM,cAAc,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC9D,MAAM,QAAQ,GAAG,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC;IAChD,MAAM,YAAY,GAAG;QACjB,cAAc,EAAE,CAAC,IAAiB,EAAE,EAAc,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC;QAC/E,gBAAgB,EAAE,GAAG,E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CAAC;QAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC7B,MAAM,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;QAE7F,MAAM,IAAA,2CAAyB,EAAC,GAAG,CAAC,CAAC;QAErC,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { EngineHooks } from '@backendkit-labs/agent-core';
|
|
2
|
+
import type { Orchestrator } from './orchestration/orchestrator';
|
|
3
|
+
import type { OrchestrationResult } from './orchestration/types';
|
|
4
|
+
import type { QAService } from './qa/qa-service';
|
|
5
|
+
export interface CodingPipelineHooksOptions {
|
|
6
|
+
/** Classifies the task before the run (intent, risk, gates, agent pipeline) and drives the FSM. */
|
|
7
|
+
orchestrator: Orchestrator;
|
|
8
|
+
/** Reviews the final answer and records the QA gate. Without it only the brief and the classification apply. */
|
|
9
|
+
qaService?: QAService;
|
|
10
|
+
/** What `beforeRun` does when the orchestrator throws. 'closed' (default) fails the run; 'open' warns and runs without gates. */
|
|
11
|
+
failureMode?: 'closed' | 'open';
|
|
12
|
+
/** Skips the automatic QA review even when `qaService` is set. */
|
|
13
|
+
noQA?: boolean;
|
|
14
|
+
/** Called with every QA review. */
|
|
15
|
+
onQAReview?: (review: string) => void;
|
|
16
|
+
/** Agent that receives the orchestration brief. Default: the agent that starts the turn. */
|
|
17
|
+
defaultAgentId?: string;
|
|
18
|
+
}
|
|
19
|
+
/** The orchestration brief for the default agent: which specialists to use, in what order, and which gates apply. */
|
|
20
|
+
export declare function buildOrchestrationBrief(result: OrchestrationResult): string;
|
|
21
|
+
/**
|
|
22
|
+
* The coding pipeline (orchestrator + QA gates) as engine hooks (SPEC-0015 F1):
|
|
23
|
+
* - `beforeRun` classifies the task; the result lives in the turn's state.
|
|
24
|
+
* - `systemPrompt` gives the default agent the brief.
|
|
25
|
+
* - `afterTurn` advances the required gates and asks for a pass of the `qa-engineer` agent (or reviews inline).
|
|
26
|
+
*/
|
|
27
|
+
export declare function codingPipelineHooks(opts: CodingPipelineHooksOptions): EngineHooks;
|
|
28
|
+
//# sourceMappingURL=coding-pipeline-hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coding-pipeline-hooks.d.ts","sourceRoot":"","sources":["../../src/pipeline/coding-pipeline-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAWjD,MAAM,WAAW,0BAA0B;IACvC,mGAAmG;IACnG,YAAY,EAAE,YAAY,CAAC;IAC3B,gHAAgH;IAChH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,iIAAiI;IACjI,WAAW,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAChC,kEAAkE;IAClE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,mCAAmC;IACnC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,4FAA4F;IAC5F,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,qHAAqH;AACrH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAkC3E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,0BAA0B,GAAG,WAAW,CAiDjF"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildOrchestrationBrief = buildOrchestrationBrief;
|
|
4
|
+
exports.codingPipelineHooks = codingPipelineHooks;
|
|
5
|
+
const qa_orchestrator_1 = require("./qa-orchestrator");
|
|
6
|
+
const STATE_KEY = 'coding-pipeline.orchestration';
|
|
7
|
+
/** The orchestration brief for the default agent: which specialists to use, in what order, and which gates apply. */
|
|
8
|
+
function buildOrchestrationBrief(result) {
|
|
9
|
+
const { task, selectedAgents, agentPipeline, requiredGates } = result;
|
|
10
|
+
const lines = ['## Orchestrator Analysis — Current Task'];
|
|
11
|
+
const domains = task.domains.length > 0 ? task.domains.join(', ') : 'general';
|
|
12
|
+
lines.push(`**Intent:** ${task.actionType} | **Risk:** ${task.riskLevel} | **Domains:** ${domains}`);
|
|
13
|
+
// Only surface non-trivial agent selections (skip sole-fallback case)
|
|
14
|
+
const nonFallback = selectedAgents.filter(a => !(a.agentId === 'general' && a.score <= 50));
|
|
15
|
+
if (nonFallback.length > 0) {
|
|
16
|
+
lines.push('\n**Recommended agents for this task (highest priority first):**');
|
|
17
|
+
for (const a of nonFallback) {
|
|
18
|
+
lines.push(`- ${a.agentId} — ${a.reason}`);
|
|
19
|
+
}
|
|
20
|
+
lines.push('\nWhen delegating via ask_agent, prioritize the agents listed above. ' +
|
|
21
|
+
'Do not delegate to unlisted agents unless the task explicitly requires it.');
|
|
22
|
+
}
|
|
23
|
+
if (agentPipeline && agentPipeline.length > 0) {
|
|
24
|
+
lines.push('\n**Suggested execution pipeline (respect this order):**');
|
|
25
|
+
agentPipeline.forEach((phase, i) => {
|
|
26
|
+
lines.push(`${i + 1}. [${phase.phase}] ${phase.agentId} — ${phase.purpose}`);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (requiredGates.length > 0) {
|
|
30
|
+
lines.push(`\n**Required gates before commit:** ${requiredGates.join(', ')}`);
|
|
31
|
+
lines.push('Ensure each gate is satisfied before considering the task complete.');
|
|
32
|
+
}
|
|
33
|
+
return lines.join('\n');
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The coding pipeline (orchestrator + QA gates) as engine hooks (SPEC-0015 F1):
|
|
37
|
+
* - `beforeRun` classifies the task; the result lives in the turn's state.
|
|
38
|
+
* - `systemPrompt` gives the default agent the brief.
|
|
39
|
+
* - `afterTurn` advances the required gates and asks for a pass of the `qa-engineer` agent (or reviews inline).
|
|
40
|
+
*/
|
|
41
|
+
function codingPipelineHooks(opts) {
|
|
42
|
+
const get = (ctx) => ctx.state.get(STATE_KEY);
|
|
43
|
+
return {
|
|
44
|
+
name: 'coding-pipeline',
|
|
45
|
+
async beforeRun(ctx) {
|
|
46
|
+
try {
|
|
47
|
+
ctx.state.set(STATE_KEY, await opts.orchestrator.orchestrate(ctx.input));
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
51
|
+
if ((opts.failureMode ?? 'closed') === 'closed') {
|
|
52
|
+
throw new Error(`Orchestrator failed; refusing to run without its gates: ${reason}`);
|
|
53
|
+
}
|
|
54
|
+
ctx.emit({ type: 'system', level: 'warn', text: `[Orchestrator] failed (${reason}); running without classification or gates` });
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
systemPrompt(ctx, profile) {
|
|
58
|
+
const result = get(ctx);
|
|
59
|
+
if (!result || profile.id !== (opts.defaultAgentId ?? ctx.principal.agentId))
|
|
60
|
+
return undefined;
|
|
61
|
+
return buildOrchestrationBrief(result);
|
|
62
|
+
},
|
|
63
|
+
async afterTurn(ctx, turn) {
|
|
64
|
+
const result = get(ctx);
|
|
65
|
+
if (!result || !opts.qaService)
|
|
66
|
+
return undefined;
|
|
67
|
+
const qaAgentId = ctx.hasAgent('qa-engineer') ? 'qa-engineer' : undefined;
|
|
68
|
+
const qaCtx = {
|
|
69
|
+
clean: turn.text,
|
|
70
|
+
orchestrationResult: result,
|
|
71
|
+
orchestrator: opts.orchestrator,
|
|
72
|
+
qaService: opts.qaService,
|
|
73
|
+
effectiveAgentId: turn.profile.id,
|
|
74
|
+
hasAgent: ctx.hasAgent,
|
|
75
|
+
qaAgentId,
|
|
76
|
+
noQA: opts.noQA,
|
|
77
|
+
onQAReview: opts.onQAReview,
|
|
78
|
+
};
|
|
79
|
+
await (0, qa_orchestrator_1.advanceRequiredGates)(qaCtx);
|
|
80
|
+
const qa = (0, qa_orchestrator_1.activateQaEngineerIfNeeded)(qaCtx);
|
|
81
|
+
if (qa)
|
|
82
|
+
return { action: 'continue', agentId: qa.agentId, message: qa.message };
|
|
83
|
+
if (qaAgentId && turn.profile.id === qaAgentId)
|
|
84
|
+
await (0, qa_orchestrator_1.processQaEngineerResponse)(qaCtx);
|
|
85
|
+
else
|
|
86
|
+
await (0, qa_orchestrator_1.processInlineQaReview)(qaCtx);
|
|
87
|
+
return undefined;
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=coding-pipeline-hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coding-pipeline-hooks.js","sourceRoot":"","sources":["../../src/pipeline/coding-pipeline-hooks.ts"],"names":[],"mappings":";;AA8BA,0DAkCC;AAQD,kDAiDC;AArHD,uDAM2B;AAE3B,MAAM,SAAS,GAAG,+BAA+B,CAAC;AAiBlD,qHAAqH;AACrH,SAAgB,uBAAuB,CAAC,MAA2B;IAC/D,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC;IAEtE,MAAM,KAAK,GAAa,CAAC,yCAAyC,CAAC,CAAC;IAEpE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9E,KAAK,CAAC,IAAI,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AI;YACrB,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;YACxB,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS;gBAAE,OAAO,SAAS,CAAC;YACjD,MAAM,SAAS,GAAG,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC;YAC1E,MAAM,KAAK,GAAc;gBACrB,KAAK,EAAE,IAAI,CAAC,IAAI;gBAChB,mBAAmB,EAAE,MAAM;gBAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,gBAAgB,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE;gBACjC,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,SAAS;gBACT,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,UAAU,EAAE,IAAI,CAAC,UAAU;aAC9B,CAAC;YAEF,MAAM,IAAA,sCAAoB,EAAC,KAAK,CAAC,CAAC;YAElC,MAAM,EAAE,GAAG,IAAA,4CAA0B,EAAC,KAAK,CAAC,CAAC;YAC7C,IAAI,EAAE;gBAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC;YAEhF,IAAI,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,SAAS;gBAAE,MAAM,IAAA,2CAAyB,EAAC,KAAK,CAAC,CAAC;;gBAClF,MAAM,IAAA,uCAAqB,EAAC,KAAK,CAAC,CAAC;YACxC,OAAO,SAAS,CAAC;QACrB,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { codingPipelineHooks, buildOrchestrationBrief } from './coding-pipeline-hooks';
|
|
2
|
+
export type { CodingPipelineHooksOptions } from './coding-pipeline-hooks';
|
|
3
|
+
export * from './orchestration';
|
|
4
|
+
export { QAService } from './qa/qa-service';
|
|
5
|
+
export type { QAServiceOptions, QAReviewResult } from './qa/qa-service';
|
|
6
|
+
export { AuditHook } from './reflection/hooks/audit-hook';
|
|
7
|
+
export { AgentHook } from './reflection/hooks/agent-hook';
|
|
8
|
+
export { TestHook } from './reflection/hooks/test-hook';
|
|
9
|
+
export { CommitHook } from './reflection/hooks/commit-hook';
|
|
10
|
+
export { BootstrapHook } from './reflection/hooks/bootstrap-hook';
|
|
11
|
+
export { HistoricalLoader } from './reflection/historical-loader';
|
|
12
|
+
export { LessonsMemoGenerator } from './reflection/lessons-memo-generator';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pipeline/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvF,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAG1E,cAAc,iBAAiB,CAAC;AAGhC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGxE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC"}
|