thehood 0.1.0-preview.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/CODE_OF_CONDUCT.md +21 -0
- package/CONTRIBUTING.md +58 -0
- package/LICENSE +21 -0
- package/PRIVACY.md +49 -0
- package/README.md +264 -0
- package/SECURITY.md +31 -0
- package/dist/bridges/chatgptWebBridge.d.ts +2 -0
- package/dist/bridges/chatgptWebBridge.js +981 -0
- package/dist/bridges/chatgptWebBridge.js.map +1 -0
- package/dist/cli/args.d.ts +9 -0
- package/dist/cli/args.js +82 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/format.d.ts +56 -0
- package/dist/cli/format.js +752 -0
- package/dist/cli/format.js.map +1 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +996 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/mcpConfig.d.ts +36 -0
- package/dist/cli/mcpConfig.js +98 -0
- package/dist/cli/mcpConfig.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/protocol.d.ts +44 -0
- package/dist/mcp/protocol.js +33 -0
- package/dist/mcp/protocol.js.map +1 -0
- package/dist/mcp/server.d.ts +1 -0
- package/dist/mcp/server.js +106 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools.d.ts +10 -0
- package/dist/mcp/tools.js +2200 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp/validation.d.ts +8 -0
- package/dist/mcp/validation.js +67 -0
- package/dist/mcp/validation.js.map +1 -0
- package/dist/providers/chatgptWeb.d.ts +2 -0
- package/dist/providers/chatgptWeb.js +26 -0
- package/dist/providers/chatgptWeb.js.map +1 -0
- package/dist/providers/claudeCode.d.ts +4 -0
- package/dist/providers/claudeCode.js +32 -0
- package/dist/providers/claudeCode.js.map +1 -0
- package/dist/providers/codexCli.d.ts +6 -0
- package/dist/providers/codexCli.js +25 -0
- package/dist/providers/codexCli.js.map +1 -0
- package/dist/providers/codexCliModels.d.ts +23 -0
- package/dist/providers/codexCliModels.js +147 -0
- package/dist/providers/codexCliModels.js.map +1 -0
- package/dist/providers/localCommand.d.ts +26 -0
- package/dist/providers/localCommand.js +614 -0
- package/dist/providers/localCommand.js.map +1 -0
- package/dist/providers/markdownPayload.d.ts +7 -0
- package/dist/providers/markdownPayload.js +29 -0
- package/dist/providers/markdownPayload.js.map +1 -0
- package/dist/providers/responseSchema.d.ts +3 -0
- package/dist/providers/responseSchema.js +187 -0
- package/dist/providers/responseSchema.js.map +1 -0
- package/dist/providers/router.d.ts +3 -0
- package/dist/providers/router.js +21 -0
- package/dist/providers/router.js.map +1 -0
- package/dist/providers/stub.d.ts +2 -0
- package/dist/providers/stub.js +177 -0
- package/dist/providers/stub.js.map +1 -0
- package/dist/providers/types.d.ts +37 -0
- package/dist/providers/types.js +2 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/runtime/agentBoard.d.ts +79 -0
- package/dist/runtime/agentBoard.js +166 -0
- package/dist/runtime/agentBoard.js.map +1 -0
- package/dist/runtime/agentBoardArtifact.d.ts +9 -0
- package/dist/runtime/agentBoardArtifact.js +171 -0
- package/dist/runtime/agentBoardArtifact.js.map +1 -0
- package/dist/runtime/agentRunner.d.ts +17 -0
- package/dist/runtime/agentRunner.js +92 -0
- package/dist/runtime/agentRunner.js.map +1 -0
- package/dist/runtime/approvalInbox.d.ts +54 -0
- package/dist/runtime/approvalInbox.js +143 -0
- package/dist/runtime/approvalInbox.js.map +1 -0
- package/dist/runtime/approvalPolicy.d.ts +11 -0
- package/dist/runtime/approvalPolicy.js +58 -0
- package/dist/runtime/approvalPolicy.js.map +1 -0
- package/dist/runtime/artifacts.d.ts +23 -0
- package/dist/runtime/artifacts.js +48 -0
- package/dist/runtime/artifacts.js.map +1 -0
- package/dist/runtime/browserManager.d.ts +37 -0
- package/dist/runtime/browserManager.js +356 -0
- package/dist/runtime/browserManager.js.map +1 -0
- package/dist/runtime/canonicalMemory.d.ts +23 -0
- package/dist/runtime/canonicalMemory.js +134 -0
- package/dist/runtime/canonicalMemory.js.map +1 -0
- package/dist/runtime/chatGptPageReadiness.d.ts +16 -0
- package/dist/runtime/chatGptPageReadiness.js +74 -0
- package/dist/runtime/chatGptPageReadiness.js.map +1 -0
- package/dist/runtime/commandRunner.d.ts +18 -0
- package/dist/runtime/commandRunner.js +115 -0
- package/dist/runtime/commandRunner.js.map +1 -0
- package/dist/runtime/commandSafety.d.ts +7 -0
- package/dist/runtime/commandSafety.js +61 -0
- package/dist/runtime/commandSafety.js.map +1 -0
- package/dist/runtime/config.d.ts +10 -0
- package/dist/runtime/config.js +107 -0
- package/dist/runtime/config.js.map +1 -0
- package/dist/runtime/crewLanes.d.ts +2 -0
- package/dist/runtime/crewLanes.js +123 -0
- package/dist/runtime/crewLanes.js.map +1 -0
- package/dist/runtime/criticPolicy.d.ts +17 -0
- package/dist/runtime/criticPolicy.js +50 -0
- package/dist/runtime/criticPolicy.js.map +1 -0
- package/dist/runtime/defaults.d.ts +5 -0
- package/dist/runtime/defaults.js +100 -0
- package/dist/runtime/defaults.js.map +1 -0
- package/dist/runtime/directives.d.ts +3 -0
- package/dist/runtime/directives.js +218 -0
- package/dist/runtime/directives.js.map +1 -0
- package/dist/runtime/doctor.d.ts +36 -0
- package/dist/runtime/doctor.js +185 -0
- package/dist/runtime/doctor.js.map +1 -0
- package/dist/runtime/errors.d.ts +20 -0
- package/dist/runtime/errors.js +41 -0
- package/dist/runtime/errors.js.map +1 -0
- package/dist/runtime/externalTransfer.d.ts +20 -0
- package/dist/runtime/externalTransfer.js +156 -0
- package/dist/runtime/externalTransfer.js.map +1 -0
- package/dist/runtime/fanout.d.ts +64 -0
- package/dist/runtime/fanout.js +263 -0
- package/dist/runtime/fanout.js.map +1 -0
- package/dist/runtime/gitEvidence.d.ts +10 -0
- package/dist/runtime/gitEvidence.js +80 -0
- package/dist/runtime/gitEvidence.js.map +1 -0
- package/dist/runtime/handoffs.d.ts +32 -0
- package/dist/runtime/handoffs.js +100 -0
- package/dist/runtime/handoffs.js.map +1 -0
- package/dist/runtime/ids.d.ts +2 -0
- package/dist/runtime/ids.js +4 -0
- package/dist/runtime/ids.js.map +1 -0
- package/dist/runtime/localStateIgnore.d.ts +9 -0
- package/dist/runtime/localStateIgnore.js +98 -0
- package/dist/runtime/localStateIgnore.js.map +1 -0
- package/dist/runtime/loop.d.ts +14 -0
- package/dist/runtime/loop.js +1863 -0
- package/dist/runtime/loop.js.map +1 -0
- package/dist/runtime/loopRecommendation.d.ts +109 -0
- package/dist/runtime/loopRecommendation.js +566 -0
- package/dist/runtime/loopRecommendation.js.map +1 -0
- package/dist/runtime/loopResponsibilities.d.ts +2 -0
- package/dist/runtime/loopResponsibilities.js +395 -0
- package/dist/runtime/loopResponsibilities.js.map +1 -0
- package/dist/runtime/loopRunner.d.ts +28 -0
- package/dist/runtime/loopRunner.js +81 -0
- package/dist/runtime/loopRunner.js.map +1 -0
- package/dist/runtime/operatorNextActions.d.ts +2 -0
- package/dist/runtime/operatorNextActions.js +344 -0
- package/dist/runtime/operatorNextActions.js.map +1 -0
- package/dist/runtime/paths.d.ts +9 -0
- package/dist/runtime/paths.js +14 -0
- package/dist/runtime/paths.js.map +1 -0
- package/dist/runtime/permissions.d.ts +9 -0
- package/dist/runtime/permissions.js +73 -0
- package/dist/runtime/permissions.js.map +1 -0
- package/dist/runtime/progressPacket.d.ts +12 -0
- package/dist/runtime/progressPacket.js +512 -0
- package/dist/runtime/progressPacket.js.map +1 -0
- package/dist/runtime/protectedPaths.d.ts +6 -0
- package/dist/runtime/protectedPaths.js +48 -0
- package/dist/runtime/protectedPaths.js.map +1 -0
- package/dist/runtime/providers.d.ts +13 -0
- package/dist/runtime/providers.js +60 -0
- package/dist/runtime/providers.js.map +1 -0
- package/dist/runtime/reconciliation.d.ts +17 -0
- package/dist/runtime/reconciliation.js +283 -0
- package/dist/runtime/reconciliation.js.map +1 -0
- package/dist/runtime/redaction.d.ts +1 -0
- package/dist/runtime/redaction.js +5 -0
- package/dist/runtime/redaction.js.map +1 -0
- package/dist/runtime/remoteRepoContext.d.ts +77 -0
- package/dist/runtime/remoteRepoContext.js +316 -0
- package/dist/runtime/remoteRepoContext.js.map +1 -0
- package/dist/runtime/repoContext.d.ts +50 -0
- package/dist/runtime/repoContext.js +399 -0
- package/dist/runtime/repoContext.js.map +1 -0
- package/dist/runtime/repoGateway.d.ts +64 -0
- package/dist/runtime/repoGateway.js +308 -0
- package/dist/runtime/repoGateway.js.map +1 -0
- package/dist/runtime/responseContracts.d.ts +3 -0
- package/dist/runtime/responseContracts.js +86 -0
- package/dist/runtime/responseContracts.js.map +1 -0
- package/dist/runtime/reviewLanes.d.ts +2 -0
- package/dist/runtime/reviewLanes.js +343 -0
- package/dist/runtime/reviewLanes.js.map +1 -0
- package/dist/runtime/reviewRouting.d.ts +51 -0
- package/dist/runtime/reviewRouting.js +152 -0
- package/dist/runtime/reviewRouting.js.map +1 -0
- package/dist/runtime/revisionPacket.d.ts +38 -0
- package/dist/runtime/revisionPacket.js +144 -0
- package/dist/runtime/revisionPacket.js.map +1 -0
- package/dist/runtime/revisionTrail.d.ts +2 -0
- package/dist/runtime/revisionTrail.js +162 -0
- package/dist/runtime/revisionTrail.js.map +1 -0
- package/dist/runtime/role-assignment.d.ts +4 -0
- package/dist/runtime/role-assignment.js +21 -0
- package/dist/runtime/role-assignment.js.map +1 -0
- package/dist/runtime/roleRoster.d.ts +28 -0
- package/dist/runtime/roleRoster.js +96 -0
- package/dist/runtime/roleRoster.js.map +1 -0
- package/dist/runtime/runInsights.d.ts +121 -0
- package/dist/runtime/runInsights.js +305 -0
- package/dist/runtime/runInsights.js.map +1 -0
- package/dist/runtime/runMonitor.d.ts +33 -0
- package/dist/runtime/runMonitor.js +143 -0
- package/dist/runtime/runMonitor.js.map +1 -0
- package/dist/runtime/runtime.d.ts +15 -0
- package/dist/runtime/runtime.js +199 -0
- package/dist/runtime/runtime.js.map +1 -0
- package/dist/runtime/runtimeInfo.d.ts +9 -0
- package/dist/runtime/runtimeInfo.js +76 -0
- package/dist/runtime/runtimeInfo.js.map +1 -0
- package/dist/runtime/store.d.ts +4 -0
- package/dist/runtime/store.js +48 -0
- package/dist/runtime/store.js.map +1 -0
- package/dist/runtime/summons.d.ts +25 -0
- package/dist/runtime/summons.js +403 -0
- package/dist/runtime/summons.js.map +1 -0
- package/dist/runtime/teamPresets.d.ts +14 -0
- package/dist/runtime/teamPresets.js +153 -0
- package/dist/runtime/teamPresets.js.map +1 -0
- package/dist/runtime/types.d.ts +505 -0
- package/dist/runtime/types.js +28 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/runtime/validationCommands.d.ts +18 -0
- package/dist/runtime/validationCommands.js +106 -0
- package/dist/runtime/validationCommands.js.map +1 -0
- package/dist/tui/dashboard.d.ts +41 -0
- package/dist/tui/dashboard.js +1115 -0
- package/dist/tui/dashboard.js.map +1 -0
- package/docs/ARCHITECTURE.md +277 -0
- package/docs/CLI_SPEC.md +396 -0
- package/docs/CODEX_SETUP.md +288 -0
- package/docs/COMPLETION_CONTRACT.md +52 -0
- package/docs/CONTRIBUTOR_GUIDE.md +70 -0
- package/docs/DEMO.md +62 -0
- package/docs/GLOSSARY.md +46 -0
- package/docs/GOAL_LOOP_SCHEDULE.md +50 -0
- package/docs/KNOWN_LIMITATIONS.md +29 -0
- package/docs/LICENSING.md +21 -0
- package/docs/LOOP_RECIPES.md +290 -0
- package/docs/LOOP_SELECTION_UX.md +118 -0
- package/docs/MCP_SPEC.md +689 -0
- package/docs/MEMORY_AND_RECONCILIATION.md +222 -0
- package/docs/NPM_PUBLISHING.md +51 -0
- package/docs/OPEN_DECISIONS.md +81 -0
- package/docs/PROMPT_SCHEMAS.md +411 -0
- package/docs/PROVIDER_ADAPTERS.md +323 -0
- package/docs/PROVIDER_MATRIX.md +21 -0
- package/docs/PUBLIC_REPO_READINESS.md +49 -0
- package/docs/RESEARCH_NOTES.md +92 -0
- package/docs/ROADMAP.md +94 -0
- package/docs/ROLE_CONTRACTS.md +252 -0
- package/docs/RUNTIME_LOOP.md +240 -0
- package/docs/SECURITY_AND_PRIVACY.md +161 -0
- package/docs/TESTING_AND_VERIFICATION.md +180 -0
- package/docs/TRUST_MODEL.md +65 -0
- package/docs/decisions/0001-runtime-first-cli-and-mcp.md +23 -0
- package/docs/decisions/0002-provider-neutral-role-mapping.md +43 -0
- package/docs/decisions/0003-separate-implementation-and-verification.md +27 -0
- package/docs/product/README.md +14 -0
- package/docs/product/model-selection.md +88 -0
- package/docs/product/positioning.md +37 -0
- package/docs/product/pro-usage-modes.md +70 -0
- package/docs/product/roadmap.md +57 -0
- package/docs/product/role-policy.md +89 -0
- package/docs/product/runtime-invariants.md +44 -0
- package/docs/release/v0.1.0-preview.0.md +48 -0
- package/examples/stub-demo/README.md +25 -0
- package/package.json +55 -0
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { resolveRepoPath } from "./paths.js";
|
|
4
|
+
export const loopRecipeIds = [
|
|
5
|
+
"build-test-fix",
|
|
6
|
+
"verifier-loop",
|
|
7
|
+
"anti-spin",
|
|
8
|
+
"completion-contract",
|
|
9
|
+
"quality-streak",
|
|
10
|
+
"adversarial-review",
|
|
11
|
+
"human-approval-queue"
|
|
12
|
+
];
|
|
13
|
+
const recipeCatalog = [
|
|
14
|
+
{
|
|
15
|
+
id: "build-test-fix",
|
|
16
|
+
title: "Build, Test, Fix",
|
|
17
|
+
plainLabel: "Fix something and prove it",
|
|
18
|
+
status: "available",
|
|
19
|
+
purpose: "Implement a scoped software change, capture validation evidence, and repair fixable failures until clean or capped.",
|
|
20
|
+
whenToUse: "Use when the goal asks TheHood to fix, implement, repair, or build something with clear validation.",
|
|
21
|
+
roles: ["orchestrator", "implementer", "runtime QA", "qa", "verifier"],
|
|
22
|
+
requiredEvidence: ["scoped diff", "runtime-captured validation command logs", "review routing", "verifier verdict"],
|
|
23
|
+
stopConditions: ["verifier approves", "manual approval is required", "max iterations reached", "unsafe or unresolved blocker"],
|
|
24
|
+
risks: ["too-broad scope", "missing validation command", "protected test changes without approval"],
|
|
25
|
+
commandShape: "thehood goal \"<task>\" --repo . --max-iterations <n>"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "verifier-loop",
|
|
29
|
+
title: "Verifier Loop",
|
|
30
|
+
plainLabel: "Prove correctness independently",
|
|
31
|
+
status: "available",
|
|
32
|
+
purpose: "Run implementation evidence through independent verification when correctness matters more than speed.",
|
|
33
|
+
whenToUse: "Use when the user asks to prove, verify, audit, or make a sensitive change where self-review is not enough.",
|
|
34
|
+
roles: ["orchestrator", "implementer", "runtime QA", "verifier"],
|
|
35
|
+
requiredEvidence: ["acceptance criteria", "runtime-captured command evidence", "diff evidence", "verifier verdict"],
|
|
36
|
+
stopConditions: ["verifier approves", "verifier asks the user", "verifier aborts", "max iterations reached"],
|
|
37
|
+
risks: ["accepting model summaries instead of raw evidence", "same authority implementing and verifying"],
|
|
38
|
+
commandShape: "thehood goal \"<task>\" --repo . --max-iterations <n>"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "anti-spin",
|
|
42
|
+
title: "Anti-Spin",
|
|
43
|
+
plainLabel: "Stop repeated agent thrash",
|
|
44
|
+
status: "partial",
|
|
45
|
+
purpose: "Constrain ambiguous or failure-prone work so repeated attempts stop instead of looping without progress.",
|
|
46
|
+
whenToUse: "Use when a task has repeated failures, duplicate evidence requests, unclear proof, or a risk of flip-flopping approaches.",
|
|
47
|
+
roles: ["orchestrator", "runtime", "verifier", "operator"],
|
|
48
|
+
requiredEvidence: ["last failed evidence", "repeated-failure signal", "budget state", "stop reason"],
|
|
49
|
+
stopConditions: ["same failure repeats", "duplicate evidence request", "no diff after repair", "max iterations reached", "provider blocked or failed"],
|
|
50
|
+
risks: ["stopping too late", "reporting exhaustion as success", "asking for the same context repeatedly"],
|
|
51
|
+
commandShape: "thehood goal \"<task>\" --repo . --max-iterations <low n>"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: "completion-contract",
|
|
55
|
+
title: "Completion Contract",
|
|
56
|
+
plainLabel: "Define done before work starts",
|
|
57
|
+
status: "partial",
|
|
58
|
+
purpose: "Make the definition of done explicit before a loop begins, especially for release-facing or high-trust work.",
|
|
59
|
+
whenToUse: "Use when public preview, release, packaging, security, privacy, docs, or product trust depends on not calling partial work done.",
|
|
60
|
+
roles: ["orchestrator", "implementer", "runtime QA", "qa", "verifier", "critic"],
|
|
61
|
+
requiredEvidence: ["acceptance criteria", "allowed and forbidden changes", "validation commands", "final report evidence refs"],
|
|
62
|
+
stopConditions: ["all required evidence is proved", "required evidence is weak or missing", "approval boundary", "max iterations reached"],
|
|
63
|
+
risks: ["too-vague acceptance criteria", "missing forbidden changes", "partial completion reported as done"],
|
|
64
|
+
commandShape: "thehood goal \"<task>\" --repo . --max-iterations <n>"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: "quality-streak",
|
|
68
|
+
title: "Quality Streak",
|
|
69
|
+
plainLabel: "Require repeated clean passes",
|
|
70
|
+
status: "planned",
|
|
71
|
+
purpose: "Require several consecutive successful validations before declaring unstable behavior fixed.",
|
|
72
|
+
whenToUse: "Use when flaky, intermittent, or stability-sensitive work should not stop after one green run.",
|
|
73
|
+
roles: ["runtime QA", "qa", "verifier"],
|
|
74
|
+
requiredEvidence: ["same validation command repeated under recorded conditions", "streak count", "failure reset evidence"],
|
|
75
|
+
stopConditions: ["target streak reached", "failure resets streak", "budget exhausted", "approval required"],
|
|
76
|
+
risks: ["expensive repeated validation", "overfitting to one scenario", "claiming streak support before it is implemented"],
|
|
77
|
+
commandShape: "planned: thehood goal \"<task>\" --repo . --recipe quality-streak --streak <n>"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: "adversarial-review",
|
|
81
|
+
title: "Adversarial Review",
|
|
82
|
+
plainLabel: "Challenge the plan or patch",
|
|
83
|
+
status: "partial",
|
|
84
|
+
purpose: "Bring in a read-only critic or second model family to challenge risky plans, architecture, UX, security, or release decisions.",
|
|
85
|
+
whenToUse: "Use when disagreement, risk, architecture, security, product strategy, or public trust warrants critique before acceptance.",
|
|
86
|
+
roles: ["orchestrator", "qa", "critic", "verifier"],
|
|
87
|
+
requiredEvidence: ["critic response", "runtime validation evidence", "verifier verdict"],
|
|
88
|
+
stopConditions: ["critic finds no blocking concern and verifier approves", "fixable critique becomes revision packet", "unsafe critic finding", "approval required"],
|
|
89
|
+
risks: ["treating sidecar critique as acceptance", "reviewing an old version after edits", "model-family consensus claims without separate providers"],
|
|
90
|
+
commandShape: "thehood summon <run-id> --role critic --brief \"Challenge this plan\""
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: "human-approval-queue",
|
|
94
|
+
title: "Human Approval Queue",
|
|
95
|
+
plainLabel: "Pause for decisions",
|
|
96
|
+
status: "available",
|
|
97
|
+
purpose: "Make approval gates explicit when work crosses edit, protected-path, dependency, network, or external-transfer boundaries.",
|
|
98
|
+
whenToUse: "Use when the likely next step needs the user to approve, revise, reject, or abort before the runtime can continue.",
|
|
99
|
+
roles: ["operator", "runtime", "orchestrator", "implementer", "verifier"],
|
|
100
|
+
requiredEvidence: ["approval reason", "artifact refs", "operator decision", "resume event"],
|
|
101
|
+
stopConditions: ["user approves", "user revises", "user rejects", "user aborts", "approval remains pending"],
|
|
102
|
+
risks: ["approval fatigue", "unclear reason copy", "manual copy-paste loops"],
|
|
103
|
+
commandShape: "thehood approvals policy show --repo ."
|
|
104
|
+
}
|
|
105
|
+
];
|
|
106
|
+
const scoringRules = {
|
|
107
|
+
"build-test-fix": [
|
|
108
|
+
{ pattern: /\b(fix|repair|implement|build|change|add|wire|patch|failing|test|bug|broken)\b/i, score: 5, signal: "scoped implementation or repair language" },
|
|
109
|
+
{ pattern: /\b(typecheck|test|lint|build|smoke|ci)\b/i, score: 3, signal: "validation command language" }
|
|
110
|
+
],
|
|
111
|
+
"verifier-loop": [
|
|
112
|
+
{ pattern: /\b(verify|prove|correct|correctness|audit|evidence|confidence|safe|regression)\b/i, score: 5, signal: "independent proof is important" },
|
|
113
|
+
{ pattern: /\b(security|privacy|payment|auth|release|public)\b/i, score: 3, signal: "higher correctness risk" }
|
|
114
|
+
],
|
|
115
|
+
"anti-spin": [
|
|
116
|
+
{ pattern: /\b(stuck|looping|spin|thrash|again|keeps|repeat|repeated|deadlock|blocked|same failure|no progress|oscillat|flip.?flop)\b/i, score: 6, signal: "risk of repeated unproductive attempts" },
|
|
117
|
+
{ pattern: /\b(ambiguous|unclear|vague|not obvious)\b/i, score: 2, signal: "ambiguous next step" }
|
|
118
|
+
],
|
|
119
|
+
"completion-contract": [
|
|
120
|
+
{ pattern: /\b(done|complete|completion|ship|release|preview|publish|npm|package|public|launch|ready|readiness)\b/i, score: 6, signal: "definition of done matters" },
|
|
121
|
+
{ pattern: /\b(privacy|security|trust|docs|documentation|claim|positioning|pricing|migration)\b/i, score: 3, signal: "public or trust-sensitive work" }
|
|
122
|
+
],
|
|
123
|
+
"quality-streak": [
|
|
124
|
+
{ pattern: /\b(flaky|flake|intermittent|stabilize|stability|reliable|reliability|streak|consecutive|race|timing)\b/i, score: 6, signal: "needs repeated clean validation" },
|
|
125
|
+
{ pattern: /\b(test|suite|smoke|ci)\b/i, score: 2, signal: "validation can be repeated" }
|
|
126
|
+
],
|
|
127
|
+
"adversarial-review": [
|
|
128
|
+
{ pattern: /\b(review|critic|critique|challenge|second judge|red.?team|adversarial|disagree|consensus)\b/i, score: 6, signal: "asks for challenge or second judgment" },
|
|
129
|
+
{ pattern: /\b(architecture|strategy|security|privacy|ux|product|release|public|risky|risk)\b/i, score: 4, signal: "higher-risk judgment benefits from critique" }
|
|
130
|
+
],
|
|
131
|
+
"human-approval-queue": [
|
|
132
|
+
{ pattern: /\b(approve|approval|permission|gate|manual|ask me|confirm|protected|dependency|network|external transfer|secret)\b/i, score: 6, signal: "approval boundary likely" },
|
|
133
|
+
{ pattern: /\b(pause|resume|revise|reject|abort)\b/i, score: 3, signal: "operator decision language" }
|
|
134
|
+
]
|
|
135
|
+
};
|
|
136
|
+
export const listLoopRecipes = () => recipeCatalog.map((recipe) => ({ ...recipe }));
|
|
137
|
+
const recipeById = (id) => {
|
|
138
|
+
const recipe = recipeCatalog.find((candidate) => candidate.id === id);
|
|
139
|
+
if (!recipe) {
|
|
140
|
+
throw new Error(`Unknown loop recipe ${id}.`);
|
|
141
|
+
}
|
|
142
|
+
return recipe;
|
|
143
|
+
};
|
|
144
|
+
const scoreRecipe = (recipe, text) => {
|
|
145
|
+
const rules = scoringRules[recipe.id];
|
|
146
|
+
const matched = rules.filter((rule) => rule.pattern.test(text));
|
|
147
|
+
const ruleScore = matched.reduce((total, rule) => total + rule.score, 0);
|
|
148
|
+
const defaultScore = recipe.id === "build-test-fix" ? 2 : 0;
|
|
149
|
+
const statusAdjustment = recipe.status === "planned" ? -2 : 0;
|
|
150
|
+
return {
|
|
151
|
+
recipe,
|
|
152
|
+
score: Math.max(0, ruleScore + defaultScore + statusAdjustment),
|
|
153
|
+
signals: matched.map((rule) => rule.signal)
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
const confidenceFor = (scores) => {
|
|
157
|
+
const [top, second] = scores;
|
|
158
|
+
if (!top || top.score < 4) {
|
|
159
|
+
return "low";
|
|
160
|
+
}
|
|
161
|
+
if (!second || top.score - second.score >= 4 || top.score >= 8) {
|
|
162
|
+
return "high";
|
|
163
|
+
}
|
|
164
|
+
return "medium";
|
|
165
|
+
};
|
|
166
|
+
const recommendationReason = (score, confidence) => {
|
|
167
|
+
const signals = score.signals.length > 0
|
|
168
|
+
? score.signals.join("; ")
|
|
169
|
+
: "it is the safest default for scoped software goal loops";
|
|
170
|
+
return `${score.recipe.title} is the ${confidence}-confidence recommendation because ${signals}.`;
|
|
171
|
+
};
|
|
172
|
+
const stackIdsFor = (recipeId) => {
|
|
173
|
+
switch (recipeId) {
|
|
174
|
+
case "completion-contract":
|
|
175
|
+
return ["completion-contract", "adversarial-review", "verifier-loop"];
|
|
176
|
+
case "adversarial-review":
|
|
177
|
+
return ["adversarial-review", "verifier-loop"];
|
|
178
|
+
case "quality-streak":
|
|
179
|
+
return ["quality-streak", "verifier-loop"];
|
|
180
|
+
case "anti-spin":
|
|
181
|
+
return ["anti-spin", "human-approval-queue"];
|
|
182
|
+
default:
|
|
183
|
+
return [recipeId];
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
const recommendationStack = (recipe) => stackIdsFor(recipe.id).map((recipeId, index) => {
|
|
187
|
+
const stackRecipe = recipeById(recipeId);
|
|
188
|
+
return {
|
|
189
|
+
order: index + 1,
|
|
190
|
+
recipe: stackRecipe,
|
|
191
|
+
required: index === 0,
|
|
192
|
+
purpose: index === 0
|
|
193
|
+
? "Primary loop shape selected for this goal."
|
|
194
|
+
: `Companion check: ${stackRecipe.purpose}`
|
|
195
|
+
};
|
|
196
|
+
});
|
|
197
|
+
const packageScripts = async (repoPath) => {
|
|
198
|
+
const packagePath = path.join(repoPath, "package.json");
|
|
199
|
+
try {
|
|
200
|
+
const parsed = JSON.parse(await fs.readFile(packagePath, "utf8"));
|
|
201
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
202
|
+
return [];
|
|
203
|
+
}
|
|
204
|
+
const scripts = parsed.scripts;
|
|
205
|
+
if (scripts === null || typeof scripts !== "object" || Array.isArray(scripts)) {
|
|
206
|
+
return [];
|
|
207
|
+
}
|
|
208
|
+
return ["typecheck", "test", "lint", "build", "smoke:runtime", "smoke:mcp"]
|
|
209
|
+
.filter((name) => typeof scripts[name] === "string")
|
|
210
|
+
.map((name) => `npm run ${name}`);
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
return [];
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
const defaultValidationCommands = async (repoPath, recipeId) => {
|
|
217
|
+
const discovered = await packageScripts(repoPath);
|
|
218
|
+
if (discovered.length > 0) {
|
|
219
|
+
return discovered.slice(0, 4);
|
|
220
|
+
}
|
|
221
|
+
if (recipeId === "completion-contract" || recipeId === "verifier-loop") {
|
|
222
|
+
return ["project-defined validation command"];
|
|
223
|
+
}
|
|
224
|
+
return ["existing test or build command"];
|
|
225
|
+
};
|
|
226
|
+
const acceptanceCriteriaFor = (recipe) => {
|
|
227
|
+
switch (recipe.id) {
|
|
228
|
+
case "completion-contract":
|
|
229
|
+
return [
|
|
230
|
+
"Every required outcome is mapped to current evidence.",
|
|
231
|
+
"Allowed paths, forbidden changes, validation commands, and stop conditions are explicit before implementation.",
|
|
232
|
+
"The final report references runtime-captured evidence instead of model summaries."
|
|
233
|
+
];
|
|
234
|
+
case "quality-streak":
|
|
235
|
+
return [
|
|
236
|
+
"The relevant validation passes repeatedly under recorded conditions.",
|
|
237
|
+
"Any failure resets the streak instead of counting as success.",
|
|
238
|
+
"The run is marked planned/docs-only until quality-streak execution is implemented."
|
|
239
|
+
];
|
|
240
|
+
case "adversarial-review":
|
|
241
|
+
return [
|
|
242
|
+
"A read-only critic challenges the current plan or patch.",
|
|
243
|
+
"Fixable concerns become revision work; sidecar critique does not satisfy acceptance.",
|
|
244
|
+
"Runtime validation and verifier review still decide completion."
|
|
245
|
+
];
|
|
246
|
+
case "anti-spin":
|
|
247
|
+
return [
|
|
248
|
+
"The run has a low iteration budget and concrete evidence requests.",
|
|
249
|
+
"Repeated failures, duplicate context requests, no-diff repairs, or flip-flops stop the loop.",
|
|
250
|
+
"Exhaustion or blockers are reported honestly, not as success."
|
|
251
|
+
];
|
|
252
|
+
case "human-approval-queue":
|
|
253
|
+
return [
|
|
254
|
+
"Approval gates show the exact reason, affected refs, and available decisions.",
|
|
255
|
+
"The runtime resumes only after approve, revise, reject, or abort.",
|
|
256
|
+
"Manual approval is recorded as evidence."
|
|
257
|
+
];
|
|
258
|
+
case "verifier-loop":
|
|
259
|
+
return [
|
|
260
|
+
"Runtime captures validation evidence before review.",
|
|
261
|
+
"Verifier is independent from the implementer.",
|
|
262
|
+
"Verifier approves, requests revision, asks the user, or aborts with evidence."
|
|
263
|
+
];
|
|
264
|
+
case "build-test-fix":
|
|
265
|
+
return [
|
|
266
|
+
"The scoped change is implemented without unrelated edits.",
|
|
267
|
+
"Runtime captures validation command evidence.",
|
|
268
|
+
"Fixable failures become revision packets and the verifier reviews fresh evidence."
|
|
269
|
+
];
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
const contractFor = async (repoPath, goal, recipe, maxIterations, input) => ({
|
|
273
|
+
goal,
|
|
274
|
+
acceptanceCriteria: input.acceptanceCriteria?.length
|
|
275
|
+
? input.acceptanceCriteria
|
|
276
|
+
: acceptanceCriteriaFor(recipe),
|
|
277
|
+
validationCommands: input.validationCommands?.length
|
|
278
|
+
? input.validationCommands
|
|
279
|
+
: await defaultValidationCommands(repoPath, recipe.id),
|
|
280
|
+
allowedPaths: input.allowedPaths?.length
|
|
281
|
+
? input.allowedPaths
|
|
282
|
+
: ["Paths implied by the goal and approved runtime plan."],
|
|
283
|
+
forbiddenChanges: [
|
|
284
|
+
...(input.forbiddenChanges?.length ? input.forbiddenChanges : ["Unrelated files."]),
|
|
285
|
+
"Secrets, credentials, browser profiles, or private run logs.",
|
|
286
|
+
"Protected test, fixture, snapshot, or eval changes without explicit approval."
|
|
287
|
+
],
|
|
288
|
+
requiredEvidence: recipe.requiredEvidence,
|
|
289
|
+
reviewerRoles: recipe.roles.filter((role) => role === "qa" || role === "verifier" || role === "critic"),
|
|
290
|
+
iterationBudget: maxIterations,
|
|
291
|
+
stopConditions: recipe.stopConditions
|
|
292
|
+
});
|
|
293
|
+
const constraintLines = (recipe, contract) => [
|
|
294
|
+
`Loop recipe: ${recipe.id}`,
|
|
295
|
+
`Loop purpose: ${recipe.purpose}`,
|
|
296
|
+
`Required evidence: ${contract.requiredEvidence.join("; ")}`,
|
|
297
|
+
`Acceptance criteria: ${contract.acceptanceCriteria.join("; ")}`,
|
|
298
|
+
`Validation commands: ${contract.validationCommands.join("; ")}`,
|
|
299
|
+
`Allowed paths: ${contract.allowedPaths.join("; ")}`,
|
|
300
|
+
`Stop conditions: ${contract.stopConditions.join("; ")}`,
|
|
301
|
+
`Forbidden changes: ${contract.forbiddenChanges.join("; ")}`
|
|
302
|
+
];
|
|
303
|
+
const runActionFor = (repoPath, goal, recipe, stack, contract) => ({
|
|
304
|
+
tool: "thehood_orchestrate",
|
|
305
|
+
description: "Start the recommended loop through the existing runtime. The runtime still owns approvals, evidence, verification, and stop conditions.",
|
|
306
|
+
arguments: {
|
|
307
|
+
goal,
|
|
308
|
+
repo_path: repoPath,
|
|
309
|
+
mode: "implement",
|
|
310
|
+
auto_loop: true,
|
|
311
|
+
constraints: [
|
|
312
|
+
`Loop stack: ${stack.map((item) => item.recipe.id).join(" -> ")}`,
|
|
313
|
+
...constraintLines(recipe, contract)
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
const cardActionsFor = (runAction) => [
|
|
318
|
+
{
|
|
319
|
+
action: "run_loop",
|
|
320
|
+
label: "Run loop",
|
|
321
|
+
style: "primary",
|
|
322
|
+
description: runAction.description,
|
|
323
|
+
tool: runAction.tool,
|
|
324
|
+
arguments: runAction.arguments
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
action: "edit_contract",
|
|
328
|
+
label: "Edit contract",
|
|
329
|
+
style: "secondary",
|
|
330
|
+
description: "Adjust acceptance criteria, validation commands, allowed paths, forbidden changes, or iteration budget before starting.",
|
|
331
|
+
commandHint: "Re-run recommend-loop with --acceptance, --validation, --allowed-path, --forbidden-change, or --max-iterations."
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
action: "show_alternatives",
|
|
335
|
+
label: "Show alternatives",
|
|
336
|
+
style: "secondary",
|
|
337
|
+
description: "Compare other loop choices without starting providers, edits, schedules, or external transfers."
|
|
338
|
+
}
|
|
339
|
+
];
|
|
340
|
+
const loopChoiceRows = (recommendation) => [
|
|
341
|
+
recommendation.recommended,
|
|
342
|
+
...recommendation.alternatives
|
|
343
|
+
].map((score, index) => ({
|
|
344
|
+
rank: index + 1,
|
|
345
|
+
recipe: score.recipe.id,
|
|
346
|
+
title: score.recipe.title,
|
|
347
|
+
label: score.recipe.plainLabel,
|
|
348
|
+
status: score.recipe.status,
|
|
349
|
+
score: score.score,
|
|
350
|
+
signals: score.signals.join(", "),
|
|
351
|
+
purpose: score.recipe.purpose,
|
|
352
|
+
stopConditions: score.recipe.stopConditions.join("; ")
|
|
353
|
+
}));
|
|
354
|
+
const stackRows = (stack) => stack.map((item) => ({
|
|
355
|
+
order: item.order,
|
|
356
|
+
recipe: item.recipe.id,
|
|
357
|
+
title: item.recipe.title,
|
|
358
|
+
status: item.recipe.status,
|
|
359
|
+
required: item.required,
|
|
360
|
+
purpose: item.purpose
|
|
361
|
+
}));
|
|
362
|
+
const contractRows = (contract) => [
|
|
363
|
+
{ field: "Goal", value: contract.goal },
|
|
364
|
+
{ field: "Acceptance Criteria", value: contract.acceptanceCriteria.join("; ") },
|
|
365
|
+
{ field: "Validation", value: contract.validationCommands.join("; ") },
|
|
366
|
+
{ field: "Allowed Paths", value: contract.allowedPaths.join("; ") },
|
|
367
|
+
{ field: "Forbidden Changes", value: contract.forbiddenChanges.join("; ") },
|
|
368
|
+
{ field: "Required Evidence", value: contract.requiredEvidence.join("; ") },
|
|
369
|
+
{ field: "Reviewer Roles", value: contract.reviewerRoles.join(", ") || "runtime/verifier as configured" },
|
|
370
|
+
{ field: "Iteration Budget", value: String(contract.iterationBudget) },
|
|
371
|
+
{ field: "Stop Conditions", value: contract.stopConditions.join("; ") }
|
|
372
|
+
];
|
|
373
|
+
const actionRows = (actions) => actions.map((action, index) => ({
|
|
374
|
+
order: index + 1,
|
|
375
|
+
action: action.action,
|
|
376
|
+
label: action.label,
|
|
377
|
+
style: action.style,
|
|
378
|
+
tool: action.tool ?? "",
|
|
379
|
+
commandHint: action.commandHint ?? "",
|
|
380
|
+
description: action.description
|
|
381
|
+
}));
|
|
382
|
+
const cardFor = (score, confidence, reason, stack, contract, actions) => ({
|
|
383
|
+
title: `Recommended loop: ${score.recipe.title}`,
|
|
384
|
+
subtitle: reason,
|
|
385
|
+
badges: [
|
|
386
|
+
{ label: "Confidence", value: confidence },
|
|
387
|
+
{ label: "Recipe", value: score.recipe.id },
|
|
388
|
+
{ label: "Status", value: score.recipe.status }
|
|
389
|
+
],
|
|
390
|
+
sections: [
|
|
391
|
+
{
|
|
392
|
+
id: "stack",
|
|
393
|
+
title: "Stack",
|
|
394
|
+
items: stack.map((item) => `${item.order}. ${item.recipe.title}${item.required ? " (primary)" : " (companion)"}`)
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
id: "contract",
|
|
398
|
+
title: "Completion Contract",
|
|
399
|
+
items: [
|
|
400
|
+
`Goal: ${contract.goal}`,
|
|
401
|
+
`Evidence: ${contract.requiredEvidence.join("; ")}`,
|
|
402
|
+
`Validation: ${contract.validationCommands.join("; ")}`,
|
|
403
|
+
`Stops: ${contract.stopConditions.join("; ")}`,
|
|
404
|
+
`Budget: ${contract.iterationBudget}`
|
|
405
|
+
]
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
id: "boundaries",
|
|
409
|
+
title: "Boundaries",
|
|
410
|
+
items: contract.forbiddenChanges
|
|
411
|
+
}
|
|
412
|
+
],
|
|
413
|
+
actions,
|
|
414
|
+
rendererHint: "Render this card first. Use artifact.manifest and artifact.snapshot as the table/dashboard fallback."
|
|
415
|
+
});
|
|
416
|
+
const buildRecommendationArtifact = (recommendation) => ({
|
|
417
|
+
surface: "dashboard",
|
|
418
|
+
manifest: {
|
|
419
|
+
version: 1,
|
|
420
|
+
surface: "dashboard",
|
|
421
|
+
title: "TheHood Loop Plan",
|
|
422
|
+
description: "A read-only recommendation for choosing a governed software goal-loop recipe.",
|
|
423
|
+
blocks: [
|
|
424
|
+
{
|
|
425
|
+
id: "intro",
|
|
426
|
+
type: "markdown",
|
|
427
|
+
body: [
|
|
428
|
+
"# TheHood Loop Plan",
|
|
429
|
+
recommendation.reason,
|
|
430
|
+
"",
|
|
431
|
+
"This is a recommendation only. Running the loop still goes through TheHood runtime approvals, evidence capture, verification, and stop conditions."
|
|
432
|
+
].join("\n")
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
id: "recipes",
|
|
436
|
+
type: "table",
|
|
437
|
+
tableId: "loop_recipes"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
id: "stack",
|
|
441
|
+
type: "table",
|
|
442
|
+
tableId: "loop_stack"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
id: "contract",
|
|
446
|
+
type: "table",
|
|
447
|
+
tableId: "completion_contract"
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
id: "actions",
|
|
451
|
+
type: "table",
|
|
452
|
+
tableId: "card_actions"
|
|
453
|
+
}
|
|
454
|
+
],
|
|
455
|
+
tables: [
|
|
456
|
+
{
|
|
457
|
+
id: "loop_recipes",
|
|
458
|
+
title: "Loop Choices",
|
|
459
|
+
dataset: "loop_recipes",
|
|
460
|
+
columns: [
|
|
461
|
+
{ field: "rank", header: "Rank" },
|
|
462
|
+
{ field: "title", header: "Loop" },
|
|
463
|
+
{ field: "label", header: "Plain Label" },
|
|
464
|
+
{ field: "status", header: "Status" },
|
|
465
|
+
{ field: "signals", header: "Why" },
|
|
466
|
+
{ field: "stopConditions", header: "Stops On" }
|
|
467
|
+
],
|
|
468
|
+
defaultSort: { field: "rank", direction: "asc" }
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
id: "loop_stack",
|
|
472
|
+
title: "Recommended Stack",
|
|
473
|
+
dataset: "loop_stack",
|
|
474
|
+
columns: [
|
|
475
|
+
{ field: "order", header: "Order" },
|
|
476
|
+
{ field: "title", header: "Loop" },
|
|
477
|
+
{ field: "status", header: "Status" },
|
|
478
|
+
{ field: "required", header: "Primary" },
|
|
479
|
+
{ field: "purpose", header: "Purpose" }
|
|
480
|
+
],
|
|
481
|
+
defaultSort: { field: "order", direction: "asc" }
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
id: "completion_contract",
|
|
485
|
+
title: "Completion Contract Draft",
|
|
486
|
+
dataset: "completion_contract",
|
|
487
|
+
columns: [
|
|
488
|
+
{ field: "field", header: "Field" },
|
|
489
|
+
{ field: "value", header: "Draft" }
|
|
490
|
+
],
|
|
491
|
+
defaultSort: { field: "field", direction: "asc" }
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
id: "card_actions",
|
|
495
|
+
title: "Actions",
|
|
496
|
+
dataset: "card_actions",
|
|
497
|
+
columns: [
|
|
498
|
+
{ field: "order", header: "Order" },
|
|
499
|
+
{ field: "label", header: "Action" },
|
|
500
|
+
{ field: "style", header: "Style" },
|
|
501
|
+
{ field: "tool", header: "Tool" },
|
|
502
|
+
{ field: "description", header: "Description" }
|
|
503
|
+
],
|
|
504
|
+
defaultSort: { field: "order", direction: "asc" }
|
|
505
|
+
}
|
|
506
|
+
]
|
|
507
|
+
},
|
|
508
|
+
snapshot: {
|
|
509
|
+
version: 1,
|
|
510
|
+
status: "ready",
|
|
511
|
+
datasets: {
|
|
512
|
+
loop_recipes: loopChoiceRows(recommendation),
|
|
513
|
+
loop_stack: stackRows(recommendation.stack),
|
|
514
|
+
completion_contract: contractRows(recommendation.contract),
|
|
515
|
+
card_actions: actionRows(recommendation.actions)
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
sources: []
|
|
519
|
+
});
|
|
520
|
+
export const recommendLoop = async (input) => {
|
|
521
|
+
const repoPath = resolveRepoPath(input.repoPath);
|
|
522
|
+
const goal = input.goal.trim();
|
|
523
|
+
if (!goal) {
|
|
524
|
+
throw new Error("Loop recommendation goal cannot be empty.");
|
|
525
|
+
}
|
|
526
|
+
const text = [goal, ...(input.constraints ?? [])].join("\n");
|
|
527
|
+
const scores = listLoopRecipes()
|
|
528
|
+
.map((recipe) => scoreRecipe(recipe, text))
|
|
529
|
+
.sort((left, right) => right.score - left.score || left.recipe.id.localeCompare(right.recipe.id));
|
|
530
|
+
const recommended = scores[0] ?? scoreRecipe(recipeById("build-test-fix"), text);
|
|
531
|
+
const alternatives = scores
|
|
532
|
+
.filter((score) => score.recipe.id !== recommended.recipe.id)
|
|
533
|
+
.slice(0, 3);
|
|
534
|
+
const confidence = confidenceFor([recommended, ...alternatives]);
|
|
535
|
+
const maxIterations = input.maxIterations ?? 5;
|
|
536
|
+
const stack = recommendationStack(recommended.recipe);
|
|
537
|
+
const contract = await contractFor(repoPath, goal, recommended.recipe, maxIterations, input);
|
|
538
|
+
const runAction = runActionFor(repoPath, goal, recommended.recipe, stack, contract);
|
|
539
|
+
const actions = cardActionsFor(runAction);
|
|
540
|
+
const reason = recommendationReason(recommended, confidence);
|
|
541
|
+
const withoutArtifact = {
|
|
542
|
+
kind: "loop_recommendation",
|
|
543
|
+
schemaVersion: 1,
|
|
544
|
+
repoPath,
|
|
545
|
+
goal,
|
|
546
|
+
recommended,
|
|
547
|
+
alternatives,
|
|
548
|
+
stack,
|
|
549
|
+
confidence,
|
|
550
|
+
reason,
|
|
551
|
+
contract,
|
|
552
|
+
runAction,
|
|
553
|
+
actions,
|
|
554
|
+
card: cardFor(recommended, confidence, reason, stack, contract, actions),
|
|
555
|
+
notes: [
|
|
556
|
+
"The user does not need to know recipe IDs before asking for a loop.",
|
|
557
|
+
"Recipe selection is read-only and does not start providers, edits, schedules, or external transfers.",
|
|
558
|
+
"Quality streak is a documented/planned recipe; current execution should use existing runtime validation and verifier gates."
|
|
559
|
+
]
|
|
560
|
+
};
|
|
561
|
+
return {
|
|
562
|
+
...withoutArtifact,
|
|
563
|
+
artifact: buildRecommendationArtifact(withoutArtifact)
|
|
564
|
+
};
|
|
565
|
+
};
|
|
566
|
+
//# sourceMappingURL=loopRecommendation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loopRecommendation.js","sourceRoot":"","sources":["../../src/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