opencode-swarm-plugin 0.44.0 → 0.44.1
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/bin/swarm.serve.test.ts +6 -4
- package/bin/swarm.ts +16 -10
- package/dist/compaction-prompt-scoring.js +139 -0
- package/dist/eval-capture.js +12811 -0
- package/dist/hive.d.ts.map +1 -1
- package/dist/index.js +7644 -62599
- package/dist/plugin.js +23766 -78721
- package/dist/swarm-orchestrate.d.ts.map +1 -1
- package/dist/swarm-prompts.d.ts.map +1 -1
- package/dist/swarm-review.d.ts.map +1 -1
- package/package.json +17 -5
- package/.changeset/swarm-insights-data-layer.md +0 -63
- package/.hive/analysis/eval-failure-analysis-2025-12-25.md +0 -331
- package/.hive/analysis/session-data-quality-audit.md +0 -320
- package/.hive/eval-results.json +0 -483
- package/.hive/issues.jsonl +0 -138
- package/.hive/memories.jsonl +0 -729
- package/.opencode/eval-history.jsonl +0 -327
- package/.turbo/turbo-build.log +0 -9
- package/CHANGELOG.md +0 -2286
- package/SCORER-ANALYSIS.md +0 -598
- package/docs/analysis/subagent-coordination-patterns.md +0 -902
- package/docs/analysis-socratic-planner-pattern.md +0 -504
- package/docs/planning/ADR-001-monorepo-structure.md +0 -171
- package/docs/planning/ADR-002-package-extraction.md +0 -393
- package/docs/planning/ADR-003-performance-improvements.md +0 -451
- package/docs/planning/ADR-004-message-queue-features.md +0 -187
- package/docs/planning/ADR-005-devtools-observability.md +0 -202
- package/docs/planning/ADR-007-swarm-enhancements-worktree-review.md +0 -168
- package/docs/planning/ADR-008-worker-handoff-protocol.md +0 -293
- package/docs/planning/ADR-009-oh-my-opencode-patterns.md +0 -353
- package/docs/planning/ADR-010-cass-inhousing.md +0 -1215
- package/docs/planning/ROADMAP.md +0 -368
- package/docs/semantic-memory-cli-syntax.md +0 -123
- package/docs/swarm-mail-architecture.md +0 -1147
- package/docs/testing/context-recovery-test.md +0 -470
- package/evals/ARCHITECTURE.md +0 -1189
- package/evals/README.md +0 -768
- package/evals/compaction-prompt.eval.ts +0 -149
- package/evals/compaction-resumption.eval.ts +0 -289
- package/evals/coordinator-behavior.eval.ts +0 -307
- package/evals/coordinator-session.eval.ts +0 -154
- package/evals/evalite.config.ts.bak +0 -15
- package/evals/example.eval.ts +0 -31
- package/evals/fixtures/cass-baseline.ts +0 -217
- package/evals/fixtures/compaction-cases.ts +0 -350
- package/evals/fixtures/compaction-prompt-cases.ts +0 -311
- package/evals/fixtures/coordinator-sessions.ts +0 -328
- package/evals/fixtures/decomposition-cases.ts +0 -105
- package/evals/lib/compaction-loader.test.ts +0 -248
- package/evals/lib/compaction-loader.ts +0 -320
- package/evals/lib/data-loader.evalite-test.ts +0 -289
- package/evals/lib/data-loader.test.ts +0 -345
- package/evals/lib/data-loader.ts +0 -281
- package/evals/lib/llm.ts +0 -115
- package/evals/scorers/compaction-prompt-scorers.ts +0 -145
- package/evals/scorers/compaction-scorers.ts +0 -305
- package/evals/scorers/coordinator-discipline.evalite-test.ts +0 -539
- package/evals/scorers/coordinator-discipline.ts +0 -325
- package/evals/scorers/index.test.ts +0 -146
- package/evals/scorers/index.ts +0 -328
- package/evals/scorers/outcome-scorers.evalite-test.ts +0 -27
- package/evals/scorers/outcome-scorers.ts +0 -349
- package/evals/swarm-decomposition.eval.ts +0 -121
- package/examples/commands/swarm.md +0 -745
- package/examples/plugin-wrapper-template.ts +0 -2515
- package/examples/skills/hive-workflow/SKILL.md +0 -212
- package/examples/skills/skill-creator/SKILL.md +0 -223
- package/examples/skills/swarm-coordination/SKILL.md +0 -292
- package/global-skills/cli-builder/SKILL.md +0 -344
- package/global-skills/cli-builder/references/advanced-patterns.md +0 -244
- package/global-skills/learning-systems/SKILL.md +0 -644
- package/global-skills/skill-creator/LICENSE.txt +0 -202
- package/global-skills/skill-creator/SKILL.md +0 -352
- package/global-skills/skill-creator/references/output-patterns.md +0 -82
- package/global-skills/skill-creator/references/workflows.md +0 -28
- package/global-skills/swarm-coordination/SKILL.md +0 -995
- package/global-skills/swarm-coordination/references/coordinator-patterns.md +0 -235
- package/global-skills/swarm-coordination/references/strategies.md +0 -138
- package/global-skills/system-design/SKILL.md +0 -213
- package/global-skills/testing-patterns/SKILL.md +0 -430
- package/global-skills/testing-patterns/references/dependency-breaking-catalog.md +0 -586
- package/opencode-swarm-plugin-0.30.7.tgz +0 -0
- package/opencode-swarm-plugin-0.31.0.tgz +0 -0
- package/scripts/cleanup-test-memories.ts +0 -346
- package/scripts/init-skill.ts +0 -222
- package/scripts/migrate-unknown-sessions.ts +0 -349
- package/scripts/validate-skill.ts +0 -204
- package/src/agent-mail.ts +0 -1724
- package/src/anti-patterns.test.ts +0 -1167
- package/src/anti-patterns.ts +0 -448
- package/src/compaction-capture.integration.test.ts +0 -257
- package/src/compaction-hook.test.ts +0 -838
- package/src/compaction-hook.ts +0 -1204
- package/src/compaction-observability.integration.test.ts +0 -139
- package/src/compaction-observability.test.ts +0 -187
- package/src/compaction-observability.ts +0 -324
- package/src/compaction-prompt-scorers.test.ts +0 -475
- package/src/compaction-prompt-scoring.ts +0 -300
- package/src/contributor-tools.test.ts +0 -133
- package/src/contributor-tools.ts +0 -201
- package/src/dashboard.test.ts +0 -611
- package/src/dashboard.ts +0 -462
- package/src/error-enrichment.test.ts +0 -403
- package/src/error-enrichment.ts +0 -219
- package/src/eval-capture.test.ts +0 -1015
- package/src/eval-capture.ts +0 -929
- package/src/eval-gates.test.ts +0 -306
- package/src/eval-gates.ts +0 -218
- package/src/eval-history.test.ts +0 -508
- package/src/eval-history.ts +0 -214
- package/src/eval-learning.test.ts +0 -378
- package/src/eval-learning.ts +0 -360
- package/src/eval-runner.test.ts +0 -223
- package/src/eval-runner.ts +0 -402
- package/src/export-tools.test.ts +0 -476
- package/src/export-tools.ts +0 -257
- package/src/hive.integration.test.ts +0 -2241
- package/src/hive.ts +0 -1628
- package/src/index.ts +0 -940
- package/src/learning.integration.test.ts +0 -1815
- package/src/learning.ts +0 -1079
- package/src/logger.test.ts +0 -189
- package/src/logger.ts +0 -135
- package/src/mandate-promotion.test.ts +0 -473
- package/src/mandate-promotion.ts +0 -239
- package/src/mandate-storage.integration.test.ts +0 -601
- package/src/mandate-storage.test.ts +0 -578
- package/src/mandate-storage.ts +0 -794
- package/src/mandates.ts +0 -540
- package/src/memory-tools.test.ts +0 -195
- package/src/memory-tools.ts +0 -344
- package/src/memory.integration.test.ts +0 -334
- package/src/memory.test.ts +0 -158
- package/src/memory.ts +0 -527
- package/src/model-selection.test.ts +0 -188
- package/src/model-selection.ts +0 -68
- package/src/observability-tools.test.ts +0 -359
- package/src/observability-tools.ts +0 -871
- package/src/output-guardrails.test.ts +0 -438
- package/src/output-guardrails.ts +0 -381
- package/src/pattern-maturity.test.ts +0 -1160
- package/src/pattern-maturity.ts +0 -525
- package/src/planning-guardrails.test.ts +0 -491
- package/src/planning-guardrails.ts +0 -438
- package/src/plugin.ts +0 -23
- package/src/post-compaction-tracker.test.ts +0 -251
- package/src/post-compaction-tracker.ts +0 -237
- package/src/query-tools.test.ts +0 -636
- package/src/query-tools.ts +0 -324
- package/src/rate-limiter.integration.test.ts +0 -466
- package/src/rate-limiter.ts +0 -774
- package/src/replay-tools.test.ts +0 -496
- package/src/replay-tools.ts +0 -240
- package/src/repo-crawl.integration.test.ts +0 -441
- package/src/repo-crawl.ts +0 -610
- package/src/schemas/cell-events.test.ts +0 -347
- package/src/schemas/cell-events.ts +0 -807
- package/src/schemas/cell.ts +0 -257
- package/src/schemas/evaluation.ts +0 -166
- package/src/schemas/index.test.ts +0 -199
- package/src/schemas/index.ts +0 -286
- package/src/schemas/mandate.ts +0 -232
- package/src/schemas/swarm-context.ts +0 -115
- package/src/schemas/task.ts +0 -161
- package/src/schemas/worker-handoff.test.ts +0 -302
- package/src/schemas/worker-handoff.ts +0 -131
- package/src/sessions/agent-discovery.test.ts +0 -137
- package/src/sessions/agent-discovery.ts +0 -112
- package/src/sessions/index.ts +0 -15
- package/src/skills.integration.test.ts +0 -1192
- package/src/skills.test.ts +0 -643
- package/src/skills.ts +0 -1549
- package/src/storage.integration.test.ts +0 -341
- package/src/storage.ts +0 -884
- package/src/structured.integration.test.ts +0 -817
- package/src/structured.test.ts +0 -1046
- package/src/structured.ts +0 -762
- package/src/swarm-decompose.test.ts +0 -188
- package/src/swarm-decompose.ts +0 -1302
- package/src/swarm-deferred.integration.test.ts +0 -157
- package/src/swarm-deferred.test.ts +0 -38
- package/src/swarm-insights.test.ts +0 -214
- package/src/swarm-insights.ts +0 -459
- package/src/swarm-mail.integration.test.ts +0 -970
- package/src/swarm-mail.ts +0 -739
- package/src/swarm-orchestrate.integration.test.ts +0 -282
- package/src/swarm-orchestrate.test.ts +0 -548
- package/src/swarm-orchestrate.ts +0 -3084
- package/src/swarm-prompts.test.ts +0 -1270
- package/src/swarm-prompts.ts +0 -2077
- package/src/swarm-research.integration.test.ts +0 -701
- package/src/swarm-research.test.ts +0 -698
- package/src/swarm-research.ts +0 -472
- package/src/swarm-review.integration.test.ts +0 -285
- package/src/swarm-review.test.ts +0 -879
- package/src/swarm-review.ts +0 -709
- package/src/swarm-strategies.ts +0 -407
- package/src/swarm-worktree.test.ts +0 -501
- package/src/swarm-worktree.ts +0 -575
- package/src/swarm.integration.test.ts +0 -2377
- package/src/swarm.ts +0 -38
- package/src/tool-adapter.integration.test.ts +0 -1221
- package/src/tool-availability.ts +0 -461
- package/tsconfig.json +0 -28
|
@@ -1,539 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for coordinator-discipline scorers
|
|
3
|
-
*/
|
|
4
|
-
import { describe, expect, it } from "bun:test";
|
|
5
|
-
import type { CoordinatorSession } from "../../src/eval-capture.js";
|
|
6
|
-
import {
|
|
7
|
-
overallDiscipline,
|
|
8
|
-
|
|
9
|
-
reviewThoroughness,
|
|
10
|
-
spawnEfficiency,
|
|
11
|
-
timeToFirstSpawn,
|
|
12
|
-
violationCount,
|
|
13
|
-
} from "./coordinator-discipline.js";
|
|
14
|
-
|
|
15
|
-
describe("violationCount", () => {
|
|
16
|
-
it("scores 1.0 for zero violations", async () => {
|
|
17
|
-
const session: CoordinatorSession = {
|
|
18
|
-
session_id: "test-session",
|
|
19
|
-
epic_id: "test-epic",
|
|
20
|
-
start_time: "2025-01-01T00:00:00Z",
|
|
21
|
-
end_time: "2025-01-01T01:00:00Z",
|
|
22
|
-
events: [
|
|
23
|
-
{
|
|
24
|
-
session_id: "test-session",
|
|
25
|
-
epic_id: "test-epic",
|
|
26
|
-
timestamp: "2025-01-01T00:00:00Z",
|
|
27
|
-
event_type: "DECISION",
|
|
28
|
-
decision_type: "strategy_selected",
|
|
29
|
-
payload: { strategy: "file-based" },
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const result = await violationCount({
|
|
35
|
-
output: JSON.stringify(session),
|
|
36
|
-
expected: {},
|
|
37
|
-
input: undefined,
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
expect(result.score).toBe(1.0);
|
|
41
|
-
expect(result.message).toContain("0 violations");
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("decreases score by 0.2 per violation", () => {
|
|
45
|
-
const session: CoordinatorSession = {
|
|
46
|
-
session_id: "test-session",
|
|
47
|
-
epic_id: "test-epic",
|
|
48
|
-
start_time: "2025-01-01T00:00:00Z",
|
|
49
|
-
end_time: "2025-01-01T01:00:00Z",
|
|
50
|
-
events: [
|
|
51
|
-
{
|
|
52
|
-
session_id: "test-session",
|
|
53
|
-
epic_id: "test-epic",
|
|
54
|
-
timestamp: "2025-01-01T00:00:10Z",
|
|
55
|
-
event_type: "VIOLATION",
|
|
56
|
-
violation_type: "coordinator_edited_file",
|
|
57
|
-
payload: { file: "test.ts" },
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
session_id: "test-session",
|
|
61
|
-
epic_id: "test-epic",
|
|
62
|
-
timestamp: "2025-01-01T00:00:20Z",
|
|
63
|
-
event_type: "VIOLATION",
|
|
64
|
-
violation_type: "coordinator_ran_tests",
|
|
65
|
-
payload: { command: "bun test" },
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const result = violationCount.scorer({
|
|
71
|
-
output: JSON.stringify(session),
|
|
72
|
-
expected: {},
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
expect(result.score).toBe(0.6); // 1.0 - 0.2 * 2
|
|
76
|
-
expect(result.message).toContain("2 violations");
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it("floors score at 0.0 for many violations", () => {
|
|
80
|
-
const session: CoordinatorSession = {
|
|
81
|
-
session_id: "test-session",
|
|
82
|
-
epic_id: "test-epic",
|
|
83
|
-
start_time: "2025-01-01T00:00:00Z",
|
|
84
|
-
events: Array.from({ length: 10 }, (_, i) => ({
|
|
85
|
-
session_id: "test-session",
|
|
86
|
-
epic_id: "test-epic",
|
|
87
|
-
timestamp: `2025-01-01T00:00:${String(i).padStart(2, "0")}Z`,
|
|
88
|
-
event_type: "VIOLATION" as const,
|
|
89
|
-
violation_type: "coordinator_edited_file" as const,
|
|
90
|
-
payload: { file: `test${i}.ts` },
|
|
91
|
-
})),
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const result = violationCount.scorer({
|
|
95
|
-
output: JSON.stringify(session),
|
|
96
|
-
expected: {},
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
expect(result.score).toBe(0.0);
|
|
100
|
-
expect(result.message).toContain("10 violations");
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
describe("spawnEfficiency", () => {
|
|
105
|
-
it("scores 1.0 when all subtasks have workers spawned", () => {
|
|
106
|
-
const session: CoordinatorSession = {
|
|
107
|
-
session_id: "test-session",
|
|
108
|
-
epic_id: "test-epic",
|
|
109
|
-
start_time: "2025-01-01T00:00:00Z",
|
|
110
|
-
events: [
|
|
111
|
-
{
|
|
112
|
-
session_id: "test-session",
|
|
113
|
-
epic_id: "test-epic",
|
|
114
|
-
timestamp: "2025-01-01T00:00:00Z",
|
|
115
|
-
event_type: "DECISION",
|
|
116
|
-
decision_type: "decomposition_complete",
|
|
117
|
-
payload: { subtask_count: 3 },
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
session_id: "test-session",
|
|
121
|
-
epic_id: "test-epic",
|
|
122
|
-
timestamp: "2025-01-01T00:00:10Z",
|
|
123
|
-
event_type: "DECISION",
|
|
124
|
-
decision_type: "worker_spawned",
|
|
125
|
-
payload: { bead_id: "bd-1" },
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
session_id: "test-session",
|
|
129
|
-
epic_id: "test-epic",
|
|
130
|
-
timestamp: "2025-01-01T00:00:20Z",
|
|
131
|
-
event_type: "DECISION",
|
|
132
|
-
decision_type: "worker_spawned",
|
|
133
|
-
payload: { bead_id: "bd-2" },
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
session_id: "test-session",
|
|
137
|
-
epic_id: "test-epic",
|
|
138
|
-
timestamp: "2025-01-01T00:00:30Z",
|
|
139
|
-
event_type: "DECISION",
|
|
140
|
-
decision_type: "worker_spawned",
|
|
141
|
-
payload: { bead_id: "bd-3" },
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
const result = spawnEfficiency.scorer({
|
|
147
|
-
output: JSON.stringify(session),
|
|
148
|
-
expected: {},
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
expect(result.score).toBe(1.0);
|
|
152
|
-
expect(result.message).toContain("3/3");
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
it("scores less than 1.0 when some workers not spawned", () => {
|
|
156
|
-
const session: CoordinatorSession = {
|
|
157
|
-
session_id: "test-session",
|
|
158
|
-
epic_id: "test-epic",
|
|
159
|
-
start_time: "2025-01-01T00:00:00Z",
|
|
160
|
-
events: [
|
|
161
|
-
{
|
|
162
|
-
session_id: "test-session",
|
|
163
|
-
epic_id: "test-epic",
|
|
164
|
-
timestamp: "2025-01-01T00:00:00Z",
|
|
165
|
-
event_type: "DECISION",
|
|
166
|
-
decision_type: "decomposition_complete",
|
|
167
|
-
payload: { subtask_count: 4 },
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
session_id: "test-session",
|
|
171
|
-
epic_id: "test-epic",
|
|
172
|
-
timestamp: "2025-01-01T00:00:10Z",
|
|
173
|
-
event_type: "DECISION",
|
|
174
|
-
decision_type: "worker_spawned",
|
|
175
|
-
payload: { bead_id: "bd-1" },
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
session_id: "test-session",
|
|
179
|
-
epic_id: "test-epic",
|
|
180
|
-
timestamp: "2025-01-01T00:00:20Z",
|
|
181
|
-
event_type: "DECISION",
|
|
182
|
-
decision_type: "worker_spawned",
|
|
183
|
-
payload: { bead_id: "bd-2" },
|
|
184
|
-
},
|
|
185
|
-
],
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
const result = spawnEfficiency.scorer({
|
|
189
|
-
output: JSON.stringify(session),
|
|
190
|
-
expected: {},
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
expect(result.score).toBe(0.5); // 2/4
|
|
194
|
-
expect(result.message).toContain("2/4");
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
it("returns 0 when no decomposition event found", () => {
|
|
198
|
-
const session: CoordinatorSession = {
|
|
199
|
-
session_id: "test-session",
|
|
200
|
-
epic_id: "test-epic",
|
|
201
|
-
start_time: "2025-01-01T00:00:00Z",
|
|
202
|
-
events: [
|
|
203
|
-
{
|
|
204
|
-
session_id: "test-session",
|
|
205
|
-
epic_id: "test-epic",
|
|
206
|
-
timestamp: "2025-01-01T00:00:10Z",
|
|
207
|
-
event_type: "DECISION",
|
|
208
|
-
decision_type: "worker_spawned",
|
|
209
|
-
payload: { bead_id: "bd-1" },
|
|
210
|
-
},
|
|
211
|
-
],
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
const result = spawnEfficiency.scorer({
|
|
215
|
-
output: JSON.stringify(session),
|
|
216
|
-
expected: {},
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
expect(result.score).toBe(0);
|
|
220
|
-
expect(result.message).toContain("No decomposition");
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
describe("reviewThoroughness", () => {
|
|
225
|
-
it("scores 1.0 when all workers have reviews", () => {
|
|
226
|
-
const session: CoordinatorSession = {
|
|
227
|
-
session_id: "test-session",
|
|
228
|
-
epic_id: "test-epic",
|
|
229
|
-
start_time: "2025-01-01T00:00:00Z",
|
|
230
|
-
events: [
|
|
231
|
-
{
|
|
232
|
-
session_id: "test-session",
|
|
233
|
-
epic_id: "test-epic",
|
|
234
|
-
timestamp: "2025-01-01T00:00:00Z",
|
|
235
|
-
event_type: "OUTCOME",
|
|
236
|
-
outcome_type: "subtask_success",
|
|
237
|
-
payload: { bead_id: "bd-1" },
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
session_id: "test-session",
|
|
241
|
-
epic_id: "test-epic",
|
|
242
|
-
timestamp: "2025-01-01T00:00:10Z",
|
|
243
|
-
event_type: "OUTCOME",
|
|
244
|
-
outcome_type: "subtask_success",
|
|
245
|
-
payload: { bead_id: "bd-2" },
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
session_id: "test-session",
|
|
249
|
-
epic_id: "test-epic",
|
|
250
|
-
timestamp: "2025-01-01T00:00:20Z",
|
|
251
|
-
event_type: "DECISION",
|
|
252
|
-
decision_type: "review_completed",
|
|
253
|
-
payload: { bead_id: "bd-1" },
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
session_id: "test-session",
|
|
257
|
-
epic_id: "test-epic",
|
|
258
|
-
timestamp: "2025-01-01T00:00:30Z",
|
|
259
|
-
event_type: "DECISION",
|
|
260
|
-
decision_type: "review_completed",
|
|
261
|
-
payload: { bead_id: "bd-2" },
|
|
262
|
-
},
|
|
263
|
-
],
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
const result = reviewThoroughness.scorer({
|
|
267
|
-
output: JSON.stringify(session),
|
|
268
|
-
expected: {},
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
expect(result.score).toBe(1.0);
|
|
272
|
-
expect(result.message).toContain("2/2");
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
it("scores less than 1.0 when some workers missing reviews", () => {
|
|
276
|
-
const session: CoordinatorSession = {
|
|
277
|
-
session_id: "test-session",
|
|
278
|
-
epic_id: "test-epic",
|
|
279
|
-
start_time: "2025-01-01T00:00:00Z",
|
|
280
|
-
events: [
|
|
281
|
-
{
|
|
282
|
-
session_id: "test-session",
|
|
283
|
-
epic_id: "test-epic",
|
|
284
|
-
timestamp: "2025-01-01T00:00:00Z",
|
|
285
|
-
event_type: "OUTCOME",
|
|
286
|
-
outcome_type: "subtask_success",
|
|
287
|
-
payload: { bead_id: "bd-1" },
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
session_id: "test-session",
|
|
291
|
-
epic_id: "test-epic",
|
|
292
|
-
timestamp: "2025-01-01T00:00:10Z",
|
|
293
|
-
event_type: "OUTCOME",
|
|
294
|
-
outcome_type: "subtask_success",
|
|
295
|
-
payload: { bead_id: "bd-2" },
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
session_id: "test-session",
|
|
299
|
-
epic_id: "test-epic",
|
|
300
|
-
timestamp: "2025-01-01T00:00:20Z",
|
|
301
|
-
event_type: "DECISION",
|
|
302
|
-
decision_type: "review_completed",
|
|
303
|
-
payload: { bead_id: "bd-1" },
|
|
304
|
-
},
|
|
305
|
-
],
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
const result = reviewThoroughness.scorer({
|
|
309
|
-
output: JSON.stringify(session),
|
|
310
|
-
expected: {},
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
expect(result.score).toBe(0.5); // 1/2
|
|
314
|
-
expect(result.message).toContain("1/2");
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
it("returns 1.0 when no workers finished", () => {
|
|
318
|
-
const session: CoordinatorSession = {
|
|
319
|
-
session_id: "test-session",
|
|
320
|
-
epic_id: "test-epic",
|
|
321
|
-
start_time: "2025-01-01T00:00:00Z",
|
|
322
|
-
events: [
|
|
323
|
-
{
|
|
324
|
-
session_id: "test-session",
|
|
325
|
-
epic_id: "test-epic",
|
|
326
|
-
timestamp: "2025-01-01T00:00:00Z",
|
|
327
|
-
event_type: "DECISION",
|
|
328
|
-
decision_type: "strategy_selected",
|
|
329
|
-
payload: { strategy: "file-based" },
|
|
330
|
-
},
|
|
331
|
-
],
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
const result = reviewThoroughness.scorer({
|
|
335
|
-
output: JSON.stringify(session),
|
|
336
|
-
expected: {},
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
expect(result.score).toBe(1.0);
|
|
340
|
-
expect(result.message).toContain("No finished workers");
|
|
341
|
-
});
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
describe("timeToFirstSpawn", () => {
|
|
345
|
-
it("normalizes time to 0-1 range (faster is better)", () => {
|
|
346
|
-
// 30 seconds to first spawn
|
|
347
|
-
const session: CoordinatorSession = {
|
|
348
|
-
session_id: "test-session",
|
|
349
|
-
epic_id: "test-epic",
|
|
350
|
-
start_time: "2025-01-01T00:00:00Z",
|
|
351
|
-
events: [
|
|
352
|
-
{
|
|
353
|
-
session_id: "test-session",
|
|
354
|
-
epic_id: "test-epic",
|
|
355
|
-
timestamp: "2025-01-01T00:00:00Z",
|
|
356
|
-
event_type: "DECISION",
|
|
357
|
-
decision_type: "decomposition_complete",
|
|
358
|
-
payload: { subtask_count: 3 },
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
session_id: "test-session",
|
|
362
|
-
epic_id: "test-epic",
|
|
363
|
-
timestamp: "2025-01-01T00:00:30Z",
|
|
364
|
-
event_type: "DECISION",
|
|
365
|
-
decision_type: "worker_spawned",
|
|
366
|
-
payload: { bead_id: "bd-1" },
|
|
367
|
-
},
|
|
368
|
-
],
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
const result = timeToFirstSpawn.scorer({
|
|
372
|
-
output: JSON.stringify(session),
|
|
373
|
-
expected: {},
|
|
374
|
-
});
|
|
375
|
-
|
|
376
|
-
// 30s should score around 0.95 (fast spawn)
|
|
377
|
-
expect(result.score).toBeGreaterThan(0.9);
|
|
378
|
-
expect(result.message).toContain("30000ms");
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
it("returns 0 when no worker spawned", () => {
|
|
382
|
-
const session: CoordinatorSession = {
|
|
383
|
-
session_id: "test-session",
|
|
384
|
-
epic_id: "test-epic",
|
|
385
|
-
start_time: "2025-01-01T00:00:00Z",
|
|
386
|
-
events: [
|
|
387
|
-
{
|
|
388
|
-
session_id: "test-session",
|
|
389
|
-
epic_id: "test-epic",
|
|
390
|
-
timestamp: "2025-01-01T00:00:00Z",
|
|
391
|
-
event_type: "DECISION",
|
|
392
|
-
decision_type: "decomposition_complete",
|
|
393
|
-
payload: { subtask_count: 3 },
|
|
394
|
-
},
|
|
395
|
-
],
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
const result = timeToFirstSpawn.scorer({
|
|
399
|
-
output: JSON.stringify(session),
|
|
400
|
-
expected: {},
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
expect(result.score).toBe(0);
|
|
404
|
-
expect(result.message).toContain("No worker spawned");
|
|
405
|
-
});
|
|
406
|
-
|
|
407
|
-
it("returns 0 when no decomposition event", () => {
|
|
408
|
-
const session: CoordinatorSession = {
|
|
409
|
-
session_id: "test-session",
|
|
410
|
-
epic_id: "test-epic",
|
|
411
|
-
start_time: "2025-01-01T00:00:00Z",
|
|
412
|
-
events: [
|
|
413
|
-
{
|
|
414
|
-
session_id: "test-session",
|
|
415
|
-
epic_id: "test-epic",
|
|
416
|
-
timestamp: "2025-01-01T00:00:10Z",
|
|
417
|
-
event_type: "DECISION",
|
|
418
|
-
decision_type: "worker_spawned",
|
|
419
|
-
payload: { bead_id: "bd-1" },
|
|
420
|
-
},
|
|
421
|
-
],
|
|
422
|
-
};
|
|
423
|
-
|
|
424
|
-
const result = timeToFirstSpawn.scorer({
|
|
425
|
-
output: JSON.stringify(session),
|
|
426
|
-
expected: {},
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
expect(result.score).toBe(0);
|
|
430
|
-
expect(result.message).toContain("No decomposition");
|
|
431
|
-
});
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
describe("overallDiscipline", () => {
|
|
435
|
-
it("computes weighted composite score", () => {
|
|
436
|
-
// Perfect session
|
|
437
|
-
const session: CoordinatorSession = {
|
|
438
|
-
session_id: "test-session",
|
|
439
|
-
epic_id: "test-epic",
|
|
440
|
-
start_time: "2025-01-01T00:00:00Z",
|
|
441
|
-
events: [
|
|
442
|
-
{
|
|
443
|
-
session_id: "test-session",
|
|
444
|
-
epic_id: "test-epic",
|
|
445
|
-
timestamp: "2025-01-01T00:00:00Z",
|
|
446
|
-
event_type: "DECISION",
|
|
447
|
-
decision_type: "decomposition_complete",
|
|
448
|
-
payload: { subtask_count: 2 },
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
session_id: "test-session",
|
|
452
|
-
epic_id: "test-epic",
|
|
453
|
-
timestamp: "2025-01-01T00:00:10Z",
|
|
454
|
-
event_type: "DECISION",
|
|
455
|
-
decision_type: "worker_spawned",
|
|
456
|
-
payload: { bead_id: "bd-1" },
|
|
457
|
-
},
|
|
458
|
-
{
|
|
459
|
-
session_id: "test-session",
|
|
460
|
-
epic_id: "test-epic",
|
|
461
|
-
timestamp: "2025-01-01T00:00:20Z",
|
|
462
|
-
event_type: "DECISION",
|
|
463
|
-
decision_type: "worker_spawned",
|
|
464
|
-
payload: { bead_id: "bd-2" },
|
|
465
|
-
},
|
|
466
|
-
{
|
|
467
|
-
session_id: "test-session",
|
|
468
|
-
epic_id: "test-epic",
|
|
469
|
-
timestamp: "2025-01-01T00:10:00Z",
|
|
470
|
-
event_type: "OUTCOME",
|
|
471
|
-
outcome_type: "subtask_success",
|
|
472
|
-
payload: { bead_id: "bd-1" },
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
session_id: "test-session",
|
|
476
|
-
epic_id: "test-epic",
|
|
477
|
-
timestamp: "2025-01-01T00:10:10Z",
|
|
478
|
-
event_type: "OUTCOME",
|
|
479
|
-
outcome_type: "subtask_success",
|
|
480
|
-
payload: { bead_id: "bd-2" },
|
|
481
|
-
},
|
|
482
|
-
{
|
|
483
|
-
session_id: "test-session",
|
|
484
|
-
epic_id: "test-epic",
|
|
485
|
-
timestamp: "2025-01-01T00:10:20Z",
|
|
486
|
-
event_type: "DECISION",
|
|
487
|
-
decision_type: "review_completed",
|
|
488
|
-
payload: { bead_id: "bd-1" },
|
|
489
|
-
},
|
|
490
|
-
{
|
|
491
|
-
session_id: "test-session",
|
|
492
|
-
epic_id: "test-epic",
|
|
493
|
-
timestamp: "2025-01-01T00:10:30Z",
|
|
494
|
-
event_type: "DECISION",
|
|
495
|
-
decision_type: "review_completed",
|
|
496
|
-
payload: { bead_id: "bd-2" },
|
|
497
|
-
},
|
|
498
|
-
],
|
|
499
|
-
};
|
|
500
|
-
|
|
501
|
-
const result = overallDiscipline.scorer({
|
|
502
|
-
output: JSON.stringify(session),
|
|
503
|
-
expected: {},
|
|
504
|
-
});
|
|
505
|
-
|
|
506
|
-
// Perfect session should score very high (close to 1.0)
|
|
507
|
-
expect(result.score).toBeGreaterThan(0.95);
|
|
508
|
-
expect(result.message).toContain("Overall");
|
|
509
|
-
});
|
|
510
|
-
|
|
511
|
-
it("includes breakdown in message", () => {
|
|
512
|
-
const session: CoordinatorSession = {
|
|
513
|
-
session_id: "test-session",
|
|
514
|
-
epic_id: "test-epic",
|
|
515
|
-
start_time: "2025-01-01T00:00:00Z",
|
|
516
|
-
events: [
|
|
517
|
-
{
|
|
518
|
-
session_id: "test-session",
|
|
519
|
-
epic_id: "test-epic",
|
|
520
|
-
timestamp: "2025-01-01T00:00:00Z",
|
|
521
|
-
event_type: "DECISION",
|
|
522
|
-
decision_type: "strategy_selected",
|
|
523
|
-
payload: { strategy: "file-based" },
|
|
524
|
-
},
|
|
525
|
-
],
|
|
526
|
-
};
|
|
527
|
-
|
|
528
|
-
const result = overallDiscipline.scorer({
|
|
529
|
-
output: JSON.stringify(session),
|
|
530
|
-
expected: {},
|
|
531
|
-
});
|
|
532
|
-
|
|
533
|
-
expect(result.message).toContain("Violations:");
|
|
534
|
-
expect(result.message).toContain("Spawn:");
|
|
535
|
-
expect(result.message).toContain("Review:");
|
|
536
|
-
expect(result.message).toContain("Speed:");
|
|
537
|
-
});
|
|
538
|
-
});
|
|
539
|
-
|