Put student-first detect learning ahead of the teacher call.
Identity-only senses no longer lock a new cue. Learning stages, journal-generate review, and additive docs follow the closed section 6. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
a65ea98b0c
commit
011cc9dd81
26 files changed
+1893
-89
No files matched your search
@@ -98,6 +98,12 @@ COMPACT_DIAGNOSTIC_KEYS = (
|
||||
"invalid_entity_type",
|
||||
"omitted_non_identity_types",
|
||||
"detect_cost_unknown",
|
||||
"diff_agree",
|
||||
"diff_only_student",
|
||||
"diff_only_teacher",
|
||||
"diff_type_conflict",
|
||||
"diff_new_identity",
|
||||
"diff_cue_reinforced",
|
||||
"generation_selection",
|
||||
"style_application",
|
||||
)
|
||||
@@ -1059,10 +1065,12 @@ def complete(request: GatewayRequest) -> GatewayResult:
|
||||
try:
|
||||
if precomputed is not None:
|
||||
mappings = list(precomputed)
|
||||
extra = dict((request.payload or {}).get("detect_counters") or {})
|
||||
detect_stats = {
|
||||
"detect_note": "precomputed_learning_review",
|
||||
"full_detection_coverage": True,
|
||||
"semantic_identity_guaranteed": False,
|
||||
**{key: extra[key] for key in extra if key.startswith("diff_")},
|
||||
}
|
||||
local_identities = [
|
||||
{
|
||||
@@ -1075,12 +1083,37 @@ def complete(request: GatewayRequest) -> GatewayResult:
|
||||
]
|
||||
detect_name = "learning_review"
|
||||
else:
|
||||
outcome = detect_personal_egress(request.profile_id, rendered)
|
||||
mappings = outcome.mappings
|
||||
detect_stats = outcome.stats.public()
|
||||
detect_name = outcome.stats.detect_provider
|
||||
detect_note = outcome.stats.detect_note
|
||||
local_identities = outcome.local_identities
|
||||
from detect_learning import is_bypass_mode
|
||||
from detect_pipeline import compact_diff_counters, prepare_detect_pipeline
|
||||
|
||||
user_body = str((request.payload or {}).get("user_body") or "").strip()
|
||||
if request.profile_id and not is_bypass_mode() and user_body:
|
||||
pipe = prepare_detect_pipeline(request.profile_id, user_body, rendered)
|
||||
mappings = list(pipe.mappings or [])
|
||||
detect_stats = {
|
||||
"detect_note": "student_path" if not pipe.need_review else "student_path_unreviewed",
|
||||
"full_detection_coverage": True,
|
||||
"semantic_identity_guaranteed": False,
|
||||
**compact_diff_counters(pipe.counters),
|
||||
}
|
||||
detect_name = "student_path"
|
||||
detect_note = detect_stats["detect_note"]
|
||||
local_identities = [
|
||||
{
|
||||
"local_label": item.get("local_label"),
|
||||
"token": item.get("token"),
|
||||
"entity_type": item.get("entity_type"),
|
||||
"source": item.get("source"),
|
||||
}
|
||||
for item in mappings
|
||||
]
|
||||
else:
|
||||
outcome = detect_personal_egress(request.profile_id, rendered)
|
||||
mappings = outcome.mappings
|
||||
detect_stats = outcome.stats.public()
|
||||
detect_name = outcome.stats.detect_provider
|
||||
detect_note = outcome.stats.detect_note
|
||||
local_identities = outcome.local_identities
|
||||
except DetectError as exc:
|
||||
detect_stats = dict(exc.diagnostics or {})
|
||||
_log_event(
|
||||
|
||||
Reference in new issue
Block a user