Add source-constrained joint planning and scoped dependency-aware recovery

This commit is contained in:
Nico committed 2026-10-20 00:43:27 +02:00
1 parent d280f001fc
commit 83ef9e6d6c
23 files changed
+913 -42

No files matched your search

@@ -11,6 +11,10 @@ PROMPT_VERSION = "hypotheses_v1"
class HypothesisPromptBuilder(PromptBuilder):
def build(self, context):
schema = output_schema(context["policy"])
if context.get('joint_retained'):
retained=context['joint_retained'];array=schema['properties']['hypotheses']
array.update(minItems=retained['count'],maxItems=retained['count'])
array['prefixItems']=[{'const':retained['proposals'][str(i)]} if str(i) in retained['proposals'] else {'$ref':'#/$defs/proposal'} for i in range(retained['count'])]
version = context.get('prompt_version', PROMPT_VERSION)
model_context = context
encode = lambda value: json_bytes(value).decode("utf-8")
@@ -28,5 +32,5 @@ class HypothesisPromptBuilder(PromptBuilder):
from .json_consolidation import consolidate
model_context = consolidate(model_context)
return {"prompt_version": version, "privacy": "configured", "output_schema": schema,
"messages": [{"role": "system", "content": files("viano_bug_analysis.llm.prompts").joinpath(version + ".txt").read_text(encoding="utf-8")},
"messages": [{"role": "system", "content": files("viano_bug_analysis.llm.prompts").joinpath(version + ".txt").read_text(encoding="utf-8") + ("\nPreserve joint_retained.proposals exactly at their zero-based positions. Generate ONLY the other positions; return the full array for deterministic merging/validation. Retained proposals were explicitly reviewed; do not rewrite or reorder them." if context.get("joint_retained") else "")},
{"role": "user", "content": encode({"task": "generate_hypotheses", "input": model_context, "output_schema": schema})}]}