6ede33ccdb
Build and Push Docker Images / create_manifest (web, surfsense-web, , cpu) (push) Has been cancelled
Build and Push Docker Images / finalize_release (push) Has been cancelled
Obsidian Plugin Lint / lint (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / compute_version (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / verify_digests (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, , cpu) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda, cuda) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda126, cuda126) (push) Has been cancelled
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
"""Interrupt-request events with a single canonical payload shape."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from ..emitter import Emitter
|
|
from .data import format_data
|
|
|
|
|
|
def normalize_interrupt_payload(interrupt_value: dict[str, Any]) -> dict[str, Any]:
|
|
if "action_requests" in interrupt_value and "review_configs" in interrupt_value:
|
|
return interrupt_value
|
|
|
|
interrupt_type = interrupt_value.get("type", "unknown")
|
|
message = interrupt_value.get("message")
|
|
action = interrupt_value.get("action", {}) or {}
|
|
context = interrupt_value.get("context", {}) or {}
|
|
|
|
normalized: dict[str, Any] = {
|
|
"action_requests": [
|
|
{
|
|
"name": action.get("tool", "unknown_tool"),
|
|
"args": action.get("params", {}),
|
|
}
|
|
],
|
|
"review_configs": [
|
|
{
|
|
"action_name": action.get("tool", "unknown_tool"),
|
|
"allowed_decisions": ["approve", "edit", "reject"],
|
|
}
|
|
],
|
|
"interrupt_type": interrupt_type,
|
|
"context": context,
|
|
}
|
|
if message:
|
|
normalized["message"] = message
|
|
return normalized
|
|
|
|
|
|
def format_interrupt_request(
|
|
interrupt_value: dict[str, Any],
|
|
*,
|
|
interrupt_id: str | None = None,
|
|
pending_interrupt_count: int | None = None,
|
|
chat_turn_id: str | None = None,
|
|
emitter: Emitter | None = None,
|
|
) -> str:
|
|
payload = normalize_interrupt_payload(interrupt_value)
|
|
if interrupt_id is not None:
|
|
payload["interrupt_id"] = interrupt_id
|
|
if pending_interrupt_count is not None:
|
|
payload["pending_interrupt_count"] = pending_interrupt_count
|
|
if chat_turn_id is not None:
|
|
payload["chat_turn_id"] = chat_turn_id
|
|
return format_data("interrupt-request", payload, emitter=emitter)
|