feat: improve mode and peripheral orchestration
This commit is contained in:
@@ -21,17 +21,17 @@ def test_console_contains_ai_assistant_surface():
|
||||
assert 'placeholder="向 AI助手提问或交代工作"' in template
|
||||
assert 'aria-label="发送消息"' in template
|
||||
assert 'import "../assistant-chat.css";' in vite_entry
|
||||
assert 'src="/assistant-chat.js?v=codex-assistant-35"' in html
|
||||
assert 'src="/assistant-chat.js?v=codex-assistant-39-video-media"' in html
|
||||
|
||||
|
||||
def test_codex_assistant_assets_are_versioned_together_in_the_service_worker():
|
||||
service_worker = (ROOT / "apps/web-console/service-worker.js").read_text(encoding="utf-8")
|
||||
assert (
|
||||
'const CACHE_VERSION = "cognitive-agent-pad-v329-mode-preview"'
|
||||
'const CACHE_VERSION = "cognitive-agent-pad-v334-video-media"'
|
||||
in service_worker
|
||||
)
|
||||
assert '"/assistant-chat.css?v=codex-assistant-30"' in service_worker
|
||||
assert '"/assistant-chat.js?v=codex-assistant-35"' in service_worker
|
||||
assert '"/assistant-chat.js?v=codex-assistant-39-video-media"' in service_worker
|
||||
|
||||
|
||||
def test_codex_frontend_uses_one_streaming_endpoint_and_agent_work_events():
|
||||
@@ -95,6 +95,8 @@ def test_validated_controls_are_mirrored_into_a_compact_assistant_card():
|
||||
assert 'count.className = "assistant-dispatched-controls-count"' in script
|
||||
assert 'list.className = "assistant-dispatched-controls-list"' in script
|
||||
assert "value.textContent = assistantControlValue(item)" in script
|
||||
assert 'return ({ 1: "3档", 2: "1档" })[level]' in script
|
||||
assert '{ 1: "3档(高)", 2: "1档(低)" }' in script
|
||||
assert "语义控制指令:" in script
|
||||
assert "实际控制指令:" in script
|
||||
assert "appendDispatchedControls(message, event.payload)" in script
|
||||
@@ -105,6 +107,9 @@ def test_validated_controls_are_mirrored_into_a_compact_assistant_card():
|
||||
assert "appendDispatchedControls(message, modeExecutionPreviewResult(profile))" in script
|
||||
assert "beginModeExecution," in script
|
||||
assert "completeModeExecution," in script
|
||||
assert "功能模式部分完成" not in script
|
||||
assert "功能模式指令已提交" in script
|
||||
assert "未由 PC 执行的" in script
|
||||
assert "const operationByRef = new Map()" in script
|
||||
assert 'deliveryState: "submitting"' in script
|
||||
assert 'deliveryLabel: "正在下发"' in script
|
||||
@@ -113,6 +118,10 @@ def test_validated_controls_are_mirrored_into_a_compact_assistant_card():
|
||||
assert '"seat.set_legrest_height": "腿托"' in script
|
||||
assert '"seat.set_legrest_extension": "腿托"' in script
|
||||
assert '"ambient_light.set_illumination": "氛围灯颜色与亮度"' in script
|
||||
assert '"android.launch_app": "打开视频媒体"' in script
|
||||
assert 'if (capability === "android.launch_app")' in script
|
||||
assert "parameters.package_name" in script
|
||||
assert "parameters.activity_name" in script
|
||||
assert '.replaceAll("_", "-")' in script
|
||||
assert ".assistant-dispatched-controls > summary" in css
|
||||
assert ".assistant-dispatched-controls-list > li" in css
|
||||
@@ -130,6 +139,16 @@ def test_explicit_nfc_authorization_block_is_rendered_as_safety_blocked():
|
||||
assert '? "安全阻止"' in console
|
||||
|
||||
|
||||
def test_n7_video_launch_uses_chinese_mode_card_labels():
|
||||
app = (ROOT / "apps/web-console/app.js").read_text(encoding="utf-8")
|
||||
|
||||
assert 'android: "车机媒体"' in app
|
||||
assert 'headunit: "车机"' in app
|
||||
assert '"android.launch_app": "打开视频媒体"' in app
|
||||
assert 'package_name: "应用包名"' in app
|
||||
assert 'activity_name: "启动页面"' in app
|
||||
|
||||
|
||||
def test_latest_dispatched_control_group_is_the_only_group_expanded():
|
||||
assistant = (ROOT / "apps/web-console/assistant-chat.js").read_text(
|
||||
encoding="utf-8"
|
||||
@@ -189,6 +208,18 @@ def test_codex_request_keeps_trusted_vehicle_context_without_legacy_model_routin
|
||||
assert 'const executionMode = modeConfigurationPreview ? "dry_run"' in request_body
|
||||
|
||||
|
||||
def test_codex_request_reuses_only_the_console_validated_hardware_client_id():
|
||||
app = (ROOT / "apps/web-console/app.js").read_text(encoding="utf-8")
|
||||
assistant = (ROOT / "apps/web-console/assistant-chat.js").read_text(encoding="utf-8")
|
||||
|
||||
assert "const HARDWARE_CLIENT_ID_PATTERN" in app
|
||||
assert "function validatedHardwareClientId()" in app
|
||||
assert "getHardwareClientId()" in app
|
||||
assert "return validatedHardwareClientId();" in app
|
||||
assert "window.CognitiveAgentConsole?.getHardwareClientId?.()" in assistant
|
||||
assert "/^hwc-[a-z0-9-]{8,80}$/.test(value)" in assistant
|
||||
|
||||
|
||||
def test_starting_a_new_codex_conversation_rotates_the_conversation_id():
|
||||
script = (ROOT / "apps/web-console/assistant-chat.js").read_text(encoding="utf-8")
|
||||
assert 'const CONVERSATION_STORAGE_KEY = "cognitive-agent.conversation-id"' in script
|
||||
|
||||
Reference in New Issue
Block a user