源码快照 @ 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

This commit is contained in:
agent-radar
2026-09-01 20:01:50 +08:00
commit 1a3a4ccde1
4652 changed files with 1891610 additions and 0 deletions
@@ -0,0 +1,148 @@
# -*- coding: utf-8 -*-
"""Ultrawork gate — two-phase working/done gate."""
from __future__ import annotations
import asyncio
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Optional
from qwenpaw.loop.gates.base import StopAction, StopHandlerResult
from qwenpaw.loop.gates.loop_gate import LoopGate
from ..shared.constants import ULTRAWORK_MAX_ITERATIONS
from ..shared.fork_guard import forks_integrated, merge_blocked_continuation
from ..shared.role_prompts import FORK_MERGE_PROTOCOL
from ..shared.state import WorkflowState
from .prompts import build_continuation as _build_prompt
@dataclass
class _UltraworkState:
loop_dir: Path
workspace_dir: Path
active: bool = True
phase: str = "working"
iteration: int = 0
max_iterations: int = ULTRAWORK_MAX_ITERATIONS
blocked_on_merge: bool = False
class UltraworkGate(LoopGate):
"""Stop gate for Ultrawork parallel execution."""
@property
def name(self) -> str:
return "ultrawork"
@property
def priority(self) -> int:
return 50
def activate_for_work(self, workspace_dir: Path) -> Path:
"""Create state directory and activate."""
try:
from qwenpaw.agents.fork_project import begin_fork_scope
begin_fork_scope(workspace_dir)
except ImportError:
import logging
logging.getLogger(__name__).warning(
"begin_fork_scope unavailable; fork merge scope disabled",
)
wf = WorkflowState(workspace_dir, "ultrawork")
loop_dir = wf.create_instance()
state = _UltraworkState(
loop_dir=loop_dir,
workspace_dir=workspace_dir,
)
wf.write_state({"phase": "working", "iteration": 0})
self.activate(state)
return loop_dir
async def check(self, ctx: Any) -> Optional[StopHandlerResult]:
if isinstance(ctx, dict) and ctx.get("has_tool_calls"):
return StopHandlerResult(action=StopAction.BYPASS)
st: _UltraworkState | None = self._state()
if st is None:
return StopHandlerResult(
action=StopAction.BYPASS,
)
wf = WorkflowState.from_existing(
st.workspace_dir,
"ultrawork",
st.loop_dir,
)
data = await asyncio.to_thread(wf.read_state)
phase = data.get("phase", st.phase)
st.phase = phase
if phase == "done":
integrated = await asyncio.to_thread(
forks_integrated,
data,
st.workspace_dir,
)
if not integrated:
# Keep target phase "done"; do not rewind to working.
st.blocked_on_merge = True
st.phase = "done"
await asyncio.to_thread(
wf.update_state,
{
"merge_blocked": True,
"resume_phase": "done",
},
)
return StopHandlerResult(
action=StopAction.INTERRUPT_AND_CONTINUE,
reason="Ultrawork blocked: forks not integrated",
)
await asyncio.to_thread(
wf.update_state,
{"merge_blocked": False},
)
await asyncio.to_thread(wf.cleanup)
self.deactivate()
return StopHandlerResult(
action=StopAction.TERMINATE,
reason="Ultrawork completed",
)
st.blocked_on_merge = False
st.iteration += 1
if st.iteration > st.max_iterations:
await asyncio.to_thread(wf.cleanup)
self.deactivate()
return StopHandlerResult(
action=StopAction.TERMINATE,
reason=f"Reached max iterations ({st.max_iterations})",
)
await asyncio.to_thread(
wf.update_state,
{"iteration": st.iteration},
)
return StopHandlerResult(
action=StopAction.INTERRUPT_AND_CONTINUE,
reason="Ultrawork in progress",
)
def build_continuation(self) -> str:
"""Build Ultrawork continuation from gate state."""
st: _UltraworkState | None = self._state()
if st is None:
return ""
if st.blocked_on_merge:
return merge_blocked_continuation(FORK_MERGE_PROTOCOL)
return _build_prompt(
st.loop_dir,
iteration=st.iteration,
max_iterations=st.max_iterations,
)
@@ -0,0 +1,71 @@
# -*- coding: utf-8 -*-
"""UltraworkMode — parallel execution engine."""
from __future__ import annotations
import asyncio
import logging
from pathlib import Path
from typing import TYPE_CHECKING, Optional
from qwenpaw.runtime.slash_command_registry import CommandSpec
from ..shared.loop_ui_i18n import loop_command_metadata, loop_help_text
from ..shared.mode_base import OMPModeBase, info_msg, rewrite_user_msg
from .gate import UltraworkGate
if TYPE_CHECKING:
from typing import Any
from agentscope.message import Msg
logger = logging.getLogger(__name__)
_HELP = loop_help_text("ultrawork")
class UltraworkMode(OMPModeBase):
"""AgentMode for Ultrawork parallel execution."""
name = "ultrawork"
gate_cls = UltraworkGate
plugin_id = "__omp_ultrawork__"
handler_name = "ultrawork-stop-handler"
scope = "omp-ultrawork"
def commands(self) -> list[CommandSpec]:
return [
CommandSpec(
name="ultrawork",
handler=self._handler,
category="builtin",
help_text=_HELP,
metadata=loop_command_metadata("ultrawork"),
),
]
async def _handler(self, ctx: "Any", args: str) -> Optional["Msg"]:
task = (args or "").strip()
if not task or len(task) < 5 or task.lower() == "help":
return info_msg(_HELP)
workspace_dir = getattr(ctx, "workspace_dir", None)
if not workspace_dir:
return info_msg("ERROR: no workspace directory available.")
self.claim_workflow()
loop_dir = await asyncio.to_thread(
self._gate.activate_for_work,
Path(workspace_dir),
)
prompt = (
f"Ultrawork activated.\n"
f"Task: {task}\n"
f"State directory: {loop_dir}\n"
f"Decompose this task into independent sub-tasks and use "
f"spawn_subagent batch mode to execute them in parallel."
)
rewrite_user_msg(ctx, prompt)
logger.info("Ultrawork started: %s", loop_dir)
return None
@@ -0,0 +1,67 @@
# -*- coding: utf-8 -*-
"""Ultrawork continuation prompt templates."""
from __future__ import annotations
from pathlib import Path
from ..shared.constants import ULTRAWORK_MAX_ITERATIONS
from ..shared.role_prompts import (
fork_merge_instructions,
format_batch_item,
tools_literal,
)
def build_continuation(
loop_dir: Path,
iteration: int = 0,
max_iterations: int = ULTRAWORK_MAX_ITERATIONS,
) -> str:
"""Build the controller prompt for the working phase."""
item1 = format_batch_item(
"executor",
"<sub-task 1>",
fork=True,
)
item2 = format_batch_item(
"executor",
"<sub-task 2>",
fork=True,
)
# Shown so controllers know the canonical tool list source.
executor_tools = tools_literal("executor")
tools_note = (
"omit allowed_tools (inherit all)"
if executor_tools is None
else f"allowed_tools={executor_tools}"
)
return f"""\
You are the Ultrawork parallel execution controller.
Current phase: working
Iteration: {iteration}/{max_iterations}
Use the omp-roles skill for role tool/skill config
(executor: {tools_note}).
Execute:
1. Analyze the task and decompose it into independent sub-tasks.
2. For each sub-task, determine whether it depends on other sub-tasks.
3. Use spawn_subagent batch mode to dispatch all
independent sub-tasks at once:
spawn_subagent(task="", batch=[
{item1},
{item2},
...
])
4. Use check_agent_task to poll each sub-task status
(wait >= 30s between polls).
5. Integrate forked worker results:
{fork_merge_instructions()}
6. After successful merges, update {loop_dir}/state.json:
set forks_integrated=true.
7. Summarize results.
8. Update {loop_dir}/state.json: set phase="done".
The gate rejects phase="done" until forks_integrated=true."""