repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
QwenPaw | src/qwenpaw/browser/control_link/cdp/adapter.py | .py | # -*- coding: utf-8 -*-
"""Direct-CDP ControlLink for attached and managed Chromium endpoints."""
# pylint: disable=arguments-renamed,unused-argument
from __future__ import annotations
import asyncio
import atexit
import contextlib
import logging
import uuid
from pathlib import Path
from typing import Any, Callable, ... | 680 | 24,230 |
QwenPaw | src/qwenpaw/browser/control_link/cdp/launch.py | .py | # -*- coding: utf-8 -*-
"""Owned Chromium launch helpers for the direct CDP backend."""
from __future__ import annotations
import asyncio
import logging
import subprocess
from pathlib import Path
from typing import Any
from ...errors import BrowserError, ErrorCategory
from ....utils.io_utils import run_sync_io
logg... | 117 | 3,601 |
QwenPaw | src/qwenpaw/browser/control_link/playwright/__init__.py | .py | # -*- coding: utf-8 -*-
"""Playwright control-link package placeholder."""
| 3 | 75 |
QwenPaw | src/qwenpaw/browser/control_link/playwright/adapter.py | .py | # -*- coding: utf-8 -*-
"""Playwright ControlLink multiplexer for raw browser mechanism facts."""
# pylint: disable=protected-access,unused-argument,unused-import
from __future__ import annotations
import atexit
import asyncio
import contextlib
import logging
import pathlib
import time
from typing import Any, Callab... | 963 | 33,998 |
QwenPaw | src/qwenpaw/browser/sdk/contracts.py | .py | # -*- coding: utf-8 -*-
"""Provider- and engine-independent Unified Browser SDK contracts."""
from __future__ import annotations
from dataclasses import dataclass, field
from enum import StrEnum
from typing import Any, Literal
# LocatorView deliberately exposes the complete SDK facade while delegating
# through the ... | 399 | 10,598 |
QwenPaw | src/qwenpaw/browser/sdk/tabs.py | .py | # -*- coding: utf-8 -*-
"""Pure helpers for SDK page references."""
from __future__ import annotations
from .contracts import PageRef
def active_page(pages: list[PageRef]) -> PageRef | None:
return next((page for page in pages if page.active), None)
def find_by_url(pages: list[PageRef], url: str) -> PageRef | ... | 14 | 393 |
QwenPaw | src/qwenpaw/browser/sdk/__init__.py | .py | # -*- coding: utf-8 -*-
"""Public Unified Browser SDK contracts."""
from typing import TYPE_CHECKING
from .contracts import (
ActionLevel,
ActionResult,
CapabilityVerdict,
Condition,
Context,
ContextVersion,
Coverage,
CoverageGap,
CurrentSurface,
DialogInfo,
FileChooserInfo... | 75 | 1,449 |
QwenPaw | src/qwenpaw/browser/sdk/facade.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
"""Browser orchestration facade for the Unified Browser SDK."""
from __future__ import annotations
import inspect
import asyncio
import uuid
from typing import TYPE_CHECKING, Callable, Literal, cast
from ..errors import BrowserError, ErrorCause, ErrorCategor... | 472 | 17,698 |
QwenPaw | src/qwenpaw/browser/sdk/execution_context.py | .py | # -*- coding: utf-8 -*-
"""Per-execution owner and cached Browser context."""
from __future__ import annotations
import contextvars
import asyncio
from dataclasses import dataclass
from typing import TYPE_CHECKING
from .contracts import Owner
if TYPE_CHECKING:
from .facade import Browser
@dataclass
class Execu... | 63 | 1,543 |
QwenPaw | src/qwenpaw/browser/sdk/page.py | .py | # -*- coding: utf-8 -*-
"""Playwright-shaped per-page operations for the Unified Browser SDK."""
# pylint: disable=protected-access
from __future__ import annotations
import asyncio
from typing import Any
from ..errors import BrowserError, ErrorCause, ErrorCategory
from .contracts import (
CurrentSurface,
F... | 184 | 6,263 |
QwenPaw | src/qwenpaw/browser/telemetry/trace.py | .py | # -*- coding: utf-8 -*-
"""Browser trace event recording (minimal logging scaffold)."""
from __future__ import annotations
import logging
from typing import Any
from ...utils.logging import sanitize_log_value
logger = logging.getLogger(__name__)
def record_browser_trace_event(*args: Any, **kwargs: Any) -> None:
... | 24 | 568 |
QwenPaw | src/qwenpaw/browser/telemetry/__init__.py | .py | # -*- coding: utf-8 -*-
"""Browser telemetry primitives."""
| 3 | 60 |
QwenPaw | src/qwenpaw/browser/execution/approval.py | .py | # -*- coding: utf-8 -*-
"""Structured semantic approval policy for the browser execution boundary."""
from __future__ import annotations
from dataclasses import dataclass
from enum import Enum
class Decision(Enum):
ALLOW = "allow"
CONFIRM = "confirm"
DENY = "deny"
HANDOFF = "handoff"
@dataclass(fr... | 31 | 597 |
QwenPaw | src/qwenpaw/browser/execution/kernel.py | .py | # -*- coding: utf-8 -*-
"""Wire-only browser execution kernel backed by owner-scoped subprocesses."""
from __future__ import annotations
from ...utils.io_utils import run_sync_io
from .subprocess_plane import SubprocessPlane
from .wire import ExecRequest, ExecResult, sweep_spill
def _worker_key(workspace_id: str, s... | 162 | 5,950 |
QwenPaw | src/qwenpaw/browser/execution/token.py | .py | # -*- coding: utf-8 -*-
"""Fingerprint-anchored, single-use approval tokens."""
from __future__ import annotations
import hashlib
import json
import secrets
import time
from dataclasses import dataclass
from typing import Any
from ..errors import BrowserError, ErrorCategory
def fingerprint(
*,
origin: str,... | 93 | 2,334 |
QwenPaw | src/qwenpaw/browser/execution/adjudicator.py | .py | # -*- coding: utf-8 -*-
"""Trusted-side approval mechanism for browser worker requests."""
from __future__ import annotations
from typing import Any
from .approval import Decision, Verdict
from .token import TokenBroker
class Adjudicator:
"""No-op trusted approver that exercises the token lifecycle.
Real ... | 43 | 1,175 |
QwenPaw | src/qwenpaw/browser/execution/wire.py | .py | # -*- coding: utf-8 -*-
"""Cross-plane wire contracts: deliberately independent from the SDK."""
from __future__ import annotations
import asyncio
import contextlib
import json
import os
import struct
import time
import uuid
from dataclasses import asdict, dataclass, field
from pathlib import Path
from typing import ... | 273 | 8,940 |
QwenPaw | src/qwenpaw/browser/execution/__init__.py | .py | # -*- coding: utf-8 -*-
"""Execution harness for the unified Browser SDK."""
| 3 | 77 |
QwenPaw | src/qwenpaw/browser/execution/subprocess_plane.py | .py | # -*- coding: utf-8 -*-
"""Persistent per-workspace subprocess transport for browser execution."""
from __future__ import annotations
import asyncio
import contextlib
import logging
import multiprocessing
import socket
from dataclasses import dataclass, field
from typing import Any, Callable, Mapping
from .._proc im... | 741 | 29,367 |
QwenPaw | src/qwenpaw/browser/execution/broker.py | .py | # -*- coding: utf-8 -*-
"""Per-operation broker gate for raw ControlLink calls (ADR D8)."""
from __future__ import annotations
from collections.abc import Awaitable, Callable, Mapping
from typing import Any
from ..errors import BrowserError, ErrorCategory, ErrorCause
from ..runtime.side_effects import SideEffectClass,... | 114 | 3,623 |
QwenPaw | src/qwenpaw/browser/execution/worker.py | .py | # -*- coding: utf-8 -*-
"""Subprocess worker that owns Browser SDK execution and its backend."""
from __future__ import annotations
import ast
import asyncio
import builtins as _builtins
import contextlib
import io
import inspect
import socket
from types import CodeType
from typing import Any, Callable, Mapping, cast... | 843 | 30,106 |
QwenPaw | src/qwenpaw/browser/runtime/managed_playwright.py | .py | # -*- coding: utf-8 -*-
"""Provision the driver-matched Playwright browser for Windows Desktop.
The packaged Windows application intentionally does not contain Chromium:
placing the full browser cache in the NSIS payload crosses NSIS's practical
single-file mapping limit. Instead, the frozen backend keeps an app-priva... | 186 | 6,107 |
QwenPaw | src/qwenpaw/browser/runtime/launch_resolve.py | .py | # -*- coding: utf-8 -*-
"""Resolve operator browser configuration into a concrete launch spec."""
from __future__ import annotations
import os
import sys
from typing import Any, Optional, Tuple
def resolve_launch(
config: Any,
*,
in_container: bool,
has_display: bool,
system_default: Tuple[Optio... | 96 | 3,146 |
QwenPaw | src/qwenpaw/browser/runtime/ownership_adapter.py | .py | # -*- coding: utf-8 -*-
"""Build owner-scoped runtime sessions through the raw ControlLink port."""
from __future__ import annotations
from typing import Any
from ..sdk.contracts import Owner
from .ownership import Session
async def build_session(
link: Any,
*,
context: str,
owner: Owner,
varia... | 54 | 1,658 |
QwenPaw | src/qwenpaw/browser/runtime/ownership.py | .py | # -*- coding: utf-8 -*-
"""Session ownership facts for a provider BrowserContext."""
from __future__ import annotations
from dataclasses import dataclass
from ..sdk.contracts import Owner
@dataclass
class Session:
"""One owner-scoped browser context and its currently active page."""
owner: Owner
varia... | 36 | 927 |
QwenPaw | src/qwenpaw/browser/runtime/__init__.py | .py | # -*- coding: utf-8 -*-
"""Browser runtime primitives."""
| 3 | 58 |
QwenPaw | src/qwenpaw/browser/runtime/engine.py | .py | # -*- coding: utf-8 -*-
"""Assembly root for unified-browser semantic runtime domains."""
from __future__ import annotations
from typing import Any
from ..errors import BrowserError, ErrorCategory, ErrorCause
from ..sdk.contracts import Context, Owner, PageRef, SessionStatus, Variant
from .links import availability,... | 355 | 12,153 |
QwenPaw | src/qwenpaw/browser/runtime/ports.py | .py | # -*- coding: utf-8 -*-
"""Browser variant control-link port (dependency-inversion anchor)."""
from __future__ import annotations
from typing import Any, Callable, Mapping, Protocol, runtime_checkable
EventSink = Callable[[Mapping[str, Any]], None]
@runtime_checkable
class ControlLink(Protocol):
"""Raw command... | 33 | 730 |
QwenPaw | src/qwenpaw/browser/runtime/identity.py | .py | # -*- coding: utf-8 -*-
"""Single-axis browser identity adjudication (user | avatar | guest)."""
from dataclasses import dataclass
_ENGINE_VARIANT = {
"auto": "playwright",
"launch": "playwright",
"managed_cdp": "cdp",
"connect_cdp": "cdp",
}
@dataclass(frozen=True)
class IdentityResolution:
"""... | 53 | 1,353 |
QwenPaw | src/qwenpaw/browser/runtime/links.py | .py | # -*- coding: utf-8 -*-
"""Variant-to-control-link registry."""
from __future__ import annotations
from typing import TYPE_CHECKING, Callable, Iterable
if TYPE_CHECKING:
from .ports import ControlLink
_local: list["ControlLink"] = []
_external: Callable[[], Iterable["ControlLink"]] = lambda: ()
def register_... | 65 | 1,836 |
QwenPaw | src/qwenpaw/browser/runtime/locator.py | .py | # -*- coding: utf-8 -*-
"""Lazy locator projection domain."""
from __future__ import annotations
from typing import Any
from ..sdk.contracts import (
ActionLevel,
ActionResult,
FrameLocatorView,
LocatorStep,
LocatorView,
Owner,
)
def _spec_to_wire(spec: tuple[LocatorStep, ...]) -> list[dict... | 156 | 4,220 |
QwenPaw | src/qwenpaw/browser/runtime/side_effects.py | .py | # -*- coding: utf-8 -*-
"""Read, state-change, and transmission taxonomy for execution policy."""
from __future__ import annotations
from enum import Enum
from typing import Any
class SideEffectClass(Enum):
READ = "read"
STATE_CHANGE = "state_change"
TRANSMIT = "transmit"
READ_ONLY_METHODS = frozenset... | 45 | 1,120 |
QwenPaw | src/qwenpaw/browser/runtime/observation/__init__.py | .py | # -*- coding: utf-8 -*-
"""Session-keyed projection of raw provider observations."""
from __future__ import annotations
from collections.abc import Mapping
import json
from typing import Any
from ...errors import BrowserError, ErrorCategory
from ...sdk.execution_context import record_perception
from ...sdk.contracts... | 269 | 8,458 |
QwenPaw | src/qwenpaw/harnesses/runtime.py | .py | # -*- coding: utf-8 -*-
"""Workspace-scoped third-party agent lifecycle and translation."""
from __future__ import annotations
import asyncio
import logging
import uuid
from collections.abc import AsyncGenerator
from datetime import datetime, timezone
from pathlib import Path
from typing import Any
from ..schemas im... | 390 | 14,012 |
QwenPaw | src/qwenpaw/harnesses/__init__.py | .py | # -*- coding: utf-8 -*-
"""Third-party agent runtime integrations."""
from .runtime import HarnessRuntime
__all__ = ["HarnessRuntime"]
| 7 | 137 |
QwenPaw | src/qwenpaw/harnesses/registry.py | .py | # -*- coding: utf-8 -*-
"""Third-party agent catalog and adapter factories."""
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from typing import Any
from .base import HarnessAdapter, MissingDependencyAdapter
from .codex.adapter import CodexAdapter
from .events import (
... | 233 | 7,624 |
QwenPaw | src/qwenpaw/harnesses/session.py | .py | # -*- coding: utf-8 -*-
"""Persist provider-neutral third-party turns in QwenPaw sessions."""
from __future__ import annotations
import json
import mimetypes
from pathlib import Path
from typing import Any
from agentscope.message import Msg
from agentscope.state import AgentState
from ..runtime._state_utils import ... | 353 | 11,732 |
QwenPaw | src/qwenpaw/harnesses/streaming.py | .py | # -*- coding: utf-8 -*-
"""Translate normalized third-party events into QwenPaw stream objects."""
from __future__ import annotations
import json
import uuid
from dataclasses import dataclass
from typing import Any
from ..schemas import (
AgentResponse,
ContentType,
DataContent,
FunctionCall,
Fun... | 219 | 6,265 |
QwenPaw | src/qwenpaw/harnesses/base.py | .py | # -*- coding: utf-8 -*-
"""Common third-party agent adapter contract."""
from __future__ import annotations
from abc import ABC, abstractmethod
from collections.abc import AsyncIterator
from pathlib import Path
from typing import Any
from .events import (
HarnessAttachment,
HarnessDiscoveredSkill,
Harnes... | 168 | 4,945 |
QwenPaw | src/qwenpaw/harnesses/events.py | .py | # -*- coding: utf-8 -*-
"""Provider-neutral third-party agent models."""
from __future__ import annotations
from enum import Enum
from pathlib import Path
from typing import Any
from pydantic import BaseModel, Field
class HarnessAttachmentKind(str, Enum):
"""Attachment kinds accepted by third-party agent adapt... | 184 | 4,589 |
QwenPaw | src/qwenpaw/harnesses/capabilities/models.py | .py | # -*- coding: utf-8 -*-
"""Provider-neutral runtime capability models."""
from __future__ import annotations
import hashlib
import json
from pathlib import Path
from typing import Literal
from pydantic import BaseModel, Field, SecretStr
MCPTransport = Literal["stdio", "streamable_http", "sse"]
MCPToolPolicy = Liter... | 116 | 3,527 |
QwenPaw | src/qwenpaw/harnesses/capabilities/__init__.py | .py | # -*- coding: utf-8 -*-
"""Shared runtime capabilities projected into third-party harnesses."""
from .models import (
HarnessMCPServerDefinition,
HarnessRuntimeCapabilities,
HarnessSkillDefinition,
)
from .resolver import HarnessCapabilityResolver
__all__ = [
"HarnessCapabilityResolver",
"HarnessM... | 17 | 407 |
QwenPaw | src/qwenpaw/harnesses/capabilities/resolver.py | .py | # -*- coding: utf-8 -*-
"""Resolve QwenPaw-managed capabilities for third-party harnesses."""
from __future__ import annotations
import asyncio
import hashlib
import json
from pathlib import Path
from types import SimpleNamespace
from typing import Any
from ...agents.skill_system import (
ensure_skills_initializ... | 291 | 9,472 |
QwenPaw | src/qwenpaw/harnesses/codex/app_server.py | .py | # -*- coding: utf-8 -*-
"""Async JSON-RPC client for the Codex app-server process."""
from __future__ import annotations
import asyncio
import json
import logging
import os
from collections.abc import AsyncIterator
from typing import Any, Awaitable, Callable
from .discovery import (
CodexBinaryResolution,
re... | 275 | 10,064 |
QwenPaw | src/qwenpaw/harnesses/codex/__init__.py | .py | # -*- coding: utf-8 -*-
"""Codex third-party agent integration."""
from .adapter import CodexAdapter
__all__ = ["CodexAdapter"]
| 7 | 130 |
QwenPaw | src/qwenpaw/harnesses/codex/discovery.py | .py | # -*- coding: utf-8 -*-
"""Locate standalone Codex CLI executables."""
from __future__ import annotations
import importlib
import os
import shutil
import sys
from collections.abc import Iterable
from dataclasses import dataclass
from pathlib import Path
from typing import Mapping
@dataclass(frozen=True)
class Codex... | 196 | 5,833 |
QwenPaw | src/qwenpaw/harnesses/codex/adapter.py | .py | # -*- coding: utf-8 -*-
"""Codex implementation of the third-party agent adapter."""
from __future__ import annotations
import asyncio
import json
from collections.abc import AsyncIterator
from pathlib import Path
from typing import Any
from ...app.approvals import (
ApprovalRequestSummary,
get_approval_serv... | 986 | 36,263 |
QwenPaw | src/qwenpaw/harnesses/codex/projection.py | .py | # -*- coding: utf-8 -*-
"""Project QwenPaw runtime capabilities into Codex configuration."""
from __future__ import annotations
import hashlib
import json
import re
from dataclasses import dataclass, field
from ..capabilities import HarnessRuntimeCapabilities
_ENV_KEY_PATTERN = re.compile(r"[^A-Za-z0-9_]")
_CONFIG_... | 162 | 5,234 |
QwenPaw | src/qwenpaw/harnesses/qoder/__init__.py | .py | # -*- coding: utf-8 -*-
"""Qoder third-party agent integration."""
from .adapter import QoderAdapter
__all__ = ["QoderAdapter"]
| 7 | 130 |
QwenPaw | src/qwenpaw/harnesses/qoder/discovery.py | .py | # -*- coding: utf-8 -*-
"""Cross-platform discovery for the Qoder CLI runtime."""
from __future__ import annotations
import importlib.util
import os
import shutil
import sys
from dataclasses import dataclass
from pathlib import Path
from typing import Mapping
@dataclass(frozen=True)
class QoderBinaryResolution:
... | 183 | 5,453 |
QwenPaw | src/qwenpaw/harnesses/qoder/event_mapper.py | .py | # -*- coding: utf-8 -*-
"""Translate Qoder SDK messages into provider-neutral harness events."""
from __future__ import annotations
import json
from typing import Any
from qoder_agent_sdk import (
AssistantMessage,
ResultMessage,
SDKPermissionDeniedMessage,
StreamEvent,
SystemMessage,
TextBlo... | 269 | 9,428 |
QwenPaw | src/qwenpaw/harnesses/qoder/adapter.py | .py | # -*- coding: utf-8 -*-
"""Qoder implementation of the third-party agent adapter."""
from __future__ import annotations
import asyncio
import base64
import json
import mimetypes
import os
import uuid
from collections.abc import AsyncIterator, Callable
from pathlib import Path
from typing import Any
from qoder_agent_... | 665 | 23,481 |
QwenPaw | src/qwenpaw/harnesses/qoder/projection.py | .py | # -*- coding: utf-8 -*-
"""Project QwenPaw runtime capabilities into Qoder SDK options."""
from __future__ import annotations
import json
import os
import shutil
import tempfile
from pathlib import Path
from typing import Any
from ..capabilities import HarnessRuntimeCapabilities
_PLUGIN_NAME = "qwenpaw-runtime"
d... | 128 | 3,563 |
QwenPaw | src/qwenpaw/market/__init__.py | .py | # -*- coding: utf-8 -*-
"""Skill market public API."""
from __future__ import annotations
from .categories import list_categories
from .providers.base import MARKET_SEARCH_TIMEOUT_S
from .schema import MarketResult, MarketSearchError, ProviderInfo
from .service import list_providers, search_market
__all__ = [
"... | 21 | 479 |
QwenPaw | src/qwenpaw/market/schema.py | .py | # -*- coding: utf-8 -*-
"""Unified schemas for the skill market.
"""
from __future__ import annotations
from dataclasses import dataclass
@dataclass(frozen=True)
class MarketResult:
source: str
slug: str
name: str
description: str | None
source_url: str
version: str | None
author: str | ... | 39 | 841 |
QwenPaw | src/qwenpaw/market/categories.py | .py | # -*- coding: utf-8 -*-
"""Category binding registry for the skill market.
Each logical category (one homepage tab) resolves per provider to either
a native filter code (modelscope today, qwenpaw once its codes are known)
or a localized search term used as fallback (clawhub / aliyun).
"""
from __future__ import annot... | 163 | 5,249 |
QwenPaw | src/qwenpaw/market/service.py | .py | # -*- coding: utf-8 -*-
"""Market search service.
"""
from __future__ import annotations
import asyncio
import inspect
import logging
from typing import Any
from .categories import resolve as resolve_category
from .providers import PROVIDERS
from .schema import MarketResult, MarketSearchError, ProviderInfo
logger ... | 130 | 3,818 |
QwenPaw | src/qwenpaw/market/providers/aliyun.py | .py | # -*- coding: utf-8 -*-
"""Aliyun AgentExplorer market provider.
REST + V3 ACS3-HMAC-SHA256 signing via `do_request_async`:
GET /openapi/skills/{skillName} GetSkillContent
GET /openapi/skills?keyword=&maxResults= SearchSkills
GET /openapi/categories ListCategories
"""
from __fu... | 320 | 9,782 |
QwenPaw | src/qwenpaw/market/providers/modelscope.py | .py | # -*- coding: utf-8 -*-
"""ModelScope market provider.
Public OpenAPI (no auth required for GET) via hub's shared async client:
GET https://www.modelscope.cn/openapi/v1/skills
?search=&page_number=&page_size=
"""
from __future__ import annotations
import urllib.parse
import httpx
from ...agents.skill... | 186 | 5,649 |
QwenPaw | src/qwenpaw/market/providers/__init__.py | .py | # -*- coding: utf-8 -*-
"""Market provider registry.
Each module under this package exposes a module-level `provider`
instance implementing `MarketProvider`.
"""
from __future__ import annotations
from .aliyun import provider as _aliyun_provider
from .base import MarketProvider
from .clawhub import provider as _claw... | 29 | 729 |
QwenPaw | src/qwenpaw/market/providers/qwenpaw.py | .py | # -*- coding: utf-8 -*-
"""QwenPaw plaza market provider.
Public OpenAPI (no auth required for GET) via hub's shared async client.
"""
from __future__ import annotations
import urllib.parse
import httpx
from ...agents.skill_system.hub import http_json_get
from ..schema import MarketResult
from .base import MARKE... | 176 | 5,283 |
QwenPaw | src/qwenpaw/market/providers/base.py | .py | # -*- coding: utf-8 -*-
"""Provider protocol and shared constants for market providers.
"""
from __future__ import annotations
from typing import Awaitable, Protocol, runtime_checkable
from ..schema import MarketResult
# Single source of truth for the budget any market provider has to answer a
# search call.
MARKE... | 44 | 1,217 |
QwenPaw | src/qwenpaw/market/providers/clawhub.py | .py | # -*- coding: utf-8 -*-
"""ClawHub market provider.
Two upstream endpoints via hub's shared async client:
GET /api/v1/search?q=&limit= keyword search (no stats)
GET /api/v1/skills?limit=&cursor=&sort= browse listing (carries
stats: downloads / stars / installs)
"""
from __future__ import a... | 168 | 5,300 |
QwenPaw | src/qwenpaw/_compat/__init__.py | .py | # -*- coding: utf-8 -*-
"""Compatibility shims for agentscope 1.x APIs.
Remaining contents:
- ``Msg.to_dict`` / ``Msg.from_dict`` / ``Msg.timestamp`` monkey-patches
(session files on disk still use the 1.x shape, and a couple of call
sites — e.g. ``/load_history`` — read them via ``Msg.from_dict``).
- ``message.py... | 53 | 1,614 |
QwenPaw | src/qwenpaw/_compat/message.py | .py | # -*- coding: utf-8 -*-
"""Legacy session deserialization for agentscope 1.x payloads.
The single load-bearing export is :func:`msg_from_dict`, used via the
``Msg.from_dict`` polyfill installed in ``_compat/__init__.py``. It
rehydrates session JSON written by 1.x — translating the old field
shape (``timestamp`` → ``c... | 248 | 9,380 |
QwenPaw | src/qwenpaw/backup/models.py | .py | # -*- coding: utf-8 -*-
"""Backup data models."""
from __future__ import annotations
from datetime import datetime, timezone
from typing import Literal, Optional
from pydantic import BaseModel, Field
from ._utils.meta import generate_backup_id
from ..exceptions import BackupConflictError, BackupValidationError
Back... | 164 | 5,588 |
QwenPaw | src/qwenpaw/backup/__init__.py | .py | # -*- coding: utf-8 -*-
"""Backup package public API."""
from ._ops.create import create_stream
from ._ops.storage import (
delete_backups,
export_backup,
get_backup,
import_backup,
list_backups,
)
from .orchestration import execute_restore
__all__ = [
"create_stream",
"list_backups",
"... | 22 | 422 |
QwenPaw | src/qwenpaw/backup/orchestration.py | .py | # -*- coding: utf-8 -*-
"""Top-level restore orchestration used by the HTTP router.
Separating orchestration from the core restore logic keeps the router thin
and makes the stop-agent -> restore -> restart-agent flow independently
testable.
"""
from __future__ import annotations
import asyncio
import logging
from col... | 188 | 7,044 |
QwenPaw | src/qwenpaw/backup/_ops/restore_helpers.py | .py | # -*- coding: utf-8 -*-
"""Pure-function helpers for restore operations.
These functions are free of ``self`` so they can be unit-tested in isolation.
They hold restore-specific config and workspace decisions so the large restore
operation remains mostly file staging and commit orchestration.
"""
from __future__ impor... | 193 | 7,150 |
QwenPaw | src/qwenpaw/backup/_ops/storage.py | .py | # -*- coding: utf-8 -*-
"""Backup storage operations: list, detail, delete, export, import."""
from __future__ import annotations
import asyncio
import json
import logging
import zipfile
from pathlib import Path
from .._utils.constants import (
PREFIX_WORKSPACES,
find_zip_path,
validate_backup_id,
zip... | 288 | 9,532 |
QwenPaw | src/qwenpaw/backup/_ops/restore.py | .py | # -*- coding: utf-8 -*-
"""Backup restore operations."""
from __future__ import annotations
import asyncio
import copy
import json
import logging
import shutil
import zipfile
from pathlib import Path
from .._utils.constants import (
PREFIX_CONFIG,
PREFIX_SECRETS,
PREFIX_SKILL_POOL,
PREFIX_WORKSPACES,
... | 739 | 24,881 |
QwenPaw | src/qwenpaw/backup/_ops/create.py | .py | # -*- coding: utf-8 -*-
"""Backup creation: sync and SSE streaming."""
from __future__ import annotations
import asyncio
import logging
import threading
import zipfile
from typing import Any, AsyncGenerator
from .._utils.constants import META_FILE, zip_path
from .._utils.meta import finalize_backup_meta
from .._utils... | 225 | 7,360 |
QwenPaw | src/qwenpaw/backup/_ops/create_helpers.py | .py | # -*- coding: utf-8 -*-
"""Helpers for creating backups: agents, global config, secrets, skill pool."""
from __future__ import annotations
import logging
import zipfile
from pathlib import Path
from typing import Any
from .._utils.constants import (
PREFIX_CONFIG,
PREFIX_SECRETS,
PREFIX_SKILL_POOL,
PR... | 200 | 6,210 |
QwenPaw | src/qwenpaw/backup/_utils/constants.py | .py | # -*- coding: utf-8 -*-
"""Shared constants and path helpers used across backup sub-modules."""
from __future__ import annotations
import json
import re
import zipfile
from pathlib import Path
from ...constant import BACKUP_DIR
META_FILE = "meta.json"
# Zip internal path prefixes – defined once to avoid scattered h... | 73 | 2,526 |
QwenPaw | src/qwenpaw/backup/_utils/safe_swap.py | .py | # -*- coding: utf-8 -*-
"""Crash-safe directory swap utilities for backup restore operations.
Three-phase protocol:
Phase 1 – Extract into a sibling ``.restore_tmp`` directory.
Phase 2 – Atomically rename old dst → ``.restore_old``, then tmp → dst.
Phase 3 – Remove ``.restore_old`` (old data is now disposable).
... | 531 | 16,730 |
QwenPaw | src/qwenpaw/backup/_utils/_mount_swap.py | .py | # -*- coding: utf-8 -*-
"""Mount-point fallback for backup restore directory swaps.
The normal restore path renames the destination directory away and then renames
the staged directory into place. That is the best path for ordinary
directories, but it fails for Docker volume mount points because the OS refuses
to ren... | 331 | 9,734 |
QwenPaw | src/qwenpaw/backup/_utils/meta.py | .py | # -*- coding: utf-8 -*-
"""Backup metadata helpers: system info collection and zip meta reading."""
from __future__ import annotations
import platform
import re
import zipfile
from datetime import datetime, timezone
from uuid import uuid4
from .constants import META_FILE
def get_qwenpaw_version() -> str:
"""Ret... | 61 | 1,833 |
QwenPaw | src/qwenpaw/backup/_utils/signing/digest.py | .py | # -*- coding: utf-8 -*-
"""Canonical HMAC digest helpers for backup zip archives.
The backup signature is a local trust marker, not a portable certificate.
It binds the archive bytes plus selected metadata to this installation's
private signing key so restore/import can distinguish local backups from
foreign or legacy... | 128 | 4,406 |
QwenPaw | src/qwenpaw/backup/_utils/signing/trust.py | .py | # -*- coding: utf-8 -*-
"""Trust decisions for locally signed backup archives.
Import and restore both need the same boundary check: a backup is either
already signed by this instance, or it requires an explicit user trust action
before being re-signed with the local key. Keeping that decision in the signing
package p... | 85 | 2,520 |
QwenPaw | src/qwenpaw/backup/_utils/signing/key.py | .py | # -*- coding: utf-8 -*-
"""Signing-key persistence for backup HMACs.
Each installation keeps a private key under BACKUP_DIR. The key is not placed
inside backups; it exists only to decide whether a backup was created or
trusted locally before restore/import applies sensitive files.
"""
from __future__ import annotatio... | 122 | 3,632 |
QwenPaw | src/qwenpaw/backup/_utils/signing/__init__.py | .py | # -*- coding: utf-8 -*-
"""Local backup signing utilities.
The signing key lives in ``BACKUP_DIR/.signing_key`` and is never included in
backup archives or restored from the secrets subsystem. A valid signature
covers canonical ``meta.json`` data (excluding the signature field itself) and
all non-directory zip entrie... | 34 | 883 |
QwenPaw | src/qwenpaw/backup/_utils/signing/resign.py | .py | # -*- coding: utf-8 -*-
"""Streaming zip rewriter for inserting a local backup signature.
Used after the user explicitly trusts a foreign or legacy backup. Rewriting
meta.json with a local signature turns that one archive into a locally trusted
backup without weakening signature checks for future imports/restores.
"""... | 69 | 2,011 |
QwenPaw | src/qwenpaw/modes/__init__.py | .py | # -*- coding: utf-8 -*-
"""Mode abstractions.
Each ``AgentMode`` packages the commands / tools / hooks / prompt
contributors that belong to one runtime mode (``coding`` / ``mission``
/ ``plan``). The base class and the ``ModeGatedHook`` mix-in provide
a single registration surface for mode authors.
"""
from __future... | 15 | 428 |
QwenPaw | src/qwenpaw/modes/base.py | .py | # -*- coding: utf-8 -*-
"""``AgentMode`` and ``ModeGatedHook`` base classes.
An ``AgentMode`` is a *bundle* of behavior: commands, tools, hooks and
prompt contributors that should appear together. ``setup(workspace)`` is
the single entry point that pushes those four pieces into the host
workspace's plugins / service_m... | 133 | 4,547 |
QwenPaw | src/qwenpaw/modes/coding/mixin.py | .py | # -*- coding: utf-8 -*-
"""Coding Mode mixin and tool collection helpers.
Provides:
- ``CodingModeMixin`` — mixin class that adds Coding Mode features
to a ReActAgent (system prompt injection, LSP / AST tools).
- ``collect_coding_tools()`` — standalone function used by
:class:`AgentBuilder` to collect coding tool... | 330 | 11,352 |
QwenPaw | src/qwenpaw/modes/coding/__init__.py | .py | # -*- coding: utf-8 -*-
"""Coding mode — self-contained ``AgentMode`` plugin.
All coding-mode logic lives under this package:
- ``CodingMode`` — the ``AgentMode`` entry point.
- ``CodingModeMixin`` — mixin that adds coding features to a ReActAgent.
- ``collect_coding_tools()`` — standalone tool-collection helper.
- `... | 54 | 1,497 |
QwenPaw | src/qwenpaw/modes/coding/hooks.py | .py | # -*- coding: utf-8 -*-
"""Coding mode hooks."""
from __future__ import annotations
from ..base import ModeGatedHook
from ...runtime.hooks import HookContext, HookResult
from ...runtime.phases import Phase
class ProjectDirInjectionHook(ModeGatedHook):
"""Stash ``project_dir`` into ``ctx.mode_state["coding"]``."... | 36 | 987 |
QwenPaw | src/qwenpaw/modes/custom_loop/__init__.py | .py | # -*- coding: utf-8 -*-
"""Public exports for declarative custom loop modes."""
from .loader import load_custom_loop_modes
from .mode import (
CustomLoopController,
DeclarativeLoopMode,
LoopModeActivationStore,
)
__all__ = [
"CustomLoopController",
"DeclarativeLoopMode",
"LoopModeActivationSto... | 17 | 357 |
QwenPaw | src/qwenpaw/modes/custom_loop/mode.py | .py | # -*- coding: utf-8 -*-
"""Runtime modes compiled from saved gate pipelines."""
from __future__ import annotations
from dataclasses import dataclass, field
from agentscope.message import Msg, TextBlock
from ...app.agent_context import get_current_session_id
from ...config.config import CustomLoopModeConfig
from ...lo... | 202 | 6,835 |
QwenPaw | src/qwenpaw/modes/custom_loop/loader.py | .py | # -*- coding: utf-8 -*-
"""Load saved custom loop modes into one workspace."""
from __future__ import annotations
import logging
from .mode import (
CustomLoopController,
DeclarativeLoopMode,
LoopModeActivationStore,
)
logger = logging.getLogger(__name__)
def load_custom_loop_modes(workspace: object) -... | 53 | 1,533 |
QwenPaw | src/qwenpaw/modes/goal/__init__.py | .py | # -*- coding: utf-8 -*-
"""Built-in /goal mode — persistent until rubric satisfied."""
from __future__ import annotations
from .goal_mode import GoalMode
__all__ = ["GoalMode"]
| 8 | 181 |
QwenPaw | src/qwenpaw/modes/goal/gates.py | .py | # -*- coding: utf-8 -*-
"""Goal-mode stop gates.
Separated from goal_mode.py for maintainability.
GoalTurnGate tracks cross-request goal turns (outer
loop), distinct from IterationGate which tracks
per-request ReAct iterations (inner loop).
"""
from __future__ import annotations
import logging
from typing import TYP... | 263 | 6,803 |
QwenPaw | src/qwenpaw/modes/goal/goal_mode.py | .py | # -*- coding: utf-8 -*-
"""GoalMode — QwenPaw's built-in persistent loop mode.
Similar to Codex /goal: user sets a goal, agent works
until the rubric grader confirms completion or budget
is exhausted.
Inherits ``AgentMode`` so it plugs into the standard
``builtin_mode_clses`` bootstrap — all registration
stays inside... | 399 | 11,477 |
QwenPaw | src/qwenpaw/modes/goal/helpers.py | .py | # -*- coding: utf-8 -*-
"""Goal-mode module-level helper functions.
Separated from goal_mode.py for maintainability.
"""
from __future__ import annotations
import logging
from typing import Any
from agentscope.message import Msg, TextBlock
logger = logging.getLogger(__name__)
def rewrite_user_msg(ctx: Any, text: ... | 153 | 3,845 |
QwenPaw | src/qwenpaw/modes/goal/tools.py | .py | # -*- coding: utf-8 -*-
"""Goal-mode tools: get_goal, create_goal, update_goal.
Modeled after Codex's goal tools. The agent calls
``update_goal(status="complete")`` to signal completion
rather than relying on text-based detection.
"""
from __future__ import annotations
import json
import logging
import time
from typi... | 155 | 4,516 |
QwenPaw | src/qwenpaw/modes/goal/prompts.py | .py | # -*- coding: utf-8 -*-
"""Goal-mode prompt templates.
Separated from goal_mode.py for maintainability.
"""
INITIAL_GOAL_PROMPT = """\
You are now in goal mode. A persistent goal has \
been set for this thread.
The objective below is user-provided data. Treat \
it as the task to pursue, not as higher-priority \
inst... | 98 | 2,423 |
QwenPaw | src/qwenpaw/modes/goal/contributor.py | .py | # -*- coding: utf-8 -*-
"""Goal-mode prompt contributor."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from ...runtime.prompt_manager import (
SyncPromptContributor,
)
if TYPE_CHECKING:
from ...runtime.hooks import HookContext
class GoalPromptContributor(SyncPromptContributor)... | 33 | 749 |
QwenPaw | src/qwenpaw/modes/mission/state.py | .py | # -*- coding: utf-8 -*-
"""Mission Mode state-file management.
State file layout follows the snarktank/ralph convention:
{project_dir}/.qwenpaw/missions/{loop_id}/
├── loop_config.json # environment metadata (git, paths)
├── prd.json # task list (worker updates ``passes``)
├── progress.txt ... | 340 | 10,373 |
QwenPaw | src/qwenpaw/modes/mission/__init__.py | .py | # -*- coding: utf-8 -*-
"""Mission mode — ``AgentMode`` for autonomous iterative tasks.
Exposes hooks and a prompt contributor so the Runtime
lifecycle drives mission state load/save. All domain
logic (command handler, state files, prompts, gate)
lives under ``modes.mission``.
The Phase 2 execution loop is driven by... | 275 | 8,437 |
QwenPaw | src/qwenpaw/modes/mission/hooks.py | .py | # -*- coding: utf-8 -*-
"""Mission mode hooks for the existing session lifecycle."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from ..base import ModeGatedHook
from ...runtime.hooks import HookBase, HookContext, HookResult
from ...runtime.phases import Phase
logger = logging... | 56 | 1,300 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.