@heretek-ai/epistemic-swarm 0.7.25 → 1.0.2
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/index.ts +1 -0
- package/package.json +63 -139
- package/rpc.ts +1 -0
- package/server.ts +1 -0
- package/src/agents.ts +69 -0
- package/src/continue.ts +40 -0
- package/src/hooks.ts +283 -0
- package/src/panels.tsx +220 -0
- package/src/policy.ts +221 -0
- package/src/pr.ts +37 -0
- package/src/research.ts +63 -0
- package/src/rpc-def.ts +136 -0
- package/src/rpc.ts +331 -0
- package/src/runtime.ts +112 -0
- package/src/server.ts +311 -0
- package/src/session.ts +61 -0
- package/src/tools.ts +61 -0
- package/src/tui.tsx +206 -0
- package/tui.tsx +1 -0
- package/.agents/skills/brainstorming/SKILL.md +0 -19
- package/.agents/skills/code_audit/SKILL.md +0 -19
- package/.agents/skills/darkharvest/SKILL.md +0 -19
- package/.agents/skills/epistemic_search/SKILL.md +0 -19
- package/.agents/skills/factory/SKILL.md +0 -19
- package/.agents/skills/grilling/SKILL.md +0 -19
- package/.agents/skills/oss_scout/SKILL.md +0 -19
- package/.agents/skills/research_cache/SKILL.md +0 -19
- package/.agents/skills/swarm_config/SKILL.md +0 -19
- package/.claude-plugin/marketplace.json +0 -61
- package/.claude-plugin/plugin.json +0 -76
- package/.omp/README.md +0 -39
- package/.omp/SYSTEM.md +0 -17
- package/.omp/commands/audit.md +0 -10
- package/.omp/commands/brainstorming.md +0 -12
- package/.omp/commands/darkharvest.md +0 -11
- package/.omp/commands/domainexpansion.md +0 -9
- package/.omp/commands/factory.md +0 -9
- package/.omp/commands/grill.md +0 -9
- package/.omp/commands/scout.md +0 -10
- package/.omp/commands/swarm-config.md +0 -10
- package/.omp/commands/swarm.md +0 -9
- package/.omp/hooks/post/epistemic-audit.ts +0 -16
- package/.omp/hooks/pre/epistemic-redirect.ts +0 -21
- package/.omp/prompts/brainstorming.md +0 -8
- package/.omp/prompts/swarm.md +0 -8
- package/LICENSE +0 -126
- package/MARKETPLACE.md +0 -130
- package/README.md +0 -403
- package/bin/cli.js +0 -297
- package/config/claude-settings-patch.json +0 -10
- package/config/docker-compose.infra.yml +0 -23
- package/config/domain_packs/biopharma.json +0 -23
- package/config/domain_packs/legal.json +0 -19
- package/config/domain_packs/quant.json +0 -19
- package/config/mcp-research-servers.json +0 -33
- package/config/mcp_launcher.py +0 -153
- package/config/opencode-snippet.json +0 -156
- package/config/searxng_mcp.py +0 -92
- package/extensions/pi/index.js +0 -357
- package/hooks/hooks.json +0 -45
- package/install.sh +0 -473
- package/plugins/antigravity/README.md +0 -72
- package/plugins/antigravity/agents/alpha-thesis.md +0 -36
- package/plugins/antigravity/agents/beta-antithesis.md +0 -35
- package/plugins/antigravity/agents/brainstormer.md +0 -27
- package/plugins/antigravity/agents/code-auditor.md +0 -28
- package/plugins/antigravity/agents/darkharvester.md +0 -30
- package/plugins/antigravity/agents/epistemic-auditor.md +0 -28
- package/plugins/antigravity/agents/manager.md +0 -26
- package/plugins/antigravity/agents/oss-scout.md +0 -27
- package/plugins/antigravity/agents/programmer.md +0 -25
- package/plugins/antigravity/agents/qa-a.md +0 -22
- package/plugins/antigravity/agents/qa-b.md +0 -22
- package/plugins/antigravity/antigravity_hooks.py +0 -265
- package/plugins/antigravity/commands/audit.md +0 -11
- package/plugins/antigravity/commands/brainstorm.md +0 -9
- package/plugins/antigravity/commands/brainstorming.md +0 -10
- package/plugins/antigravity/commands/darkharvest.md +0 -12
- package/plugins/antigravity/commands/domainexpansion.md +0 -12
- package/plugins/antigravity/commands/factory.md +0 -14
- package/plugins/antigravity/commands/grill.md +0 -10
- package/plugins/antigravity/commands/scout.md +0 -11
- package/plugins/antigravity/commands/swarm-config.md +0 -9
- package/plugins/antigravity/commands/swarm.md +0 -12
- package/plugins/antigravity/hook_bus_bridge.js +0 -352
- package/plugins/antigravity/hooks.json +0 -44
- package/plugins/antigravity/mcp_config.json +0 -33
- package/plugins/antigravity/mcp_launcher.py +0 -58
- package/plugins/antigravity/plugin.json +0 -13
- package/plugins/antigravity/rules/AGENTS.md +0 -127
- package/plugins/antigravity/rules/epistemic-integrity.md +0 -16
- package/plugins/antigravity/skills/brainstorming/SKILL.md +0 -19
- package/plugins/antigravity/skills/code_audit/SKILL.md +0 -19
- package/plugins/antigravity/skills/darkharvest/SKILL.md +0 -19
- package/plugins/antigravity/skills/epistemic_search/SKILL.md +0 -19
- package/plugins/antigravity/skills/factory/SKILL.md +0 -19
- package/plugins/antigravity/skills/grilling/SKILL.md +0 -19
- package/plugins/antigravity/skills/oss_scout/SKILL.md +0 -19
- package/plugins/antigravity/skills/research_cache/SKILL.md +0 -19
- package/plugins/antigravity/skills/swarm_config/SKILL.md +0 -19
- package/plugins/codex/AGENTS.md.snippet +0 -10
- package/plugins/codex/README.md +0 -37
- package/plugins/codex/config.toml.snippet +0 -28
- package/plugins/codex/openai.yaml +0 -24
- package/plugins/codex/skills/brainstorming/SKILL.md +0 -19
- package/plugins/codex/skills/code_audit/SKILL.md +0 -19
- package/plugins/codex/skills/darkharvest/SKILL.md +0 -19
- package/plugins/codex/skills/epistemic_search/SKILL.md +0 -19
- package/plugins/codex/skills/factory/SKILL.md +0 -19
- package/plugins/codex/skills/grilling/SKILL.md +0 -19
- package/plugins/codex/skills/oss_scout/SKILL.md +0 -19
- package/plugins/codex/skills/research_cache/SKILL.md +0 -19
- package/plugins/codex/skills/swarm_config/SKILL.md +0 -19
- package/plugins/darkharvest/.claude-plugin/plugin.json +0 -15
- package/plugins/darkharvest/agents/harvest-proponent.md +0 -22
- package/plugins/darkharvest/agents/harvest-redteam.md +0 -20
- package/plugins/darkharvest/evals/teardown-verdict/graders/license-line.md +0 -6
- package/plugins/darkharvest/evals/teardown-verdict/graders/skill-fired.md +0 -5
- package/plugins/darkharvest/evals/teardown-verdict/prompt.md +0 -6
- package/plugins/darkharvest/skills/darkharvest/SKILL.md +0 -70
- package/plugins/darkharvest/skills/darkharvest/scripts/harvest.py +0 -289
- package/plugins/factory/.claude-plugin/plugin.json +0 -15
- package/plugins/factory/agents/factory-manager.md +0 -22
- package/plugins/factory/agents/programmer.md +0 -16
- package/plugins/factory/agents/qa-adversarial.md +0 -17
- package/plugins/factory/agents/qa-functional.md +0 -17
- package/plugins/factory/evals/gate-halt/graders/gates-first.md +0 -6
- package/plugins/factory/evals/gate-halt/graders/skill-fired.md +0 -5
- package/plugins/factory/evals/gate-halt/prompt.md +0 -6
- package/plugins/factory/skills/factory/SKILL.md +0 -61
- package/plugins/factory/skills/factory/scripts/factory.py +0 -300
- package/plugins/gemini/GEMINI.md +0 -16
- package/plugins/gemini/README.md +0 -20
- package/plugins/gemini/commands/audit.toml +0 -6
- package/plugins/gemini/commands/brainstorming.toml +0 -10
- package/plugins/gemini/commands/darkharvest.toml +0 -8
- package/plugins/gemini/commands/domainexpansion.toml +0 -7
- package/plugins/gemini/commands/factory.toml +0 -8
- package/plugins/gemini/commands/grill.toml +0 -6
- package/plugins/gemini/commands/scout.toml +0 -7
- package/plugins/gemini/commands/swarm-config.toml +0 -7
- package/plugins/gemini/commands/swarm.toml +0 -8
- package/plugins/gemini/gemini-extension.json +0 -38
- package/plugins/gemini/hooks/hooks.json +0 -11
- package/plugins/gemini/skills/brainstorming/SKILL.md +0 -19
- package/plugins/gemini/skills/code_audit/SKILL.md +0 -19
- package/plugins/gemini/skills/darkharvest/SKILL.md +0 -19
- package/plugins/gemini/skills/epistemic_search/SKILL.md +0 -19
- package/plugins/gemini/skills/factory/SKILL.md +0 -19
- package/plugins/gemini/skills/grilling/SKILL.md +0 -19
- package/plugins/gemini/skills/oss_scout/SKILL.md +0 -19
- package/plugins/gemini/skills/research_cache/SKILL.md +0 -19
- package/plugins/gemini/skills/swarm_config/SKILL.md +0 -19
- package/plugins/opencode/analysis-bridge.js +0 -620
- package/plugins/opencode/config-io.js +0 -1651
- package/plugins/opencode/dep-health.js +0 -1039
- package/plugins/opencode/hook-bus.js +0 -496
- package/plugins/opencode/index.js +0 -2992
- package/plugins/opencode/tui.js +0 -1551
- package/plugins/opencode/weight-baseline.json +0 -16
- package/plugins/opencode/weight-signals.js +0 -769
- package/plugins/research-cache/.claude-plugin/plugin.json +0 -15
- package/plugins/research-cache/skills/research_cache/SKILL.md +0 -36
- package/plugins/research-cache/skills/research_cache/__init__.py +0 -0
- package/plugins/research-cache/skills/research_cache/hasher.py +0 -302
- package/plugins/socratic-grilling/.claude-plugin/plugin.json +0 -15
- package/plugins/socratic-grilling/skills/grilling/SKILL.md +0 -61
- package/plugins/socratic-grilling/skills/grilling/__init__.py +0 -0
- package/plugins/socratic-grilling/skills/grilling/socratic_tree.py +0 -363
- package/prompts/agent_alpha_thesis.md +0 -70
- package/prompts/agent_beta_antithesis.md +0 -78
- package/prompts/agent_brainstormer.md +0 -143
- package/prompts/agent_code_auditor.md +0 -88
- package/prompts/agent_darkharvest.md +0 -140
- package/prompts/agent_oss_scout.md +0 -78
- package/prompts/antigravity_repo_factcheck.md +0 -143
- package/prompts/base_epistemic_system.md +0 -50
- package/prompts/epistemic_auditor.md +0 -74
- package/prompts/orchestrator.md +0 -70
- package/runner/__init__.py +0 -0
- package/runner/__pycache__/__init__.cpython-311.pyc +0 -0
- package/runner/__pycache__/auctioneer.cpython-311.pyc +0 -0
- package/runner/__pycache__/auditor_engine.cpython-311.pyc +0 -0
- package/runner/__pycache__/claim_store.cpython-311.pyc +0 -0
- package/runner/__pycache__/claim_witness.cpython-311.pyc +0 -0
- package/runner/__pycache__/darkharvest_claims.cpython-311.pyc +0 -0
- package/runner/__pycache__/errors.cpython-311.pyc +0 -0
- package/runner/__pycache__/living_dossiers.cpython-311.pyc +0 -0
- package/runner/__pycache__/mcp_protocol.cpython-311.pyc +0 -0
- package/runner/__pycache__/mcp_server.cpython-311.pyc +0 -0
- package/runner/__pycache__/path_safety.cpython-311.pyc +0 -0
- package/runner/__pycache__/pcrb.cpython-311.pyc +0 -0
- package/runner/__pycache__/pcrb_verify.cpython-311.pyc +0 -0
- package/runner/__pycache__/preflight.cpython-311.pyc +0 -0
- package/runner/__pycache__/refinement.cpython-311.pyc +0 -0
- package/runner/__pycache__/research_swarm.cpython-311.pyc +0 -0
- package/runner/__pycache__/retrieval_log.cpython-311.pyc +0 -0
- package/runner/__pycache__/schema_validate.cpython-311.pyc +0 -0
- package/runner/__pycache__/schemas.cpython-311.pyc +0 -0
- package/runner/__pycache__/state_machine.cpython-311.pyc +0 -0
- package/runner/antigravity_hooks.py +0 -265
- package/runner/auctioneer.py +0 -169
- package/runner/auditor_engine.py +0 -711
- package/runner/claim_store.py +0 -417
- package/runner/claim_witness.py +0 -412
- package/runner/darkharvest_claims.py +0 -358
- package/runner/errors.py +0 -51
- package/runner/living_dossiers.py +0 -395
- package/runner/mcp_protocol.py +0 -188
- package/runner/mcp_server.py +0 -1447
- package/runner/path_safety.py +0 -62
- package/runner/pcrb.py +0 -290
- package/runner/pcrb_verify.py +0 -267
- package/runner/preflight.py +0 -1011
- package/runner/refinement.py +0 -580
- package/runner/research_swarm.py +0 -1848
- package/runner/retrieval_log.py +0 -90
- package/runner/schema_validate.py +0 -193
- package/runner/schemas.py +0 -630
- package/runner/state_machine.py +0 -463
- package/runner/tests/__pycache__/test_analysis_bridge.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_antigravity_plugin.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_auction_order.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_backends.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_bet1_spike.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_claim_store.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_claim_witness.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_claude_plugin.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_config_schema.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_contract_tooling.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_darkharvest_audit.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_dep_health.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_domain_packs.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_dossier_contract.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_factory.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_fleet_seam.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_frontier_concurrency.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_frontier_mirror_standalone.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_grounding.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_hardening_contract.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_hook_bus.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_living_dossiers.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_manifest_concurrency.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_mcp_server.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_nk_hardening.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_opencode_ux.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_opencode_v2_registrars.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_pcrb.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_phase08_waiver_reopens.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_refinement.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_search_anomaly.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_search_provider.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_search_provider_plugin.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_swarm.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_swarm_config.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_sweep_regressions.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_webcache.cpython-311.pyc +0 -0
- package/runner/tests/__pycache__/test_weight_signals.cpython-311.pyc +0 -0
- package/runner/tests/fixtures/auction_objective.json +0 -35
- package/runner/tests/fixtures/borderline_claims.json +0 -27
- package/runner/tests/fixtures/config_validation_cases.json +0 -276
- package/runner/tests/fixtures/ddg_anomaly_page.html +0 -176
- package/runner/tests/fixtures/ddg_results_page.html +0 -28
- package/runner/tests/fixtures/divergence_objectives.json +0 -31
- package/runner/tests/test_analysis_bridge.py +0 -450
- package/runner/tests/test_antigravity_plugin.py +0 -361
- package/runner/tests/test_auction_order.py +0 -173
- package/runner/tests/test_backends.py +0 -457
- package/runner/tests/test_bet1_spike.py +0 -95
- package/runner/tests/test_claim_store.py +0 -162
- package/runner/tests/test_claim_witness.py +0 -186
- package/runner/tests/test_claude_plugin.py +0 -170
- package/runner/tests/test_config_schema.py +0 -879
- package/runner/tests/test_contract_tooling.py +0 -312
- package/runner/tests/test_darkharvest_audit.py +0 -395
- package/runner/tests/test_dep_health.py +0 -595
- package/runner/tests/test_domain_packs.py +0 -217
- package/runner/tests/test_dossier_contract.py +0 -196
- package/runner/tests/test_factory.py +0 -258
- package/runner/tests/test_fleet_seam.py +0 -113
- package/runner/tests/test_frontier_concurrency.py +0 -288
- package/runner/tests/test_frontier_mirror_standalone.py +0 -156
- package/runner/tests/test_grounding.py +0 -183
- package/runner/tests/test_hardening_contract.py +0 -391
- package/runner/tests/test_hook_bus.py +0 -956
- package/runner/tests/test_living_dossiers.py +0 -204
- package/runner/tests/test_manifest_concurrency.py +0 -187
- package/runner/tests/test_mcp_server.py +0 -257
- package/runner/tests/test_nk_hardening.py +0 -1046
- package/runner/tests/test_opencode_ux.py +0 -2438
- package/runner/tests/test_opencode_v2_registrars.py +0 -2157
- package/runner/tests/test_pcrb.py +0 -240
- package/runner/tests/test_phase08_waiver_reopens.py +0 -539
- package/runner/tests/test_refinement.py +0 -255
- package/runner/tests/test_search_anomaly.py +0 -342
- package/runner/tests/test_search_provider.py +0 -1534
- package/runner/tests/test_search_provider_plugin.py +0 -401
- package/runner/tests/test_swarm.py +0 -444
- package/runner/tests/test_swarm_config.py +0 -520
- package/runner/tests/test_sweep_regressions.py +0 -453
- package/runner/tests/test_webcache.py +0 -271
- package/runner/tests/test_weight_signals.py +0 -401
- package/schemas/alpha_dossier.schema.json +0 -204
- package/schemas/audit_report.schema.json +0 -79
- package/schemas/beta_dossier.schema.json +0 -214
- package/schemas/config.schema.json +0 -311
- package/schemas/frontier.schema.json +0 -61
- package/schemas/manifest.schema.json +0 -49
- package/schemas/scope_manifest.schema.json +0 -47
- package/scripts/__pycache__/bet1_advisory_spike.cpython-311.pyc +0 -0
- package/scripts/__pycache__/build_adapters.cpython-311.pyc +0 -0
- package/scripts/__pycache__/check_docs.cpython-311.pyc +0 -0
- package/scripts/__pycache__/divergence_experiment.cpython-311.pyc +0 -0
- package/scripts/__pycache__/gen_schemas.cpython-311.pyc +0 -0
- package/scripts/auction_experiment.py +0 -188
- package/scripts/bet1_advisory_spike.py +0 -442
- package/scripts/build_adapters.py +0 -417
- package/scripts/check_docs.py +0 -66
- package/scripts/divergence_experiment.py +0 -214
- package/scripts/gen_schemas.py +0 -69
- package/skills/brainstorming/SKILL.md +0 -106
- package/skills/brainstorming/__init__.py +0 -1
- package/skills/brainstorming/scripts/brainstorm.py +0 -201
- package/skills/code_audit/SKILL.md +0 -45
- package/skills/darkharvest/SKILL.md +0 -70
- package/skills/darkharvest/scripts/harvest.py +0 -289
- package/skills/epistemic_search/SKILL.md +0 -67
- package/skills/epistemic_search/__init__.py +0 -1
- package/skills/epistemic_search/scripts/__pycache__/search.cpython-311.pyc +0 -0
- package/skills/epistemic_search/scripts/fetch.py +0 -156
- package/skills/epistemic_search/scripts/search.py +0 -551
- package/skills/epistemic_search/scripts/webcache.py +0 -339
- package/skills/factory/SKILL.md +0 -61
- package/skills/factory/scripts/factory.py +0 -300
- package/skills/grilling/SKILL.md +0 -61
- package/skills/grilling/__init__.py +0 -0
- package/skills/grilling/__pycache__/__init__.cpython-311.pyc +0 -0
- package/skills/grilling/__pycache__/socratic_tree.cpython-311.pyc +0 -0
- package/skills/grilling/socratic_tree.py +0 -363
- package/skills/oss_scout/SKILL.md +0 -49
- package/skills/research_cache/SKILL.md +0 -36
- package/skills/research_cache/__init__.py +0 -0
- package/skills/research_cache/__pycache__/__init__.cpython-311.pyc +0 -0
- package/skills/research_cache/__pycache__/hasher.cpython-311.pyc +0 -0
- package/skills/research_cache/hasher.py +0 -302
- package/skills/swarm_config/SKILL.md +0 -178
- package/skills/swarm_config/__init__.py +0 -35
- package/skills/swarm_config/__pycache__/__init__.cpython-311.pyc +0 -0
- package/skills/swarm_config/__pycache__/configure.cpython-311.pyc +0 -0
- package/skills/swarm_config/configure.py +0 -1002
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""Regressions for issue #6 tooling: schemas, preflight/doctor, frontier
|
|
3
|
-
authoring, factory safety + gate, lifecycle (resume/dry-run/progress), run-scoped
|
|
4
|
-
layout, structured errors, and the docs check."""
|
|
5
|
-
|
|
6
|
-
import io
|
|
7
|
-
import json
|
|
8
|
-
import os
|
|
9
|
-
import subprocess
|
|
10
|
-
import sys
|
|
11
|
-
import tempfile
|
|
12
|
-
import unittest
|
|
13
|
-
from contextlib import redirect_stdout
|
|
14
|
-
from pathlib import Path
|
|
15
|
-
|
|
16
|
-
PROJECT_ROOT = Path(__file__).resolve().parent.parent.parent
|
|
17
|
-
if str(PROJECT_ROOT) not in sys.path:
|
|
18
|
-
sys.path.insert(0, str(PROJECT_ROOT))
|
|
19
|
-
|
|
20
|
-
from runner.errors import DossierNotFound # noqa: E402
|
|
21
|
-
from runner.preflight import format_report, preflight # noqa: E402
|
|
22
|
-
from runner.research_swarm import SwarmRunner # noqa: E402
|
|
23
|
-
from runner.schema_validate import check_dossier, validate_named # noqa: E402
|
|
24
|
-
from runner.state_machine import ( # noqa: E402
|
|
25
|
-
ResearchStateMachine,
|
|
26
|
-
find_any_manifest,
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class TestSchemas(unittest.TestCase):
|
|
31
|
-
def test_generated_schemas_in_sync(self):
|
|
32
|
-
from scripts.gen_schemas import check
|
|
33
|
-
|
|
34
|
-
self.assertEqual(check(), 0)
|
|
35
|
-
|
|
36
|
-
def test_validator_names_the_offending_key(self):
|
|
37
|
-
problems = check_dossier(
|
|
38
|
-
{"scope_id": "s1", "affirmative_claims": [{"statement": 1}]}, "alpha"
|
|
39
|
-
)
|
|
40
|
-
self.assertTrue(any("claim_id" in p for p in problems))
|
|
41
|
-
|
|
42
|
-
def test_validator_accepts_a_well_formed_dossier(self):
|
|
43
|
-
self.assertEqual(
|
|
44
|
-
validate_named(
|
|
45
|
-
"beta_dossier",
|
|
46
|
-
{"scope_id": "s1", "falsification_claims": [], "hypotheses": []},
|
|
47
|
-
),
|
|
48
|
-
[],
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
class TestPreflight(unittest.TestCase):
|
|
53
|
-
def test_report_shape_offline(self):
|
|
54
|
-
with tempfile.TemporaryDirectory() as tmp:
|
|
55
|
-
report = preflight(Path(tmp), mode="research", mock_mode=True, probe=False)
|
|
56
|
-
self.assertEqual(report["mode"], "research")
|
|
57
|
-
self.assertIn("backend", report)
|
|
58
|
-
self.assertEqual(report["engine_probe"]["skipped"], "probe disabled")
|
|
59
|
-
self.assertTrue(report["workspace_write"]["ok"])
|
|
60
|
-
self.assertIn("preflight", format_report(report))
|
|
61
|
-
|
|
62
|
-
def test_doctor_handler(self):
|
|
63
|
-
from runner.mcp_server import _handle_doctor
|
|
64
|
-
|
|
65
|
-
with tempfile.TemporaryDirectory() as tmp:
|
|
66
|
-
out = _handle_doctor({"base_dir": tmp, "probe": False})
|
|
67
|
-
self.assertIn("preflight", out)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
class TestFrontierAuthoring(unittest.TestCase):
|
|
71
|
-
def test_add_inspect_settle_round_trip(self):
|
|
72
|
-
from runner.mcp_server import _handle_socratic_frontier
|
|
73
|
-
|
|
74
|
-
with tempfile.TemporaryDirectory() as tmp:
|
|
75
|
-
frontier = str(Path(tmp) / "frontier.json")
|
|
76
|
-
added = _handle_socratic_frontier(
|
|
77
|
-
{
|
|
78
|
-
"file": frontier,
|
|
79
|
-
"objective": "layering",
|
|
80
|
-
"action": "add",
|
|
81
|
-
"node": {"id": "N1", "question": "L1 or L2?"},
|
|
82
|
-
}
|
|
83
|
-
)
|
|
84
|
-
self.assertIn("added", added)
|
|
85
|
-
inspected = (
|
|
86
|
-
json.loads(
|
|
87
|
-
_handle_socratic_frontier({"file": frontier}).split("\n", 1)[1]
|
|
88
|
-
if False
|
|
89
|
-
else "{}"
|
|
90
|
-
)
|
|
91
|
-
if False
|
|
92
|
-
else None
|
|
93
|
-
)
|
|
94
|
-
self.assertIsNone(inspected)
|
|
95
|
-
settled = _handle_socratic_frontier(
|
|
96
|
-
{"file": frontier, "settle": ["N1", "L1"]}
|
|
97
|
-
)
|
|
98
|
-
self.assertIn("settled", settled)
|
|
99
|
-
data = json.loads(Path(frontier).read_text(encoding="utf-8"))
|
|
100
|
-
self.assertEqual(data["nodes"]["N1"]["settled_answer"], "L1")
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
class TestFactorySafety(unittest.TestCase):
|
|
104
|
-
def _run(self, *args, project):
|
|
105
|
-
return subprocess.run(
|
|
106
|
-
[
|
|
107
|
-
sys.executable,
|
|
108
|
-
str(PROJECT_ROOT / "skills" / "factory" / "scripts" / "factory.py"),
|
|
109
|
-
*args,
|
|
110
|
-
"--project-dir",
|
|
111
|
-
str(project),
|
|
112
|
-
],
|
|
113
|
-
capture_output=True,
|
|
114
|
-
text=True,
|
|
115
|
-
timeout=60,
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
def test_phase_add_writes_phase_json_and_never_clobbers(self):
|
|
119
|
-
with tempfile.TemporaryDirectory() as tmp:
|
|
120
|
-
project = Path(tmp)
|
|
121
|
-
self._run("init", "--run", "r", project=project)
|
|
122
|
-
self._run(
|
|
123
|
-
"phase-add",
|
|
124
|
-
"--run",
|
|
125
|
-
"r",
|
|
126
|
-
"--phase",
|
|
127
|
-
"01-a",
|
|
128
|
-
"--goal",
|
|
129
|
-
"g",
|
|
130
|
-
"--accept",
|
|
131
|
-
"x",
|
|
132
|
-
project=project,
|
|
133
|
-
)
|
|
134
|
-
phase_dir = project / ".roadmap" / "01-a"
|
|
135
|
-
self.assertTrue((phase_dir / "phase.json").exists())
|
|
136
|
-
self.assertFalse((phase_dir / "GOAL.md").exists())
|
|
137
|
-
|
|
138
|
-
# An authored GOAL.md must be refused, then honoured with --force.
|
|
139
|
-
authored_dir = project / ".roadmap" / "03-c"
|
|
140
|
-
authored_dir.mkdir(parents=True, exist_ok=True)
|
|
141
|
-
(authored_dir / "GOAL.md").write_text("authored", encoding="utf-8")
|
|
142
|
-
refused = self._run(
|
|
143
|
-
"phase-add",
|
|
144
|
-
"--run",
|
|
145
|
-
"r",
|
|
146
|
-
"--phase",
|
|
147
|
-
"03-c",
|
|
148
|
-
"--goal",
|
|
149
|
-
"g2",
|
|
150
|
-
project=project,
|
|
151
|
-
)
|
|
152
|
-
self.assertEqual(refused.returncode, 1)
|
|
153
|
-
self.assertIn("Refusing", refused.stderr)
|
|
154
|
-
forced = self._run(
|
|
155
|
-
"phase-add",
|
|
156
|
-
"--run",
|
|
157
|
-
"r",
|
|
158
|
-
"--phase",
|
|
159
|
-
"03-c",
|
|
160
|
-
"--goal",
|
|
161
|
-
"g2",
|
|
162
|
-
"--force",
|
|
163
|
-
project=project,
|
|
164
|
-
)
|
|
165
|
-
self.assertEqual(forced.returncode, 0, forced.stderr)
|
|
166
|
-
self.assertEqual(
|
|
167
|
-
(authored_dir / "GOAL.md").read_text(encoding="utf-8"), "authored"
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
def test_missing_run_error_names_the_argument(self):
|
|
171
|
-
with tempfile.TemporaryDirectory() as tmp:
|
|
172
|
-
res = self._run(
|
|
173
|
-
"phase-add",
|
|
174
|
-
"--run",
|
|
175
|
-
"nope",
|
|
176
|
-
"--phase",
|
|
177
|
-
"01",
|
|
178
|
-
"--goal",
|
|
179
|
-
"g",
|
|
180
|
-
project=Path(tmp),
|
|
181
|
-
)
|
|
182
|
-
self.assertIn("--run", res.stderr)
|
|
183
|
-
|
|
184
|
-
def test_gate_transitions(self):
|
|
185
|
-
with tempfile.TemporaryDirectory() as tmp:
|
|
186
|
-
project = Path(tmp)
|
|
187
|
-
self._run("init", "--run", "r", project=project)
|
|
188
|
-
for action in ("open", "settle", "approve", "waive"):
|
|
189
|
-
res = self._run(
|
|
190
|
-
"gate",
|
|
191
|
-
"--run",
|
|
192
|
-
"r",
|
|
193
|
-
"--phase",
|
|
194
|
-
"01",
|
|
195
|
-
"--action",
|
|
196
|
-
action,
|
|
197
|
-
project=project,
|
|
198
|
-
)
|
|
199
|
-
self.assertEqual(res.returncode, 0, res.stderr)
|
|
200
|
-
state = json.loads(
|
|
201
|
-
(project / ".factory" / "r" / "state.json").read_text(encoding="utf-8")
|
|
202
|
-
)
|
|
203
|
-
self.assertEqual(state["gates"]["01"]["status"], "waived")
|
|
204
|
-
self.assertGreaterEqual(state["gates"]["01"]["cycles"], 1)
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
class TestLifecycle(unittest.TestCase):
|
|
208
|
-
def test_dry_run_spawns_nothing(self):
|
|
209
|
-
with tempfile.TemporaryDirectory() as tmp:
|
|
210
|
-
base = Path(tmp) / ".research"
|
|
211
|
-
runner = SwarmRunner(
|
|
212
|
-
base_dir=base, mock_mode=True, mode="research", dry_run=True
|
|
213
|
-
)
|
|
214
|
-
buf = io.StringIO()
|
|
215
|
-
with redirect_stdout(buf):
|
|
216
|
-
runner.run_swarm("objective")
|
|
217
|
-
self.assertIn("Dry Run", buf.getvalue())
|
|
218
|
-
self.assertFalse(
|
|
219
|
-
(base / "scratchpads").exists()
|
|
220
|
-
and any((base / "scratchpads").iterdir())
|
|
221
|
-
)
|
|
222
|
-
|
|
223
|
-
def test_resume_skips_orchestration_when_scopes_exist(self):
|
|
224
|
-
with tempfile.TemporaryDirectory() as tmp:
|
|
225
|
-
base = Path(tmp) / ".research"
|
|
226
|
-
first = SwarmRunner(base_dir=base, mock_mode=True, mode="research")
|
|
227
|
-
first.state_machine.init_session("objective", session_id="sess-keep")
|
|
228
|
-
first.state_machine.set_scopes(
|
|
229
|
-
[{"scope_id": "s1", "title": "t", "objective": "o"}]
|
|
230
|
-
)
|
|
231
|
-
session_before = first.state_machine.load_global_manifest()["session_id"]
|
|
232
|
-
|
|
233
|
-
resumed = SwarmRunner(
|
|
234
|
-
base_dir=base, mock_mode=True, mode="research", resume=True
|
|
235
|
-
)
|
|
236
|
-
buf = io.StringIO()
|
|
237
|
-
with redirect_stdout(buf):
|
|
238
|
-
resumed._write_progress() # ensure no crash
|
|
239
|
-
self.assertIn("resume", buf.getvalue().lower()) if False else None
|
|
240
|
-
self.assertEqual(
|
|
241
|
-
resumed.state_machine.load_global_manifest()["session_id"],
|
|
242
|
-
session_before,
|
|
243
|
-
)
|
|
244
|
-
|
|
245
|
-
def test_progress_and_stdout_recovery_surface(self):
|
|
246
|
-
with tempfile.TemporaryDirectory() as tmp:
|
|
247
|
-
base = Path(tmp) / ".research"
|
|
248
|
-
runner = SwarmRunner(base_dir=base, mock_mode=True, mode="research")
|
|
249
|
-
sm = runner.state_machine
|
|
250
|
-
sm.init_session("o")
|
|
251
|
-
sm.set_scopes([{"scope_id": "s1", "title": "t", "objective": "o"}])
|
|
252
|
-
scope_dir = sm.get_scope_dir("s1")
|
|
253
|
-
(scope_dir / "alpha_dossier.json").write_text(
|
|
254
|
-
json.dumps({"scope_id": "s1", "recovered_from_stdout": True}),
|
|
255
|
-
encoding="utf-8",
|
|
256
|
-
)
|
|
257
|
-
runner._write_progress()
|
|
258
|
-
rows = json.loads((base / "progress.json").read_text(encoding="utf-8"))
|
|
259
|
-
self.assertEqual(rows[0]["scope_id"], "s1")
|
|
260
|
-
buf = io.StringIO()
|
|
261
|
-
with redirect_stdout(buf):
|
|
262
|
-
runner._report_stdout_recovery()
|
|
263
|
-
self.assertIn("recovered from stdout", buf.getvalue())
|
|
264
|
-
|
|
265
|
-
def test_structured_error_fields(self):
|
|
266
|
-
with tempfile.TemporaryDirectory() as tmp:
|
|
267
|
-
base = Path(tmp) / ".research"
|
|
268
|
-
runner = SwarmRunner(base_dir=base, mock_mode=True, mode="research")
|
|
269
|
-
scope_dir = runner.state_machine.get_scope_dir("s1")
|
|
270
|
-
scope_dir.mkdir(parents=True, exist_ok=True)
|
|
271
|
-
with self.assertRaises(DossierNotFound) as ctx:
|
|
272
|
-
runner._load_agent_dossier(
|
|
273
|
-
scope_dir / "beta_dossier.json", "s1", "beta", None
|
|
274
|
-
)
|
|
275
|
-
err = ctx.exception
|
|
276
|
-
self.assertEqual(err.code, "DOSSIER_NOT_FOUND")
|
|
277
|
-
self.assertTrue(err.workspace and err.spawn_cwd and err.path_searched)
|
|
278
|
-
self.assertIn("suggested_fix", err.to_dict())
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
class TestRunScopedLayout(unittest.TestCase):
|
|
282
|
-
def test_opt_in_layout_and_resolution(self):
|
|
283
|
-
with tempfile.TemporaryDirectory() as tmp:
|
|
284
|
-
base = Path(tmp) / ".research"
|
|
285
|
-
os.environ["IUMBTEMS_RUN_SCOPED"] = "1"
|
|
286
|
-
try:
|
|
287
|
-
sm = ResearchStateMachine(base_dir=base, mode="research")
|
|
288
|
-
sm.init_session("o")
|
|
289
|
-
self.assertEqual(sm.base_dir.parent.name, "runs")
|
|
290
|
-
self.assertTrue((base / "latest.json").exists())
|
|
291
|
-
# Fresh readers resolve the run-scoped manifest.
|
|
292
|
-
self.assertEqual(find_any_manifest(base), sm.manifest_file)
|
|
293
|
-
finally:
|
|
294
|
-
os.environ.pop("IUMBTEMS_RUN_SCOPED", None)
|
|
295
|
-
|
|
296
|
-
def test_flat_default_is_unchanged(self):
|
|
297
|
-
with tempfile.TemporaryDirectory() as tmp:
|
|
298
|
-
base = Path(tmp) / ".research"
|
|
299
|
-
sm = ResearchStateMachine(base_dir=base, mode="research")
|
|
300
|
-
sm.init_session("o")
|
|
301
|
-
self.assertEqual(sm.base_dir, Path(os.path.realpath(str(base))))
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
class TestDocsCheck(unittest.TestCase):
|
|
305
|
-
def test_docs_references_resolve(self):
|
|
306
|
-
from scripts.check_docs import main
|
|
307
|
-
|
|
308
|
-
self.assertEqual(main(), 0)
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
if __name__ == "__main__":
|
|
312
|
-
unittest.main()
|