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 | e2e/pages/skills_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Skills page object.
Wraps all interactions on the Skills page and exposes business-level methods.
"""
from __future__ import annotations
import logging
from typing import Optional, List, Dict, Any
from playwright.sync_api import Page, Locator, expect, TimeoutError
from pages.base_... | 127 | 4,410 |
QwenPaw | e2e/pages/cronjobs_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw CronJobs page object.
Wraps all interactions on the CronJobs page and exposes business-level methods.
"""
from __future__ import annotations
import logging
from typing import Optional, List, Dict, Any
from playwright.sync_api import Page, Locator, expect, TimeoutError
from pages.b... | 383 | 17,057 |
QwenPaw | e2e/pages/mcp_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw MCP page object.
Wraps all interactions on the MCP page and exposes business-level methods.
"""
from __future__ import annotations
import logging
from typing import Optional, List, Dict, Any
from playwright.sync_api import Page, Locator, expect, TimeoutError
from pages.base_page i... | 140 | 5,086 |
QwenPaw | e2e/pages/environments_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Environments page object.
Wraps all interactions on the environment variables configuration page and
exposes business-level methods.
"""
from __future__ import annotations
import logging
from typing import Optional, List
from playwright.sync_api import Page, Locator, expect, Timeou... | 118 | 4,030 |
QwenPaw | e2e/pages/runtime_config_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Runtime Config page object.
Wraps all interactions on the Runtime Config (Agent Config) page and exposes business-level methods.
"""
from __future__ import annotations
import logging
from typing import Optional, List, Dict, Any
from playwright.sync_api import Page, Locator, expect,... | 380 | 14,665 |
QwenPaw | e2e/pages/voice_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Voice page object.
Wraps all interactions on the Voice page and exposes business-level methods.
"""
from __future__ import annotations
import logging
from typing import Optional
from playwright.sync_api import Page, Locator, expect, TimeoutError
from pages.base_page import BasePag... | 123 | 4,107 |
QwenPaw | e2e/pages/plugin_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Plugin Manager page object.
Wraps:
- Navigation to ``/plugin-manager``
- Tab and selector anchors for the installed / official plugin lists
API-only contract testing for /api/plugins/* endpoints lives in
``tests/integration/`` — this page object intentionally exposes only
UI-driven... | 140 | 5,132 |
QwenPaw | e2e/pages/__init__.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw E2E test framework - Pages module.
Exports all page object classes.
"""
from pages.base_page import BasePage
from pages.chat_page import ChatPage
from pages.channels_page import ChannelsPage
from pages.sessions_page import SessionsPage
from pages.cronjobs_page import CronJobsPage
fr... | 45 | 1,251 |
QwenPaw | e2e/pages/acp_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw ACP (Agent Communication Protocol) page object.
Wraps all interactions on the ACP configuration management page and exposes
business-level methods.
"""
from __future__ import annotations
import logging
from typing import Optional, List
from playwright.sync_api import Page, Locator,... | 370 | 14,398 |
QwenPaw | e2e/pages/inbox_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Inbox page object.
Inbox is a file-backed event store + per-run trace store + an in-memory
approval queue. The first two are seedable on disk so the full UI and
HTTP contract can be exercised without invoking the LLM. Approvals
are intentionally out of scope (no seed surface; would ... | 289 | 9,477 |
QwenPaw | e2e/pages/tools_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Tools page object.
Wraps all interactions on the tool management page and exposes business-level
methods.
"""
from __future__ import annotations
import logging
from typing import Optional, List
from playwright.sync_api import Page, Locator, expect, TimeoutError
from pages.base_pag... | 114 | 3,739 |
QwenPaw | e2e/pages/coding_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Coding Mode page object.
Wraps the Coding Mode entry / exit toggle, the project-select modal,
the IDE shell file tree / editor tabs, and a small set of backend API
helpers used by the test suite.
Cases covered:
- CODE-001 P0 ``test_enter_and_exit_coding_mode``
- CODE-002 P0 ``test... | 392 | 15,432 |
QwenPaw | e2e/pages/heartbeat_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Heartbeat page object.
Wraps all interactions on the Heartbeat page and exposes business-level methods.
"""
from __future__ import annotations
import logging
from typing import Optional, List, Dict, Any
from playwright.sync_api import Page, Locator, expect, TimeoutError
from pages... | 287 | 11,850 |
QwenPaw | e2e/pages/channels_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Channels page object.
Wraps all interactions on the Channels page and exposes business-level methods.
"""
from __future__ import annotations
import logging
from typing import Optional, List, Dict, Any
from playwright.sync_api import Page, Locator, expect, TimeoutError
from pages.b... | 590 | 23,704 |
QwenPaw | e2e/pages/skill_pool_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Skill Pool page object.
Wraps interactions on the Skill Pool page (``/skill-pool``), including the
skill auto-sync affordances added in upstream #5639:
- the per-card sync status badge (colored dot + status label),
- the hover-revealed auto-update quick-toggle button,
- the edit-dr... | 190 | 7,292 |
QwenPaw | e2e/pages/files_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Files page object.
Wraps all interactions on the Files page and exposes business-level methods.
"""
from __future__ import annotations
import logging
from typing import Optional, List, Dict, Any
from playwright.sync_api import Page, Locator, expect, TimeoutError
from pages.base_pa... | 125 | 4,215 |
QwenPaw | e2e/pages/token_usage_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Token Usage page object.
Wraps all interactions on the token usage statistics page and exposes
business-level methods.
"""
from __future__ import annotations
import logging
from typing import Optional, List
from playwright.sync_api import Page, Locator
from pages.base_page import ... | 116 | 2,910 |
QwenPaw | e2e/pages/models_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Models page object.
Wraps all interactions on the Models page and exposes business-level methods.
"""
from __future__ import annotations
import logging
from typing import Optional, List, Dict, Any
from playwright.sync_api import Page, Locator, expect, TimeoutError
from pages.base_... | 108 | 3,888 |
QwenPaw | e2e/pages/agents_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Agents management page object.
Wraps all interactions on the agent management page and exposes business-level
methods.
"""
from __future__ import annotations
import logging
from typing import Optional, List, Dict
from playwright.sync_api import Page, Locator, expect, TimeoutError
... | 580 | 21,558 |
QwenPaw | e2e/pages/backups_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Backups page object.
Wraps all interactions on the backup management page and exposes business-level
methods.
"""
from __future__ import annotations
import logging
from typing import Optional, List
from playwright.sync_api import Page, Locator, expect
from pages.base_page import B... | 352 | 13,907 |
QwenPaw | e2e/pages/sessions_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw Sessions page object.
Wraps all interactions on the Sessions page and exposes business-level methods.
"""
from __future__ import annotations
import logging
from typing import Optional, List, Dict, Any
from playwright.sync_api import Page, Locator, expect, TimeoutError
from pages.b... | 412 | 15,526 |
QwenPaw | e2e/pages/base_page.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw E2E test framework - Page Object base class.
Provides common page operations; every page object should inherit from this class.
"""
from __future__ import annotations
import logging
from typing import Optional, List, Any
from playwright.sync_api import Page, Locator, expect, Timeou... | 491 | 14,582 |
QwenPaw | e2e/utils/__init__.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw E2E Test Framework - Utilities Module
"""
from utils.helpers import (
take_screenshot,
save_video,
api_get,
api_post,
api_delete,
wait_for_condition,
retry_operation,
create_test_file,
read_test_data,
load_json_data,
assert_element_visible,... | 46 | 887 |
QwenPaw | e2e/utils/report_generator.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw E2E Test Report Generator
Automatically generates a Markdown test report from pytest results.
Split out from conftest.py for easier maintenance and reuse.
"""
from __future__ import annotations
import logging
from collections import defaultdict, OrderedDict
from datetime import da... | 311 | 10,683 |
QwenPaw | e2e/utils/helpers.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw E2E Test Framework - Utility Functions
Provides common test helper functions.
"""
from __future__ import annotations
import os
import json
import time
import logging
from pathlib import Path
from typing import Optional, Any, Dict, List
from datetime import datetime
from playwright.... | 440 | 11,145 |
QwenPaw | e2e/fixtures/__init__.py | .py | # -*- coding: utf-8 -*-
"""
QwenPaw E2E Test Framework - Pytest Fixtures
Provides browser, page, API client and other fixtures required by tests.
"""
from __future__ import annotations
import os
import logging
import pytest
from pathlib import Path
from typing import Generator, Optional
from playwright.sync_api impor... | 416 | 12,158 |
QwenPaw | e2e/mocks/plugin_market.py | .py | # -*- coding: utf-8 -*-
"""Targeted route mocks for the Plugin Market compatibility feature.
Unlike the ``register_all`` smoke mocks, these are meant to be layered on
top of a *real* backend inside integration tests: only the market catalog,
version probe and install endpoints are intercepted, because the market
catal... | 112 | 3,625 |
QwenPaw | e2e/mocks/sidebar_sessions.py | .py | # -*- coding: utf-8 -*-
"""Targeted route mock for the sidebar session-list date grouping.
The backend cannot backfill ``created_at`` / ``updated_at`` (patch forces
"now"), so date-group buckets (Today / Within 7 days / Within 30 days /
Earlier / Pinned) can only be exercised by intercepting the sidebar list
request `... | 90 | 2,938 |
QwenPaw | e2e/mocks/models.py | .py | # -*- coding: utf-8 -*-
"""Mock API responses for models/providers endpoints."""
from __future__ import annotations
import json
from playwright.sync_api import Page
_MOCK_PROVIDERS = [
{
"id": "openai",
"name": "OpenAI",
"builtin": True,
"enabled": True,
"models": [
... | 143 | 3,956 |
QwenPaw | e2e/mocks/heartbeat.py | .py | # -*- coding: utf-8 -*-
"""Mock API responses for heartbeat endpoints."""
from __future__ import annotations
import json
from playwright.sync_api import Page
_MOCK_HEARTBEAT = {
"enabled": True,
"every": 3600,
"target": "main",
"activeHours": None,
}
def register(page: Page):
"""Register heartbe... | 42 | 996 |
QwenPaw | e2e/mocks/__init__.py | .py | # -*- coding: utf-8 -*-
"""
Mock API modules for UI smoke tests.
Each module registers page.route() handlers for its API endpoints.
Call register_all(page) to set up all mocks at once.
"""
from __future__ import annotations
import json
from typing import List
from playwright.sync_api import Page
def _json_response... | 64 | 1,724 |
QwenPaw | e2e/mocks/channels.py | .py | # -*- coding: utf-8 -*-
"""Mock API responses for channels endpoints."""
from __future__ import annotations
import json
from playwright.sync_api import Page
_MOCK_CHANNELS = {
"console": {
"enabled": True,
"bot_prefix": "",
"show_tool_calls": True,
"show_tool_results": True,
... | 103 | 2,667 |
QwenPaw | e2e/mocks/agents.py | .py | # -*- coding: utf-8 -*-
"""Mock API responses for agents endpoints."""
from __future__ import annotations
import json
from playwright.sync_api import Page
_MOCK_AGENTS = [
{
"id": "default",
"name": "Default Agent",
"description": "The default agent",
"workspace_dir": "/workspace/d... | 105 | 3,109 |
QwenPaw | e2e/mocks/sessions.py | .py | # -*- coding: utf-8 -*-
"""Mock API responses for sessions (chats) endpoints."""
from __future__ import annotations
import json
from playwright.sync_api import Page
_MOCK_SESSIONS = [
{
"id": "session-1",
"session_id": "session-1",
"user_id": "admin",
"channel": "console",
... | 77 | 2,116 |
QwenPaw | e2e/mocks/auth.py | .py | # -*- coding: utf-8 -*-
"""Mock API responses for auth endpoints."""
from __future__ import annotations
import json
from playwright.sync_api import Page
def register(page: Page):
"""Register auth API route mocks."""
def _handle_auth_status(route):
route.fulfill(
status=200,
c... | 46 | 1,253 |
QwenPaw | e2e/mocks/security.py | .py | # -*- coding: utf-8 -*-
"""Mock API responses for security endpoints."""
from __future__ import annotations
import json
from playwright.sync_api import Page
_MOCK_TOOL_GUARD = {
"enabled": True,
"guarded_tools": None,
"denied_tools": [],
"custom_rules": [],
"disabled_rules": [],
"auto_denied_r... | 105 | 2,767 |
QwenPaw | e2e/mocks/backups.py | .py | # -*- coding: utf-8 -*-
"""Mock API responses for backups endpoints."""
from __future__ import annotations
import json
from playwright.sync_api import Page
_MOCK_BACKUPS = [
{
"id": "backup-1",
"name": "Initial Backup",
"description": "First backup",
"created_at": "2025-01-01T00:00... | 77 | 2,220 |
QwenPaw | e2e/mocks/environments.py | .py | # -*- coding: utf-8 -*-
"""Mock API responses for environments endpoints."""
from __future__ import annotations
import json
from playwright.sync_api import Page
_MOCK_ENVS = [
{"key": "OPENAI_API_KEY", "value": "sk-***"},
{"key": "APP_ENV", "value": "development"},
]
def register(page: Page):
"""Registe... | 40 | 969 |
QwenPaw | e2e/mocks/cron_jobs.py | .py | # -*- coding: utf-8 -*-
"""Mock API responses for cron jobs endpoints."""
from __future__ import annotations
import json
from playwright.sync_api import Page
_MOCK_CRON_JOBS = [
{
"id": "cron-1",
"name": "Daily Report",
"enabled": True,
"schedule": {
"type": "cron",
... | 87 | 2,572 |
QwenPaw | src/qwenpaw/exceptions.py | .py | # -*- coding: utf-8 -*-
"""QwenPaw exception definitions and converters."""
from typing import Any, Dict, Optional
# ==================== Base Exceptions ====================
class AppBaseException(Exception):
"""Top-level base for QwenPaw application exceptions.
Accepts ``error_code`` / ``detail`` / arbi... | 807 | 22,606 |
QwenPaw | src/qwenpaw/__main__.py | .py | # -*- coding: utf-8 -*-
"""Allow running QwenPaw via ``python -m qwenpaw``."""
from .cli.main import cli
if __name__ == "__main__":
cli() # pylint: disable=no-value-for-parameter
| 7 | 185 |
QwenPaw | src/qwenpaw/__init__.py | .py | # -*- coding: utf-8 -*-
import logging
import os
import time
from . import _compat as _compat_bootstrap
from .utils.logging import setup_logger
# Fallback before we can safely read canonical constant definitions.
LOG_LEVEL_ENV = "QWENPAW_LOG_LEVEL"
_bootstrap_err: Exception | None = None
try:
# Load persisted env... | 34 | 961 |
QwenPaw | src/qwenpaw/api_action.py | .py | # -*- coding: utf-8 -*-
"""``@api_action`` — three-way registrar for HTTP, CLI, and slash commands.
Auto-publishes a single method as an HTTP route, a CLI sub-command
and a slash command.
* :class:`ApiActionSpec` — frozen metadata attached by the decorator.
* :func:`api_action` — decorator that attaches ``_api_ac... | 131 | 4,556 |
QwenPaw | src/qwenpaw/__version__.py | .py | # -*- coding: utf-8 -*-
__version__ = "2.1.1b1"
| 4 | 49 |
QwenPaw | src/qwenpaw/schemas.py | .py | # -*- coding: utf-8 -*-
"""QwenPaw streaming envelope schema.
Defines the ``Message`` / ``Content`` / ``AgentRequest`` / ``AgentResponse``
types that ``stream_query`` produces and all channels consume. These are
qwenpaw's own envelope protocol — independent of agentscope's internal
event types.
"""
from __future__ im... | 296 | 8,532 |
QwenPaw | src/qwenpaw/constant.py | .py | # -*- coding: utf-8 -*-
import os
from pathlib import Path
from dotenv import load_dotenv
# Load .env file from project root before reading any env vars
_env_path = Path(__file__).resolve().parent.parent.parent / ".env"
if _env_path.exists():
load_dotenv(_env_path)
def _get_env(key: str, default: str = "") -> s... | 442 | 14,152 |
QwenPaw | src/qwenpaw/_version_compat.py | .py | # -*- coding: utf-8 -*-
"""Plugin–QwenPaw version compatibility check.
Semantics: left-closed, right-open interval ``>=min, <max``.
When ``max`` is not specified, it is derived from ``min`` as
``{major}.{minor+1}.0`` (all patch versions of the same minor).
NOTE: Upper-bound (``max``) enforcement is temporarily disab... | 79 | 2,537 |
QwenPaw | src/qwenpaw/security/__init__.py | .py | # -*- coding: utf-8 -*-
"""
Security framework for QwenPaw.
This package centralises all security-related mechanisms:
* **Tool-call guarding** (``qwenpaw.security.tool_guard``)
Pre-execution parameter scanning to detect dangerous tool usage
patterns (command injection, data exfiltration, etc.).
* **Skill scanning... | 21 | 893 |
QwenPaw | src/qwenpaw/security/secret_store.py | .py | # -*- coding: utf-8 -*-
"""Encrypted secret storage layer.
Provides transparent encryption/decryption for sensitive fields (API keys,
tokens, etc.) stored on disk. Secrets are encrypted with Fernet (AES-128-CBC
+ HMAC-SHA256) using a master key that is:
1. Stored in the OS keychain via the ``keyring`` library (prefe... | 467 | 15,017 |
QwenPaw | src/qwenpaw/security/tool_guard/approval.py | .py | # -*- coding: utf-8 -*-
"""Approval helpers for tool-guard mediated tool execution."""
from __future__ import annotations
import json
from enum import Enum
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from .models import ToolGuardResult
class ApprovalDecision(str, Enum):
"""Possible approval outcomes ... | 115 | 3,311 |
QwenPaw | src/qwenpaw/security/tool_guard/utils.py | .py | # -*- coding: utf-8 -*-
"""Tool-guard utility helpers.
* Configuration resolution – which tools to guard and which to deny.
* Structured logging for guard findings.
"""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING, Iterable
from ...constant import EnvVarLoader
if TYPE_CHECKING:... | 211 | 6,279 |
QwenPaw | src/qwenpaw/security/tool_guard/models.py | .py | # -*- coding: utf-8 -*-
"""Data models for tool-call guarding.
These models are intentionally separate from the skill-scanner models so
that the two sub-systems can evolve independently while sharing the same
conceptual vocabulary (severity, threat category, finding, result).
"""
from __future__ import annotations
fr... | 185 | 5,969 |
QwenPaw | src/qwenpaw/security/tool_guard/i18n.py | .py | # -*- coding: utf-8 -*-
"""Tool guard i18n bundles."""
from __future__ import annotations
_TOOL_GUARD_I18N: dict[str, dict[str, str]] = {
"en": {
"wait_title": "⏳ Waiting for approval",
"risk_detected": "⚠️ **Risk detected**",
"tool_blocked": "⛔ **Tool blocked**",
"timeout_title": ... | 185 | 9,020 |
QwenPaw | src/qwenpaw/security/tool_guard/__init__.py | .py | # -*- coding: utf-8 -*-
"""
Pre-tool-call guard framework for QwenPaw.
Scans tool execution parameters **before** the agent invokes a tool,
looking for dangerous patterns such as command injection, data
exfiltration, or access to sensitive files.
Architecture
~~~~~~~~~~~~
The guard framework mirrors the skill-scanne... | 59 | 1,767 |
QwenPaw | src/qwenpaw/security/tool_guard/execution_level.py | .py | # -*- coding: utf-8 -*-
"""Tool execution security levels for QwenPaw agent.
Defines different approval strategies for tool execution:
- STRICT: All tools require approval
- SMART: Low-risk tools auto-allowed, medium+ require approval
- AUTO: Only guarded_tools require approval (backward compatible)
- OFF: Tool guard ... | 80 | 2,409 |
QwenPaw | src/qwenpaw/security/tool_guard/engine.py | .py | # -*- coding: utf-8 -*-
"""Tool guard engine – orchestrates all registered guardians.
:class:`ToolGuardEngine` follows the same lazy-singleton pattern used by
the skill scanner. It discovers and runs all active :class:`BaseToolGuardian`
instances and aggregates their findings into a :class:`ToolGuardResult`.
Usage::... | 280 | 8,966 |
QwenPaw | src/qwenpaw/security/tool_guard/safety_checks.py | .py | # -*- coding: utf-8 -*-
"""Reusable safety check primitives.
Called by ACP permissions, ToolGuard guardians, and other security layers
to eliminate duplicated safety rule definitions.
"""
from __future__ import annotations
import os
import posixpath
import re
import shlex
from pathlib import Path, PurePath, PurePosix... | 1,097 | 38,671 |
QwenPaw | src/qwenpaw/security/tool_guard/guardians/file_guardian.py | .py | # -*- coding: utf-8 -*-
"""Path-based sensitive file guardian.
Blocks tool calls that target files explicitly listed in a sensitive-file set.
"""
from __future__ import annotations
import ntpath
import os
import re
import shlex
import uuid
from pathlib import Path
from typing import Any, Iterable
from ....config.con... | 508 | 17,483 |
QwenPaw | src/qwenpaw/security/tool_guard/guardians/__init__.py | .py | # -*- coding: utf-8 -*-
"""Abstract base class for all tool-call guardians.
Every guardian must subclass :class:`BaseToolGuardian` and implement
:meth:`guard`. The interface is intentionally minimal so that new
detection engines (e.g. LLM-based, semantic analysis) can be added
as drop-in plugins without touching the ... | 62 | 1,857 |
QwenPaw | src/qwenpaw/security/tool_guard/guardians/shell_evasion_guardian.py | .py | # -*- coding: utf-8 -*-
"""Quote-aware shell evasion and obfuscation detection guardian.
The checks detect obfuscation/evasion techniques that attempt to hide
malicious intent from simpler regex-only detection:
- Command substitution patterns ($(), ``, ${}, =(), <(), etc.)
- ANSI-C quoting ($'...') and locale quoting... | 593 | 20,259 |
QwenPaw | src/qwenpaw/security/tool_guard/guardians/rule_guardian.py | .py | # -*- coding: utf-8 -*-
"""YAML-signature rule-based tool-call guardian.
Loads security rules from YAML files (see ``rules/``) and performs fast
regex matching against the **string representation** of each tool
parameter value.
Rule format (one YAML file per threat category)::
- id: SHELL_PIPE_TO_EXEC
tool... | 893 | 32,385 |
QwenPaw | src/qwenpaw/security/skill_scanner/models.py | .py | # -*- coding: utf-8 -*-
"""Data models for skill scanning results.
"""
from __future__ import annotations
from dataclasses import dataclass, field
from datetime import datetime, timezone
from enum import Enum
from pathlib import Path
from typing import Any
# ---------------------------------------------------------... | 235 | 7,356 |
QwenPaw | src/qwenpaw/security/skill_scanner/scan_policy.py | .py | # -*- coding: utf-8 -*-
"""Scan policy: org-customisable allowlists and rule scoping.
Every organisation has a different security bar. A ``ScanPolicy``
captures what counts as benign, which rules fire on which file
types, which credentials are test-only, and so on.
Usage
-----
from qwenpaw.security.skill_scanner... | 476 | 17,779 |
QwenPaw | src/qwenpaw/security/skill_scanner/__init__.py | .py | # -*- coding: utf-8 -*-
"""
Skill security scanner for QwenPaw.
Scans skills for security threats before they are activated or installed.
Architecture
~~~~~~~~~~~~
The scanner follows a lightweight, extensible design:
* **BaseAnalyzer** - abstract interface every analyzer must implement.
* **PatternAnalyzer** - YAM... | 487 | 14,571 |
QwenPaw | src/qwenpaw/security/skill_scanner/scanner.py | .py | # -*- coding: utf-8 -*-
"""Skill security scanner orchestrator.
:class:`SkillScanner` discovers files in a skill directory, runs all
registered :class:`BaseAnalyzer` instances and collects their findings
into a single :class:`ScanResult`.
Usage::
scanner = SkillScanner() # default analyzer: pattern
... | 319 | 10,260 |
QwenPaw | src/qwenpaw/security/skill_scanner/analyzers/__init__.py | .py | # -*- coding: utf-8 -*-
"""Abstract base class for all security analyzers.
Every analyzer must subclass :class:`BaseAnalyzer` and implement
:meth:`analyze`. The interface is intentionally minimal so that
new detection engines (e.g. LLM-based, behavioural dataflow) can be
added as drop-in plugins without touching the ... | 90 | 2,508 |
QwenPaw | src/qwenpaw/security/skill_scanner/analyzers/pattern_analyzer.py | .py | # -*- coding: utf-8 -*-
"""YAML-signature pattern matching analyzer.
Loads security rules from YAML files (see ``rules/signatures/``) and
performs fast, line-based regex matching with a multiline fallback for
patterns that intentionally span newlines.
"""
from __future__ import annotations
import logging
import re
fr... | 393 | 14,320 |
QwenPaw | src/qwenpaw/sandbox/bubblewrap_sandbox.py | .py | # -*- coding: utf-8 -*-
"""Linux bubblewrap sandbox implementation.
Uses bubblewrap (bwrap) to construct a mount-namespace-based filesystem view.
This provides stronger filesystem isolation than Landlock alone:
- deny_paths are truly invisible (not mounted at all)
- /dev is a minimal synthetic devtmpfs (null, zero... | 282 | 9,677 |
QwenPaw | src/qwenpaw/sandbox/windows_elevated_sandbox.py | .py | # -*- coding: utf-8 -*-
"""Windows elevated sandbox implementation.
Uses a dedicated local user account with a WRITE_RESTRICTED token and WFP
firewall rules for process isolation. Read/execute access uses normal DACL
evaluation; only write operations check the restricting SID list.
Selected when ``allow_read_all=Tru... | 2,929 | 92,865 |
QwenPaw | src/qwenpaw/sandbox/macos_sandbox.py | .py | # -*- coding: utf-8 -*-
"""macOS Seatbelt sandbox implementation.
Uses ``sandbox-exec`` (the Seatbelt profile language) to construct a
deny-default filesystem + network policy for command isolation.
Architecture:
- Parent process compiles a Seatbelt ``.sb`` profile from
``SandboxConfig``.
- ``sandbox-ex... | 351 | 12,909 |
QwenPaw | src/qwenpaw/sandbox/linux_sandbox.py | .py | # -*- coding: utf-8 -*-
"""Linux Landlock sandbox implementation.
Uses Landlock LSM (Linux 5.13+) for kernel-level filesystem isolation.
Network restrictions require Landlock ABI v4 (kernel 6.7+).
Architecture:
- Parent process compiles Landlock rules from SandboxConfig
- Forks a child process that applies La... | 822 | 30,274 |
QwenPaw | src/qwenpaw/sandbox/__init__.py | .py | # -*- coding: utf-8 -*-
"""Sandbox — lightweight local execution isolation.
Supported modes:
- SEATBELT: macOS sandbox-exec kernel isolation.
- BUBBLEWRAP: Linux bubblewrap mount-namespace isolation (preferred).
- LANDLOCK: Linux Landlock LSM kernel isolation (5.13+, fallback).
- WINDOWS: Windows nativ... | 96 | 2,616 |
QwenPaw | src/qwenpaw/sandbox/windows_appcontainer_sandbox.py | .py | # -*- coding: utf-8 -*-
"""Windows AppContainer sandbox implementation.
Uses the Windows AppContainer isolation mechanism (SID ``S-1-15-2-*``)
for native process isolation. Only paths with explicit ACEs for the
container SID are accessible — all other filesystem access is denied.
Selected when ``allow_read_all=False`... | 1,025 | 34,293 |
QwenPaw | src/qwenpaw/sandbox/windows_unelevated_sandbox.py | .py | # -*- coding: utf-8 -*-
"""Windows sandbox shared infrastructure and unelevated sandbox.
Provides the shared foundation (base class, ctypes structures, SID/token/ACL
helpers, pipe decoding, process utilities) for all Windows sandbox backends,
plus the ``WindowsUnelevatedSandbox`` implementation.
``WindowsUnelevatedSa... | 2,519 | 84,815 |
QwenPaw | src/qwenpaw/sandbox/local_sandbox.py | .py | # -*- coding: utf-8 -*-
"""Local sandbox — abstract base + None passthrough.
Implementation layer for the sandbox package. Hosts the shared
:class:`LocalSandbox` ABC that every platform backend subclasses, plus the
:class:`NoneSandbox` passthrough used for trusted / no-isolation execution.
"""
from __future__ import ... | 256 | 9,475 |
QwenPaw | src/qwenpaw/sandbox/config.py | .py | # -*- coding: utf-8 -*-
"""Sandbox configuration, capability probing, and factory.
This is the entry point of the :mod:`qwenpaw.sandbox` package: it defines
the constraint vocabulary (modes, mounts, ports), probes platform sandbox
support, and provides the factory that maps a ``SandboxConfig`` to a
concrete backend.
... | 729 | 24,657 |
QwenPaw | src/qwenpaw/tauri/sidecar_logging.py | .py | # -*- coding: utf-8 -*-
"""Log capture for the Tauri Python sidecar runtime."""
from __future__ import annotations
from collections.abc import Iterable
from datetime import datetime
import faulthandler
import logging
import os
from pathlib import Path
import platform
import sys
from typing import TextIO
_LOG_FILE: Te... | 98 | 2,869 |
QwenPaw | src/qwenpaw/tauri/backend_guard.py | .py | # -*- coding: utf-8 -*-
"""Single-backend reconciliation for the Tauri desktop sidecar.
The desktop shell starts the Python backend as a sidecar and kills it on a
graceful exit. But on a crash, OOM, force-quit, or ``SIGKILL`` the exit
handler never runs, so the backend is orphaned. The next launch then starts
a fresh ... | 145 | 4,352 |
QwenPaw | src/qwenpaw/tauri/cli_entry.py | .py | # -*- coding: utf-8 -*-
"""PyInstaller entry point for the bundled QwenPaw CLI."""
from __future__ import annotations
import multiprocessing as mp
from qwenpaw.cli.main import cli
if __name__ == "__main__":
mp.freeze_support()
cli() # pylint: disable=no-value-for-parameter
| 13 | 287 |
QwenPaw | src/qwenpaw/tauri/__init__.py | .py | # -*- coding: utf-8 -*-
"""Tauri backend entry points and helpers."""
| 3 | 70 |
QwenPaw | src/qwenpaw/tauri/entry.py | .py | # -*- coding: utf-8 -*-
"""Tauri sidecar entry point for starting the Python backend."""
from __future__ import annotations
import json
import logging
import multiprocessing as mp
import os
import socket
import sys
from collections.abc import Sequence
import click
from qwenpaw.tauri.env import (
DESKTOP_APP_ENV... | 394 | 13,367 |
QwenPaw | src/qwenpaw/tauri/env.py | .py | # -*- coding: utf-8 -*-
"""Tauri sidecar environment variable helpers.
Keep this dependency-light: the Tauri entry imports it before qwenpaw.constant
has read import-time environment variables.
"""
import os
DESKTOP_APP_ENV = "QWENPAW_DESKTOP_APP"
DESKTOP_CORS_ORIGINS_ENV = "QWENPAW_CORS_ORIGINS"
DESKTOP_SHUTDOWN_TO... | 33 | 958 |
QwenPaw | src/qwenpaw/hooks/__init__.py | .py | # -*- coding: utf-8 -*-
"""Business-layer lifecycle hooks.
Concrete hooks registered at startup via ``builtin_hook_clses``:
- SessionLoadHook / SessionSaveHook — session persistence
- BootstrapHook — BOOTSTRAP.md first-interaction guidance
- SkillEnvHook / SkillEnvCleanupHook — skill env-var overrides
- ContextVarsSet... | 20 | 690 |
QwenPaw | src/qwenpaw/hooks/base.py | .py | # -*- coding: utf-8 -*-
"""``LifecycleHook`` base class.
Marker subclass of :class:`HookBase` used by always-on, cross-mode
hooks (session load/save, bootstrap, skill env, context-var cleanup,
cron triggers …). The distinction from
:class:`qwenpaw.modes.base.ModeGatedHook`:
* ``LifecycleHook`` — runs on every request... | 27 | 789 |
QwenPaw | src/qwenpaw/hooks/bootstrap/bootstrap_hook.py | .py | # -*- coding: utf-8 -*-
"""Bootstrap guidance hook.
Checks for BOOTSTRAP.md in the workspace and injects guidance into
the first user message before agent execution. Operates directly on
``ctx.input_msgs`` — does not require an agent instance.
"""
from __future__ import annotations
import logging
from pathlib impor... | 72 | 2,071 |
QwenPaw | src/qwenpaw/hooks/bootstrap/__init__.py | .py | # -*- coding: utf-8 -*-
from .bootstrap_hook import BootstrapHook
__all__ = ["BootstrapHook"]
| 5 | 95 |
QwenPaw | src/qwenpaw/hooks/error/__init__.py | .py | # -*- coding: utf-8 -*-
from .error_hook import CancelCleanupHook, ErrorNormalizeHook
__all__ = ["CancelCleanupHook", "ErrorNormalizeHook"]
| 5 | 141 |
QwenPaw | src/qwenpaw/hooks/error/error_hook.py | .py | # -*- coding: utf-8 -*-
"""Error handling hooks.
Exception normalization, error dump, and cancel cleanup as ON_ERROR hooks.
"""
from __future__ import annotations
import logging
from ..base import LifecycleHook
from ...runtime.hooks import HookContext, HookResult
from ...runtime.phases import Phase
logger = loggin... | 121 | 3,456 |
QwenPaw | src/qwenpaw/hooks/observability/__init__.py | .py | # -*- coding: utf-8 -*-
from .langfuse_hook import LangfuseTraceCleanupHook, LangfuseTraceHook
__all__ = ["LangfuseTraceCleanupHook", "LangfuseTraceHook"]
| 5 | 156 |
QwenPaw | src/qwenpaw/hooks/observability/langfuse_hook.py | .py | # -*- coding: utf-8 -*-
"""Langfuse trace lifecycle hooks.
Applies ``agent_trace_scope`` as a PRE_EXECUTE / FINALLY hook pair,
grouping each agent request into a single Langfuse trace.
"""
from __future__ import annotations
import logging
import uuid
from ..base import LifecycleHook
from ...runtime.hooks import Hook... | 92 | 2,922 |
QwenPaw | src/qwenpaw/hooks/request_setup/__init__.py | .py | # -*- coding: utf-8 -*-
from .agent_context_hook import AgentContextVarsSetupHook
from .contextvars_hook import ContextVarsSetupHook
from .media_hook import MediaProcessHook
__all__ = [
"AgentContextVarsSetupHook",
"ContextVarsSetupHook",
"MediaProcessHook",
]
| 11 | 274 |
QwenPaw | src/qwenpaw/hooks/request_setup/agent_context_hook.py | .py | # -*- coding: utf-8 -*-
"""Agent-scoped ContextVar setup hook.
Injects ContextVars that depend on the built agent (its toolkit and
state) so that in-tool nested calls — e.g. ``run_tool_batch`` invoking
other registered tools via ``Toolkit.call_tool`` — can resolve the
current toolkit / agent_state from context.
Separ... | 49 | 1,648 |
QwenPaw | src/qwenpaw/hooks/request_setup/contextvars_hook.py | .py | # -*- coding: utf-8 -*-
"""ContextVar setup hook.
Injects per-request ContextVars before agent execution so that tools
(shell, file_io, etc.) see correct workspace_dir, session_id, etc.
"""
from __future__ import annotations
import logging
from pathlib import Path
import uuid
from ..base import LifecycleHook
from .... | 161 | 5,892 |
QwenPaw | src/qwenpaw/hooks/request_setup/media_hook.py | .py | # -*- coding: utf-8 -*-
"""File/media processing hook.
Processes uploaded file and media blocks in input messages before
agent execution — downloads remote content to local media_dir and
rewrites blocks to file:// URLs.
"""
from __future__ import annotations
import logging
from ..base import LifecycleHook
from ...r... | 45 | 1,186 |
QwenPaw | src/qwenpaw/hooks/session/__init__.py | .py | # -*- coding: utf-8 -*-
from .session_hook import SessionLoadHook, SessionSaveHook
__all__ = ["SessionLoadHook", "SessionSaveHook"]
| 5 | 133 |
QwenPaw | src/qwenpaw/hooks/session/signals.py | .py | # -*- coding: utf-8 -*-
"""Short-lived signals shared by session lifecycle consumers."""
SESSION_SAVE_SUCCEEDED_KEY = "qwenpaw.session_save_succeeded"
__all__ = ["SESSION_SAVE_SUCCEEDED_KEY"]
| 7 | 194 |
QwenPaw | src/qwenpaw/hooks/session/session_hook.py | .py | # -*- coding: utf-8 -*-
"""Session load/save lifecycle hooks.
Loads persisted session state into ``ctx.session_state`` (PRE_AGENT_BUILD)
so the builder can inject it into the newly-constructed agent. Saves
agent state back to session storage after the response completes.
"""
from __future__ import annotations
import... | 116 | 3,890 |
QwenPaw | src/qwenpaw/hooks/cron/cron_hook.py | .py | # -*- coding: utf-8 -*-
"""Cron lifecycle hooks.
- CronContextHook: marks cron-originated requests so downstream hooks
can adjust behavior (e.g. BootstrapHook skips guidance injection).
- CronMemoryIsolateHook / CronMemoryRestoreHook: snapshot & clear
agent memory before execution, then restore the full history pl... | 135 | 4,332 |
QwenPaw | src/qwenpaw/hooks/cron/__init__.py | .py | # -*- coding: utf-8 -*-
from .cron_hook import CronContextHook
__all__ = ["CronContextHook"]
| 5 | 94 |
QwenPaw | src/qwenpaw/hooks/skill_env/__init__.py | .py | # -*- coding: utf-8 -*-
from .skill_env_hook import SkillEnvCleanupHook, SkillEnvHook
__all__ = ["SkillEnvCleanupHook", "SkillEnvHook"]
| 5 | 137 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.