feat: release 2.4.2 with batch human review badges
This commit is contained in:
1 parent
ac3d8cf54a
commit
b53ca18595
14 files changed
+192
-14
No files matched your search
@@ -36,6 +36,32 @@ def installation_signature() -> str:
|
||||
)
|
||||
|
||||
|
||||
def reviewed_batch_sessions(batch_id: str, store: AutomationStore) -> set[str]:
|
||||
"""Read current human review values once per batch, without loading history."""
|
||||
manifest = next((item for item in active_manifests() if item.id == "task-review"), None)
|
||||
if manifest is None or manifest.workspace is None:
|
||||
return set()
|
||||
with store.connection() as conn:
|
||||
rows = conn.execute(
|
||||
"""SELECT j.session_id, json_extract(r.payload, '$."task-review".values') AS review_values
|
||||
FROM automation_jobs j JOIN automation_records r
|
||||
ON r.kind='task_extensions' AND r.id=j.session_id
|
||||
WHERE j.batch_id=?""",
|
||||
(batch_id,),
|
||||
).fetchall()
|
||||
reviewed = set()
|
||||
for row in rows:
|
||||
values = json.loads(row["review_values"] or "{}")
|
||||
if any(
|
||||
isinstance(value := values.get(field.id), str)
|
||||
and value.strip()
|
||||
and (field.kind == "text" or value in field.options)
|
||||
for field in manifest.workspace.fields
|
||||
):
|
||||
reviewed.add(row["session_id"])
|
||||
return reviewed
|
||||
|
||||
|
||||
def task_context(session_id: str, store: AutomationStore) -> dict:
|
||||
identifier(session_id)
|
||||
session = SessionRepository(store.path).get_session_by_id(session_id) or {}
|
||||
|
||||
Reference in new issue
Block a user