dialectic 0.1.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/.cursor/commands/setup-test.mdc +175 -0
- package/.cursor/rules/basic-code-cleanup.mdc +1110 -0
- package/.cursor/rules/riper5.mdc +96 -0
- package/.env.example +6 -0
- package/AGENTS.md +1052 -0
- package/LICENSE +21 -0
- package/README.md +93 -0
- package/WARP.md +113 -0
- package/dialectic-1.0.0.tgz +0 -0
- package/dialectic.js +10 -0
- package/docs/commands.md +375 -0
- package/docs/configuration.md +882 -0
- package/docs/context_summarization.md +1023 -0
- package/docs/debate_flow.md +1127 -0
- package/docs/eval_flow.md +795 -0
- package/docs/evaluator.md +141 -0
- package/examples/debate-config-openrouter.json +48 -0
- package/examples/debate_config1.json +48 -0
- package/examples/eval/eval1/eval_config1.json +13 -0
- package/examples/eval/eval1/result1.json +62 -0
- package/examples/eval/eval1/result2.json +97 -0
- package/examples/eval_summary_format.md +11 -0
- package/examples/example3/debate-config.json +64 -0
- package/examples/example3/eval_config2.json +25 -0
- package/examples/example3/problem.md +17 -0
- package/examples/example3/rounds_test/eval_run.sh +16 -0
- package/examples/example3/rounds_test/run_test.sh +16 -0
- package/examples/kata1/architect-only-solution_2-rounds.json +121 -0
- package/examples/kata1/architect-perf-solution_2-rounds.json +234 -0
- package/examples/kata1/debate-config-kata1.json +54 -0
- package/examples/kata1/eval_architect-only_2-rounds.json +97 -0
- package/examples/kata1/eval_architect-perf_2-rounds.json +97 -0
- package/examples/kata1/kata1-report.md +12224 -0
- package/examples/kata1/kata1-report_temps-01_01_01_07.md +2451 -0
- package/examples/kata1/kata1.md +5 -0
- package/examples/kata1/meta.txt +1 -0
- package/examples/kata2/debate-config.json +54 -0
- package/examples/kata2/eval_config1.json +21 -0
- package/examples/kata2/eval_config2.json +25 -0
- package/examples/kata2/kata2.md +5 -0
- package/examples/kata2/only_architect/debate-config.json +45 -0
- package/examples/kata2/only_architect/eval_run.sh +11 -0
- package/examples/kata2/only_architect/run_test.sh +5 -0
- package/examples/kata2/rounds_test/eval_run.sh +11 -0
- package/examples/kata2/rounds_test/run_test.sh +5 -0
- package/examples/kata2/summary_length_test/eval_run.sh +11 -0
- package/examples/kata2/summary_length_test/eval_run_w_clarify.sh +7 -0
- package/examples/kata2/summary_length_test/run_test.sh +5 -0
- package/examples/task-queue/debate-config.json +76 -0
- package/examples/task-queue/debate_report.md +566 -0
- package/examples/task-queue/task-queue-system.md +25 -0
- package/jest.config.ts +13 -0
- package/multi_agent_debate_spec.md +2980 -0
- package/package.json +38 -0
- package/sanity-check-problem.txt +9 -0
- package/src/agents/prompts/architect-prompts.ts +203 -0
- package/src/agents/prompts/generalist-prompts.ts +157 -0
- package/src/agents/prompts/index.ts +41 -0
- package/src/agents/prompts/judge-prompts.ts +19 -0
- package/src/agents/prompts/kiss-prompts.ts +230 -0
- package/src/agents/prompts/performance-prompts.ts +142 -0
- package/src/agents/prompts/prompt-types.ts +68 -0
- package/src/agents/prompts/security-prompts.ts +149 -0
- package/src/agents/prompts/shared.ts +144 -0
- package/src/agents/prompts/testing-prompts.ts +149 -0
- package/src/agents/role-based-agent.ts +386 -0
- package/src/cli/commands/debate.ts +761 -0
- package/src/cli/commands/eval.ts +475 -0
- package/src/cli/commands/report.ts +265 -0
- package/src/cli/index.ts +79 -0
- package/src/core/agent.ts +198 -0
- package/src/core/clarifications.ts +34 -0
- package/src/core/judge.ts +257 -0
- package/src/core/orchestrator.ts +432 -0
- package/src/core/state-manager.ts +322 -0
- package/src/eval/evaluator-agent.ts +130 -0
- package/src/eval/prompts/system.md +41 -0
- package/src/eval/prompts/user.md +64 -0
- package/src/providers/llm-provider.ts +25 -0
- package/src/providers/openai-provider.ts +84 -0
- package/src/providers/openrouter-provider.ts +122 -0
- package/src/providers/provider-factory.ts +64 -0
- package/src/types/agent.types.ts +141 -0
- package/src/types/config.types.ts +47 -0
- package/src/types/debate.types.ts +237 -0
- package/src/types/eval.types.ts +85 -0
- package/src/utils/common.ts +104 -0
- package/src/utils/context-formatter.ts +102 -0
- package/src/utils/context-summarizer.ts +143 -0
- package/src/utils/env-loader.ts +46 -0
- package/src/utils/exit-codes.ts +5 -0
- package/src/utils/id.ts +11 -0
- package/src/utils/logger.ts +48 -0
- package/src/utils/paths.ts +10 -0
- package/src/utils/progress-ui.ts +313 -0
- package/src/utils/prompt-loader.ts +79 -0
- package/src/utils/report-generator.ts +301 -0
- package/tests/clarifications.spec.ts +128 -0
- package/tests/cli.debate.spec.ts +144 -0
- package/tests/config-loading.spec.ts +206 -0
- package/tests/context-summarizer.spec.ts +131 -0
- package/tests/debate-config-custom.json +38 -0
- package/tests/env-loader.spec.ts +149 -0
- package/tests/eval.command.spec.ts +1191 -0
- package/tests/logger.spec.ts +19 -0
- package/tests/openai-provider.spec.ts +26 -0
- package/tests/openrouter-provider.spec.ts +279 -0
- package/tests/orchestrator-summary.spec.ts +386 -0
- package/tests/orchestrator.spec.ts +207 -0
- package/tests/prompt-loader.spec.ts +52 -0
- package/tests/prompts/architect.md +16 -0
- package/tests/provider-factory.spec.ts +150 -0
- package/tests/report.command.spec.ts +546 -0
- package/tests/role-based-agent-summary.spec.ts +476 -0
- package/tests/security-agent.spec.ts +221 -0
- package/tests/shared-prompts.spec.ts +318 -0
- package/tests/state-manager.spec.ts +251 -0
- package/tests/summary-prompts.spec.ts +153 -0
- package/tsconfig.json +49 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { RoleBasedAgent } from '../src/agents/role-based-agent';
|
|
2
|
+
import { AGENT_ROLES } from '../src/types/agent.types';
|
|
3
|
+
import { getPromptsForRole } from '../src/agents/prompts';
|
|
4
|
+
|
|
5
|
+
describe('Summary Prompts', () => {
|
|
6
|
+
describe('Role-specific summary prompts', () => {
|
|
7
|
+
it('should provide summary prompt for architect role', () => {
|
|
8
|
+
const prompts = getPromptsForRole(AGENT_ROLES.ARCHITECT);
|
|
9
|
+
const summaryPrompt = prompts.summarizePrompt('test content', 1000);
|
|
10
|
+
|
|
11
|
+
expect(summaryPrompt).toBeDefined();
|
|
12
|
+
expect(typeof summaryPrompt).toBe('string');
|
|
13
|
+
expect(summaryPrompt.length).toBeGreaterThan(0);
|
|
14
|
+
expect(summaryPrompt).toContain('test content');
|
|
15
|
+
expect(summaryPrompt).toContain('1000');
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should provide summary prompt for performance role', () => {
|
|
19
|
+
const prompts = getPromptsForRole(AGENT_ROLES.PERFORMANCE);
|
|
20
|
+
const summaryPrompt = prompts.summarizePrompt('test content', 1000);
|
|
21
|
+
|
|
22
|
+
expect(summaryPrompt).toBeDefined();
|
|
23
|
+
expect(typeof summaryPrompt).toBe('string');
|
|
24
|
+
expect(summaryPrompt.length).toBeGreaterThan(0);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should provide summary prompt for security role', () => {
|
|
28
|
+
const prompts = getPromptsForRole(AGENT_ROLES.SECURITY);
|
|
29
|
+
const summaryPrompt = prompts.summarizePrompt('test content', 1000);
|
|
30
|
+
|
|
31
|
+
expect(summaryPrompt).toBeDefined();
|
|
32
|
+
expect(typeof summaryPrompt).toBe('string');
|
|
33
|
+
expect(summaryPrompt.length).toBeGreaterThan(0);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should provide summary prompt for testing role', () => {
|
|
37
|
+
const prompts = getPromptsForRole(AGENT_ROLES.TESTING);
|
|
38
|
+
const summaryPrompt = prompts.summarizePrompt('test content', 1000);
|
|
39
|
+
|
|
40
|
+
expect(summaryPrompt).toBeDefined();
|
|
41
|
+
expect(typeof summaryPrompt).toBe('string');
|
|
42
|
+
expect(summaryPrompt.length).toBeGreaterThan(0);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('should provide summary prompt for generalist role', () => {
|
|
46
|
+
const prompts = getPromptsForRole(AGENT_ROLES.GENERALIST);
|
|
47
|
+
const summaryPrompt = prompts.summarizePrompt('test content', 1000);
|
|
48
|
+
|
|
49
|
+
expect(summaryPrompt).toBeDefined();
|
|
50
|
+
expect(typeof summaryPrompt).toBe('string');
|
|
51
|
+
expect(summaryPrompt.length).toBeGreaterThan(0);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('RoleBasedAgent.defaultSummaryPrompt()', () => {
|
|
56
|
+
it('should return summary prompt for all roles', () => {
|
|
57
|
+
const roles = [
|
|
58
|
+
AGENT_ROLES.ARCHITECT,
|
|
59
|
+
AGENT_ROLES.PERFORMANCE,
|
|
60
|
+
AGENT_ROLES.SECURITY,
|
|
61
|
+
AGENT_ROLES.TESTING,
|
|
62
|
+
AGENT_ROLES.GENERALIST
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
roles.forEach(role => {
|
|
66
|
+
const prompt = RoleBasedAgent.defaultSummaryPrompt(role, 'history content', 2500);
|
|
67
|
+
|
|
68
|
+
expect(prompt).toBeDefined();
|
|
69
|
+
expect(typeof prompt).toBe('string');
|
|
70
|
+
expect(prompt.length).toBeGreaterThan(0);
|
|
71
|
+
expect(prompt).toContain('history content');
|
|
72
|
+
expect(prompt).toContain('2500');
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('should include role-specific keywords in prompts', () => {
|
|
77
|
+
const architectPrompt = RoleBasedAgent.defaultSummaryPrompt(
|
|
78
|
+
AGENT_ROLES.ARCHITECT,
|
|
79
|
+
'content',
|
|
80
|
+
1000
|
|
81
|
+
);
|
|
82
|
+
expect(architectPrompt.toLowerCase()).toMatch(/architect|design|component/);
|
|
83
|
+
|
|
84
|
+
const perfPrompt = RoleBasedAgent.defaultSummaryPrompt(
|
|
85
|
+
AGENT_ROLES.PERFORMANCE,
|
|
86
|
+
'content',
|
|
87
|
+
1000
|
|
88
|
+
);
|
|
89
|
+
expect(perfPrompt.toLowerCase()).toMatch(/performance|optimization|latency|throughput/);
|
|
90
|
+
|
|
91
|
+
const secPrompt = RoleBasedAgent.defaultSummaryPrompt(
|
|
92
|
+
AGENT_ROLES.SECURITY,
|
|
93
|
+
'content',
|
|
94
|
+
1000
|
|
95
|
+
);
|
|
96
|
+
expect(secPrompt.toLowerCase()).toMatch(/security|threat|vulnerability/);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('should interpolate content into prompt', () => {
|
|
100
|
+
const content = 'This is specific debate history content';
|
|
101
|
+
const prompt = RoleBasedAgent.defaultSummaryPrompt(
|
|
102
|
+
AGENT_ROLES.ARCHITECT,
|
|
103
|
+
content,
|
|
104
|
+
1000
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
expect(prompt).toContain(content);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('should interpolate maxLength into prompt', () => {
|
|
111
|
+
const prompt = RoleBasedAgent.defaultSummaryPrompt(
|
|
112
|
+
AGENT_ROLES.ARCHITECT,
|
|
113
|
+
'content',
|
|
114
|
+
3500
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
expect(prompt).toContain('3500');
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
describe('Summary prompt consistency', () => {
|
|
122
|
+
it('should return consistent prompts for same inputs', () => {
|
|
123
|
+
const prompt1 = RoleBasedAgent.defaultSummaryPrompt(
|
|
124
|
+
AGENT_ROLES.ARCHITECT,
|
|
125
|
+
'same content',
|
|
126
|
+
1000
|
|
127
|
+
);
|
|
128
|
+
const prompt2 = RoleBasedAgent.defaultSummaryPrompt(
|
|
129
|
+
AGENT_ROLES.ARCHITECT,
|
|
130
|
+
'same content',
|
|
131
|
+
1000
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
expect(prompt1).toBe(prompt2);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('should return different prompts for different roles', () => {
|
|
138
|
+
const archPrompt = RoleBasedAgent.defaultSummaryPrompt(
|
|
139
|
+
AGENT_ROLES.ARCHITECT,
|
|
140
|
+
'content',
|
|
141
|
+
1000
|
|
142
|
+
);
|
|
143
|
+
const perfPrompt = RoleBasedAgent.defaultSummaryPrompt(
|
|
144
|
+
AGENT_ROLES.PERFORMANCE,
|
|
145
|
+
'content',
|
|
146
|
+
1000
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
expect(archPrompt).not.toBe(perfPrompt);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// File Layout
|
|
4
|
+
"rootDir": "./src",
|
|
5
|
+
"outDir": "./dist",
|
|
6
|
+
|
|
7
|
+
// Environment Settings
|
|
8
|
+
"target": "ES2022",
|
|
9
|
+
"module": "commonjs",
|
|
10
|
+
"lib": ["ES2022"],
|
|
11
|
+
"types": ["node", "jest"],
|
|
12
|
+
"moduleResolution": "node",
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"allowSyntheticDefaultImports": true,
|
|
15
|
+
|
|
16
|
+
// Other Outputs
|
|
17
|
+
"sourceMap": true,
|
|
18
|
+
"declaration": true,
|
|
19
|
+
"declarationMap": true,
|
|
20
|
+
"removeComments": true,
|
|
21
|
+
|
|
22
|
+
// Strict Type Checking
|
|
23
|
+
"strict": true,
|
|
24
|
+
"noImplicitAny": true,
|
|
25
|
+
"strictNullChecks": true,
|
|
26
|
+
"strictFunctionTypes": true,
|
|
27
|
+
"noImplicitReturns": true,
|
|
28
|
+
"noImplicitThis": true,
|
|
29
|
+
"noUnusedLocals": true,
|
|
30
|
+
"noUnusedParameters": true,
|
|
31
|
+
|
|
32
|
+
// Additional Checks
|
|
33
|
+
"noUncheckedIndexedAccess": true,
|
|
34
|
+
"exactOptionalPropertyTypes": true,
|
|
35
|
+
"noFallthroughCasesInSwitch": true,
|
|
36
|
+
|
|
37
|
+
// Advanced Options
|
|
38
|
+
"skipLibCheck": true,
|
|
39
|
+
"forceConsistentCasingInFileNames": true,
|
|
40
|
+
"resolveJsonModule": true
|
|
41
|
+
},
|
|
42
|
+
"include": [
|
|
43
|
+
"src/**/*"
|
|
44
|
+
],
|
|
45
|
+
"exclude": [
|
|
46
|
+
"node_modules",
|
|
47
|
+
"dist"
|
|
48
|
+
]
|
|
49
|
+
}
|