feat(team): select Agent Teams per Session from the model menu

This commit is contained in:
Dudu-0223 committed 2026-10-19 20:29:09 +08:00
commit 9aecd40ecb
87 files changed
+4546 -150

No files matched your search

@@ -0,0 +1,48 @@
{
"finalResponse": "TEAM_MODE_OK",
"auditEvents": [
{
"type": "team/mode",
"seq": 3,
"time": 0,
"data": {
"enabled": true
}
},
{
"type": "team/mode",
"seq": 4,
"time": 0,
"data": {
"enabled": false
}
}
],
"auditNotifications": [
{
"method": "session.event",
"event": {
"type": "team/mode",
"seq": 3,
"time": 0,
"data": {
"enabled": true
}
}
},
{
"method": "session.event",
"event": {
"type": "team/mode",
"seq": 4,
"time": 0,
"data": {
"enabled": false
}
}
}
],
"assistantTexts": [
"TEAM_MODE_OK"
]
}
@@ -1,18 +1,26 @@
"""Raw audit projection paired with the translator's actual native Loader request tests."""
"""Raw Session event projection paired with owning runtime and recorded-session tests."""
from __future__ import annotations
import json
import sys
from pathlib import Path
import pytest
from deepseek_harness import DeepSeekHarness
EXPECTED = Path(__file__).parent / "expected" / "cot-translation-projection.json"
EXPECTED_ROOT = Path(__file__).parent / "expected"
def test_common_translation_records_retain_raw_audit_and_original_main_response(tmp_path: Path) -> None:
expected = json.loads(EXPECTED.read_text(encoding="utf-8"))
@pytest.mark.parametrize("fixture, event_types", [
("cot-translation-projection.json", ("plugin:translator/request", "plugin:translator/result")),
("team-mode-projection.json", ("team/mode",)),
])
def test_session_records_retain_raw_events_and_original_main_response(
tmp_path: Path, fixture: str, event_types: tuple[str, ...],
) -> None:
expected = json.loads((EXPECTED_ROOT / fixture).read_text(encoding="utf-8"))
script = tmp_path / "audit_runtime.py"
script.write_text(
"""
@@ -58,11 +66,11 @@ for line in sys.stdin:
result = harness.run("Keep the original response.", session_id="sdk-audit")
audit_notifications = [notification for notification in result.notifications
if notification.method == "session.event"
and notification.payload["event"]["type"] in ("plugin:translator/request", "plugin:translator/result")]
and notification.payload["event"]["type"] in event_types]
assert all(notification.payload["sessionId"] == result.session_id for notification in audit_notifications)
projection = {
"finalResponse": result.final_response,
"auditEvents": [event for event in result.events if event["type"] in ("plugin:translator/request", "plugin:translator/result")],
"auditEvents": [event for event in result.events if event["type"] in event_types],
"auditNotifications": [{"method": notification.method, "event": notification.payload["event"]}
for notification in audit_notifications],
"assistantTexts": [block["text"] for event in result.events if event["type"] == "assistant/message"