源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
Creator App Tests / PR Spam Gate (push) Skipped
Frontend Tests / PR Spam Gate (push) Skipped
NPM Format (website & console) / PR Spam Gate (push) Skipped
Pre-commit Checks / PR Spam Gate (push) Skipped
QwenPaw Creator Plugin Release / check-version (push) Canceled after 0s
QwenPaw Creator Plugin Release / upload-oss (push) Canceled after 0s
Tests / PR Spam Gate (push) Skipped
CodeQL / CodeQL (python) (push) Canceled after 0s
CodeQL / CodeQL (typescript) (push) Canceled after 0s
Creator App Tests / Creator Backend Tests (push) Canceled after 0s
Creator App Tests / Creator UI Build & Tests (push) Canceled after 0s
E2E Smoke Tests / Playwright UI Smoke (push) Canceled after 0s
Frontend Tests / Detect console changes (push) Canceled after 0s
NPM Format (website & console) / website format check (push) Canceled after 0s
NPM Format (website & console) / console format check (push) Canceled after 0s
Pre-commit Checks / Pre-commit (push) Canceled after 0s
QwenPaw Data Plugin Release / check-version (push) Canceled after 0s
Tests / Detect code changes (push) Canceled after 0s
Frontend Tests / Vitest Unit Tests (push) Canceled after 0s
Frontend Tests / Frontend Summary (push) Canceled after 0s
QwenPaw Data Plugin Release / upload-oss (push) Canceled after 0s
Tests / Maintainer Approval (push) Canceled after 0s
Tests / Unit Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - fallback (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p2 (push) Canceled after 0s
Tests / Coverage Report (push) Canceled after 0s
Tests / Test Summary (push) Canceled after 0s
Creator App Tests / PR Spam Gate (push) Skipped
Frontend Tests / PR Spam Gate (push) Skipped
NPM Format (website & console) / PR Spam Gate (push) Skipped
Pre-commit Checks / PR Spam Gate (push) Skipped
QwenPaw Creator Plugin Release / check-version (push) Canceled after 0s
QwenPaw Creator Plugin Release / upload-oss (push) Canceled after 0s
Tests / PR Spam Gate (push) Skipped
CodeQL / CodeQL (python) (push) Canceled after 0s
CodeQL / CodeQL (typescript) (push) Canceled after 0s
Creator App Tests / Creator Backend Tests (push) Canceled after 0s
Creator App Tests / Creator UI Build & Tests (push) Canceled after 0s
E2E Smoke Tests / Playwright UI Smoke (push) Canceled after 0s
Frontend Tests / Detect console changes (push) Canceled after 0s
NPM Format (website & console) / website format check (push) Canceled after 0s
NPM Format (website & console) / console format check (push) Canceled after 0s
Pre-commit Checks / Pre-commit (push) Canceled after 0s
QwenPaw Data Plugin Release / check-version (push) Canceled after 0s
Tests / Detect code changes (push) Canceled after 0s
Frontend Tests / Vitest Unit Tests (push) Canceled after 0s
Frontend Tests / Frontend Summary (push) Canceled after 0s
QwenPaw Data Plugin Release / upload-oss (push) Canceled after 0s
Tests / Maintainer Approval (push) Canceled after 0s
Tests / Unit Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - fallback (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p2 (push) Canceled after 0s
Tests / Coverage Report (push) Canceled after 0s
Tests / Test Summary (push) Canceled after 0s
This commit is contained in:
commit
1a3a4ccde1
4652 files changed
+1891610
No files matched your search
@@ -0,0 +1,172 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Tests for translating Qoder SDK messages."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
# pylint: disable=wrong-import-position
|
||||
# flake8: noqa: E402,E501
|
||||
pytest.importorskip(
|
||||
"qoder_agent_sdk",
|
||||
reason="optional qoder_agent_sdk (qoder extra) is required",
|
||||
)
|
||||
|
||||
from qoder_agent_sdk import (
|
||||
AssistantMessage,
|
||||
ResultMessage,
|
||||
SessionMessage,
|
||||
StreamEvent,
|
||||
TextBlock,
|
||||
ThinkingBlock,
|
||||
ToolResultBlock,
|
||||
ToolUseBlock,
|
||||
UserMessage,
|
||||
)
|
||||
|
||||
from qwenpaw.harnesses.events import (
|
||||
HarnessEventKind,
|
||||
HarnessHistoryKind,
|
||||
)
|
||||
from qwenpaw.harnesses.qoder.event_mapper import (
|
||||
QoderEventMapper,
|
||||
history_items,
|
||||
)
|
||||
|
||||
|
||||
def test_maps_incremental_text_and_reasoning_without_duplicates() -> None:
|
||||
mapper = QoderEventMapper()
|
||||
messages = [
|
||||
StreamEvent(
|
||||
uuid="stream-1",
|
||||
session_id="session-1",
|
||||
event={
|
||||
"type": "content_block_delta",
|
||||
"delta": {"type": "thinking_delta", "thinking": "Check"},
|
||||
},
|
||||
),
|
||||
StreamEvent(
|
||||
uuid="stream-2",
|
||||
session_id="session-1",
|
||||
event={
|
||||
"type": "content_block_delta",
|
||||
"delta": {"type": "text_delta", "text": "Done"},
|
||||
},
|
||||
),
|
||||
AssistantMessage(
|
||||
content=[
|
||||
ThinkingBlock(thinking="Check", signature="signature"),
|
||||
TextBlock(text="Done"),
|
||||
],
|
||||
model="qoder-test",
|
||||
),
|
||||
]
|
||||
|
||||
events = [
|
||||
event for message in messages for event in mapper.convert(message)
|
||||
]
|
||||
|
||||
assert [(event.kind, event.text) for event in events] == [
|
||||
(HarnessEventKind.REASONING_DELTA, "Check"),
|
||||
(HarnessEventKind.TEXT_DELTA, "Done"),
|
||||
]
|
||||
|
||||
|
||||
def test_maps_tool_start_progress_and_completion() -> None:
|
||||
mapper = QoderEventMapper()
|
||||
started = mapper.convert(
|
||||
AssistantMessage(
|
||||
content=[
|
||||
ToolUseBlock(
|
||||
id="tool-1",
|
||||
name="Bash",
|
||||
input={"command": "pwd"},
|
||||
),
|
||||
],
|
||||
model="qoder-test",
|
||||
),
|
||||
)
|
||||
completed = mapper.convert(
|
||||
UserMessage(
|
||||
content=[
|
||||
ToolResultBlock(
|
||||
tool_use_id="tool-1",
|
||||
content="workspace",
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
assert started[0].kind == HarnessEventKind.TOOL_STARTED
|
||||
assert started[0].data["arguments"] == {"command": "pwd"}
|
||||
assert completed[0].kind == HarnessEventKind.TOOL_COMPLETED
|
||||
assert completed[0].tool_name == "Bash"
|
||||
assert completed[0].text == "workspace"
|
||||
|
||||
|
||||
def test_maps_terminal_results() -> None:
|
||||
mapper = QoderEventMapper()
|
||||
|
||||
completed = mapper.convert(
|
||||
ResultMessage(
|
||||
subtype="success",
|
||||
duration_ms=1,
|
||||
duration_api_ms=1,
|
||||
is_error=False,
|
||||
num_turns=1,
|
||||
session_id="session-1",
|
||||
),
|
||||
)
|
||||
failed = mapper.convert(
|
||||
ResultMessage(
|
||||
subtype="error",
|
||||
duration_ms=1,
|
||||
duration_api_ms=1,
|
||||
is_error=True,
|
||||
num_turns=1,
|
||||
session_id="session-1",
|
||||
errors=["Authentication failed"],
|
||||
),
|
||||
)
|
||||
|
||||
assert completed[0].kind == HarnessEventKind.COMPLETED
|
||||
assert failed[0].kind == HarnessEventKind.ERROR
|
||||
assert failed[0].text == "Authentication failed"
|
||||
|
||||
|
||||
def test_converts_official_session_transcript_messages() -> None:
|
||||
messages = [
|
||||
SessionMessage(
|
||||
type="user",
|
||||
uuid="user-1",
|
||||
session_id="session-1",
|
||||
message={"content": "Fix the test"},
|
||||
),
|
||||
SessionMessage(
|
||||
type="assistant",
|
||||
uuid="assistant-1",
|
||||
session_id="session-1",
|
||||
message={
|
||||
"content": [
|
||||
{"type": "thinking", "thinking": "Inspecting"},
|
||||
{
|
||||
"type": "tool_use",
|
||||
"id": "tool-1",
|
||||
"name": "Read",
|
||||
"input": {"path": "test.py"},
|
||||
},
|
||||
{"type": "text", "text": "Fixed"},
|
||||
],
|
||||
},
|
||||
),
|
||||
]
|
||||
|
||||
history = [item for message in messages for item in history_items(message)]
|
||||
|
||||
assert [item.kind for item in history] == [
|
||||
HarnessHistoryKind.USER,
|
||||
HarnessHistoryKind.REASONING,
|
||||
HarnessHistoryKind.TOOL_CALL,
|
||||
HarnessHistoryKind.MESSAGE,
|
||||
]
|
||||
assert history[2].data["arguments"] == {"path": "test.py"}
|
||||
Reference in new issue
Block a user