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/agents/tools/_lsp_client.py
.py
# -*- coding: utf-8 -*- """Minimal LSP JSON-RPC client over subprocess stdio. Designed for short, synchronous queries from inside the agent's ``lsp`` tool: definition, references, hover, document / workspace symbols, implementation. No streaming, no incremental sync, no diagnostics — only correct request / response p...
481
14,851
QwenPaw
src/qwenpaw/agents/tools/_lsp_servers.py
.py
# -*- coding: utf-8 -*- """LSP server specs + discovery chain. Each supported language has a :class:`LspServerSpec` whose ``discover`` callable returns the argv used to spawn the language server, or ``None`` if no server is reachable. The Python entry has a guaranteed bundled fallback (``python -m pylsp``) so it is a...
160
4,966
QwenPaw
src/qwenpaw/agents/tools/make_skill_tools.py
.py
# -*- coding: utf-8 -*- """Tool backing the ``/make-skill`` flow.""" from __future__ import annotations import json import logging import re from agentscope.message import TextBlock from agentscope.tool import ToolChunk from agentscope.message import ToolResultState from ...config.context import get_current_workspa...
305
11,329
QwenPaw
src/qwenpaw/agents/tools/browser.py
.py
# -*- coding: utf-8 -*- """QwenPaw builtin tool binding for the unified Browser SDK.""" from __future__ import annotations from pathlib import Path from agentscope.tool import ToolChunk from ...runtime.tool_registry import tool_descriptor from ...browser.tool_entrypoint import ( _BROWSER_TOOL_DESCRIPTION, ...
35
949
QwenPaw
src/qwenpaw/agents/tools/get_token_usage.py
.py
# -*- coding: utf-8 -*- """Tool to query token usage statistics.""" from datetime import date, timedelta from agentscope.message import TextBlock from agentscope.tool import ToolChunk from agentscope.message import ToolResultState from ...runtime.tool_registry import tool_descriptor from ...token_usage import get_to...
97
3,108
QwenPaw
src/qwenpaw/agents/tools/shell.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=line-too-long """The shell command tool.""" import asyncio import locale import os import re import signal import subprocess import sys import tempfile import threading import time from dataclasses import dataclass, replace from pathlib import Path from ty...
1,222
42,061
QwenPaw
src/qwenpaw/agents/tools/run_tool_batch.py
.py
# -*- coding: utf-8 -*- """Run a batch of tool calls with action-result references and control flow.""" from __future__ import annotations import asyncio import ast import json import logging import operator import re import uuid from collections.abc import Callable from pathlib import Path from typing import Any fr...
1,260
40,996
QwenPaw
src/qwenpaw/agents/tools/deprecated_browser/browser_snapshot.py
.py
# -*- coding: utf-8 -*- """Build role snapshot + refs for the deprecated browser tool.""" import re from typing import Any INTERACTIVE_ROLES = frozenset( { "button", "link", "textbox", "checkbox", "radio", "combobox", "listbox", "menuitem", "...
249
6,876
QwenPaw
src/qwenpaw/agents/tools/deprecated_browser/__init__.py
.py
# -*- coding: utf-8 -*- """Deprecated structured-browser escape hatch. This package preserves the stable ``browser`` implementation while the experimental unified browser gathers beta feedback. It must not import the unified browser SDK; the tools package chooses exactly one implementation. """
8
298
QwenPaw
src/qwenpaw/agents/tools/deprecated_browser/browser_control.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=redefined-outer-name """Deprecated browser automation tool using Playwright. Single tool with action-based API matching browser MCP: start, stop, open, navigate, navigate_back, screenshot, snapshot, click, type, eval, evaluate, resize, console_messages, ha...
5,630
188,056
QwenPaw
src/qwenpaw/agents/context/types.py
.py
# -*- coding: utf-8 -*- """Shared data types for the context-management package.""" from __future__ import annotations from dataclasses import dataclass, field from typing import Any, Literal class ContextWindowUnfitError(RuntimeError): """Raised when context compaction cannot fit the model input window.""" ...
54
2,042
QwenPaw
src/qwenpaw/agents/context/__init__.py
.py
# -*- coding: utf-8 -*- """Pluggable context-management strategies. The default agent behavior is AgentScope-native compression; injecting a :class:`ContextManager` replaces it. The only built-in alternative today is the *scroll* strategy (durable ``history.db`` + an in-context eviction index + a sandboxed ``recall_hi...
241
9,668
QwenPaw
src/qwenpaw/agents/context/base.py
.py
# -*- coding: utf-8 -*- """The pluggable context-manager interface. A ``ContextManager`` is an injectable strategy that owns an agent's context management. :class:`~qwenpaw.agents.react_agent.QwenPawAgent` delegates its AgentScope hooks and provider-overflow recovery to it: * ``_save_to_context`` -> :meth:`on_save` (...
52
1,917
QwenPaw
src/qwenpaw/agents/context/visual_compression/__init__.py
.py
# -*- coding: utf-8 -*- """Request-time visual context compression package. The engineering implementation is based in part on pxpipe: https://github.com/teamchong/pxpipe """
8
177
QwenPaw
src/qwenpaw/agents/context/visual_compression/config.py
.py
# -*- coding: utf-8 -*- """Code-owned Visual Compact policy and compression presets.""" from __future__ import annotations from dataclasses import dataclass from types import MappingProxyType from typing import Literal, Mapping, cast VisualCompressionEffort = Literal["low", "medium", "high"] CANVAS_WIDTH = 1568 CAN...
120
3,184
QwenPaw
src/qwenpaw/agents/context/visual_compression/pipeline/request.py
.py
# -*- coding: utf-8 -*- """Provider-independent context planning and request transformation. The transformer works on deep copies of ``Msg`` objects. Images remain AgentScope ``DataBlock`` instances until the active formatter builds the wire. Tool documentation follows one provider-independent QwenPaw-native policy. "...
142
4,718
QwenPaw
src/qwenpaw/agents/context/visual_compression/pipeline/receipt.py
.py
# -*- coding: utf-8 -*- """Transform result and request-local exact recovery sources.""" from __future__ import annotations import hashlib from dataclasses import dataclass, field from typing import Any @dataclass class CompressionReceipt: """Exact sources and aggregate observability for accepted replacements."...
71
1,919
QwenPaw
src/qwenpaw/agents/context/visual_compression/pipeline/tool_schemas.py
.py
# -*- coding: utf-8 -*- """QwenPaw-native tool documentation compression. QwenPaw's built-in tools are ordinary Python functions. AgentScope derives their input schemas from signatures, type hints, defaults, and docstrings. The production policy below follows that contract instead of trying to be a general-purpose JSO...
104
3,624
QwenPaw
src/qwenpaw/agents/context/visual_compression/pipeline/__init__.py
.py
# -*- coding: utf-8 -*- """Pure request planning and transformation stages."""
3
79
QwenPaw
src/qwenpaw/agents/context/visual_compression/pipeline/static_context.py
.py
# -*- coding: utf-8 -*- """QwenPaw system/tool planning and atomic visual replacement.""" from __future__ import annotations import json import re from typing import Any from agentscope.message import Msg, TextBlock from ..config import ( CHARS_PER_TEXT_TOKEN_FALLBACK, EffortPreset, ) from ..rendering impor...
273
9,161
QwenPaw
src/qwenpaw/agents/context/visual_compression/pipeline/tool_results.py
.py
# -*- coding: utf-8 -*- """Successful tool-result selection, paging, and visual replacement.""" from __future__ import annotations import math import re from typing import Any from agentscope.message import Msg, TextBlock, ToolResultBlock, ToolResultState from ..config import ( CANVAS_PADDING, CANVAS_WIDTH,...
501
16,458
QwenPaw
src/qwenpaw/agents/context/visual_compression/pipeline/messages.py
.py
# -*- coding: utf-8 -*- """AgentScope message serialization and text normalization.""" from __future__ import annotations import base64 import json import re from dataclasses import dataclass from typing import TYPE_CHECKING, Any, Iterable from agentscope.message import ( Base64Source, DataBlock, Msg, ...
244
7,536
QwenPaw
src/qwenpaw/agents/context/visual_compression/pipeline/history.py
.py
# -*- coding: utf-8 -*- """Append-only, protocol-closed fixed-grid history planning.""" from __future__ import annotations import re from dataclasses import dataclass from typing import Any from agentscope.message import ( DataBlock, Msg, TextBlock, ThinkingBlock, ToolCallBlock, ToolResultBlo...
447
14,245
QwenPaw
src/qwenpaw/agents/context/visual_compression/pipeline/precision.py
.py
# -*- coding: utf-8 -*- """Deterministic exact-value precision lane for rendered text.""" from __future__ import annotations import math import re from dataclasses import dataclass from ..config import ( FACTSHEET_MAX_CHUNK_CHARS, FACTSHEET_MAX_DISTINCT, FACTSHEET_MAX_ENTRIES, FACTSHEET_MAX_SCAN_CHAR...
237
7,284
QwenPaw
src/qwenpaw/agents/context/visual_compression/pipeline/budget.py
.py
# -*- coding: utf-8 -*- """Token counting and visual-versus-text request budget policy.""" from __future__ import annotations import math from dataclasses import dataclass from typing import TYPE_CHECKING from ..config import ( CANVAS_MAX_HEIGHT, CANVAS_PADDING, CHARS_PER_TEXT_TOKEN_FALLBACK, IMAGE_C...
160
4,680
QwenPaw
src/qwenpaw/agents/context/visual_compression/rendering/renderer.py
.py
# -*- coding: utf-8 -*- """Deterministic text layout and PNG rendering.""" from __future__ import annotations import base64 import hashlib import re import struct import sys import zlib from array import array from dataclasses import dataclass, field, replace from functools import lru_cache from pathlib import Path f...
821
24,613
QwenPaw
src/qwenpaw/agents/context/visual_compression/rendering/__init__.py
.py
# -*- coding: utf-8 -*- """Production surface for deterministic visual-context rendering.""" from .renderer import ( RenderedPage, estimate_text_pages, measure_content_columns, page_count_for_text, prepare_render_text, render_cache_info, render_rows_per_page, render_text_pages, ) __all...
25
539
QwenPaw
src/qwenpaw/agents/context/visual_compression/runtime/middleware.py
.py
# -*- coding: utf-8 -*- """AgentScope pre-model hook for request-time visual compression.""" from __future__ import annotations import asyncio import logging import time from concurrent.futures import ThreadPoolExecutor from functools import partial from typing import TYPE_CHECKING, Any, Callable from agentscope.mid...
236
7,949
QwenPaw
src/qwenpaw/agents/context/visual_compression/runtime/__init__.py
.py
# -*- coding: utf-8 -*- """Framework adapters and request-local visual-compression state."""
3
93
QwenPaw
src/qwenpaw/agents/context/visual_compression/runtime/recovery.py
.py
# -*- coding: utf-8 -*- """Turn-local source storage and exact visual-context recovery tool.""" from __future__ import annotations from collections.abc import Awaitable, Callable import logging import time from typing import Any from agentscope.message import TextBlock, ToolResultState from agentscope.tool import To...
518
17,617
QwenPaw
src/qwenpaw/agents/context/scroll/_as_internals.py
.py
# -*- coding: utf-8 -*- """Thin adapter over the AgentScope 2.0 *private* methods the scroll manager depends on. AgentScope 2.0 is alpha; ``_prepare_model_input`` and ``_split_context_for_compression`` are underscore-prefixed internals that may be renamed or have their signatures changed between releases. Routing ever...
36
1,334
QwenPaw
src/qwenpaw/agents/context/scroll/eviction_index.py
.py
# -*- coding: utf-8 -*- """The eviction index — an in-context, tier-capped odometer of evicted turns. The whole index lives in the prompt as ONE placeholder, so the model always *sees the map* of what it evicted. The structure is a stack of tiers: Tier 0 (bottom) the newest evictions; each block lists its turns ...
422
16,324
QwenPaw
src/qwenpaw/agents/context/scroll/manager.py
.py
# -*- coding: utf-8 -*- """ScrollContextManager — write-through + eviction-index context management. The strategy form of the design in ``CONTEXT_MANAGEMENT.html``: instead of subclassing the agent, it is injected into :class:`QwenPawAgent` and drives the two delegated hooks. * :meth:`on_save` — every live turn is pe...
2,026
82,336
QwenPaw
src/qwenpaw/agents/context/scroll/__init__.py
.py
# -*- coding: utf-8 -*- """Scroll context strategy: durable history + eviction index + recall REPL."""
3
103
QwenPaw
src/qwenpaw/agents/context/scroll/memoryspace.py
.py
# -*- coding: utf-8 -*- """The model's SQLite working surface inside ``recall_history_python``. Self-contained (stdlib only) so the sandboxed REPL cell can import it by bare module name, without the rest of qwenpaw on the path. ``main`` is an in-memory database the model owns read/write — its scratch space. The durab...
2,016
77,149
QwenPaw
src/qwenpaw/agents/context/scroll/sync.py
.py
# -*- coding: utf-8 -*- """Import raw ``sessions/*.json`` conversation history into ``history.db``. Conversations are saved one-file-per-session under ``{workspace}/sessions/``. Under the ``scroll`` strategy, durable recall lives in ``history.db``, populated live by :class:`ScrollContextManager`. Messages from before ...
908
31,792
QwenPaw
src/qwenpaw/agents/context/scroll/repl.py
.py
# -*- coding: utf-8 -*- """The sandboxed ``recall_history_python`` recall tool. This is raw conversation-history recall — the agent's own recorded turns across its sessions (verbatim). The model recalls history by running Python here, not by scrolling back. Each call runs a fresh process (Option A: stateless cells) in...
304
12,699
QwenPaw
src/qwenpaw/agents/context/scroll/continuation_summary.py
.py
# -*- coding: utf-8 -*- """Plain-text continuation summaries with code-managed durable provenance. The model is deliberately asked for ordinary Markdown, never structured output or JSON. Parsing into this internal representation happens locally and fails closed, so provider/model formatting quirks cannot break compact...
756
30,482
QwenPaw
src/qwenpaw/agents/context/scroll/history.py
.py
# -*- coding: utf-8 -*- """Durable, file-backed conversation history shared across sessions.""" from __future__ import annotations import json import logging import sqlite3 import sys import threading from collections.abc import Sequence from datetime import datetime, timezone from pathlib import Path from typing imp...
761
30,804
QwenPaw
src/qwenpaw/agents/context/scroll/serialize.py
.py
# -*- coding: utf-8 -*- """Serialize AgentScope ``Msg`` blocks into ``conversation_history`` rows.""" from __future__ import annotations import re from copy import deepcopy from dataclasses import dataclass from typing import Any from agentscope.message import Msg from ....constant import QWENPAW_MESSAGE_TAG_KEY fro...
348
12,981
QwenPaw
src/qwenpaw/agents/context/scroll/prompt.py
.py
# -*- coding: utf-8 -*- """System-prompt block taught to the agent under the scroll strategy. Injected only when ``strategy == "scroll"`` (see :class:`qwenpaw.runtime.prompt_contributors.ScrollContextContributor`). It teaches what the model must know for the eviction index to be useful: how to write useful milestone h...
204
13,060
QwenPaw
src/qwenpaw/agents/context/scroll/recall_tool.py
.py
# -*- coding: utf-8 -*- """The structured ``recall_history`` recall tool. The parameterized front door to durable history: ``expand`` / ``search`` / ``recall_tool`` cover the overwhelming share of recall calls, and none of them needs model-authored code — each is a bound, read-only SQL query over :class:`.memoryspace....
1,061
38,425
QwenPaw
src/qwenpaw/agents/utils/media_token_estimate.py
.py
# -*- coding: utf-8 -*- """Context-ring token estimates for inlined media payloads. Local heuristic only — not a billing formula. Never treats base64 bytes as text tokens (``len(data) // 4``). """ from __future__ import annotations import base64 import hashlib import io import math import re import wave EMPTY_MEDIA...
184
4,955
QwenPaw
src/qwenpaw/agents/utils/as_msg_handler.py
.py
# -*- coding: utf-8 -*- # pylint: disable=too-many-branches,too-many-statements """Token counting and block-level statistics for AgentScope messages. Used by :func:`context_stats.format_history_str` to render the ``/history`` command output with per-message token breakdowns. """ import json import logging from agent...
258
9,835
QwenPaw
src/qwenpaw/agents/utils/context_stats.py
.py
# -*- coding: utf-8 -*- """Token accounting helpers for ``/history`` and context inspection.""" from __future__ import annotations from typing import TYPE_CHECKING from .as_msg_handler import AsMsgHandler from .estimate_token_counter import EstimatedTokenCounter if TYPE_CHECKING: from agentscope.state import Age...
85
2,661
QwenPaw
src/qwenpaw/agents/utils/tool_message_utils.py
.py
# -*- coding: utf-8 -*- """Tool message validation and sanitization utilities. This module ensures tool_call/tool_result messages are properly paired and ordered to prevent API errors. Supports both dict blocks (1.x ``type="tool_use"``) and Pydantic ``ToolCallBlock``/``ToolResultBlock`` objects (2.0 ``type="tool_call...
648
22,599
QwenPaw
src/qwenpaw/agents/utils/setup_utils.py
.py
# -*- coding: utf-8 -*- """Setup and initialization utilities for agent configuration. This module handles copying markdown configuration files to the working directory. """ import logging import shutil from pathlib import Path from ...constant import SUPPORTED_AGENT_LANGUAGES logger = logging.getLogger(__name__) _...
273
8,065
QwenPaw
src/qwenpaw/agents/utils/__init__.py
.py
# -*- coding: utf-8 -*- """ Agent utilities package. This package provides utilities for agent operations: - audio_transcription: Audio file transcription - estimate_token_counter: Estimated token counting - file_handling: File download and management - message_processing: Message content manipulation and validation -...
115
3,061
QwenPaw
src/qwenpaw/agents/utils/message_processing.py
.py
# -*- coding: utf-8 -*- """Message processing utilities for agent communication. This module handles: - File and media block processing - Message content manipulation - Message validation """ import asyncio import logging import os import urllib.parse from pathlib import Path from typing import Optional from agentsco...
601
19,289
QwenPaw
src/qwenpaw/agents/utils/registry.py
.py
# -*- coding: utf-8 -*- """Generic registry for registering and retrieving implementations.""" from typing import Callable, Generic, Type, TypeVar T = TypeVar("T") class Registry(Generic[T]): """Generic registry for registering and retrieving implementations. Example: from qwenpaw.agents.memory.bas...
48
1,427
QwenPaw
src/qwenpaw/agents/utils/estimate_token_counter.py
.py
# -*- coding: utf-8 -*- """Estimated token counter implementation.""" # Standalone class — qwenpaw's context manager only calls # ``await counter.count(text)``, so duck typing is enough; no base # class needed. class EstimatedTokenCounter: """Token counter that estimates tokens using character-based calculation. ...
41
1,419
QwenPaw
src/qwenpaw/agents/utils/file_handling.py
.py
# -*- coding: utf-8 -*- """File handling utilities for downloading and managing files. This module provides utilities for: - Downloading files from base64 encoded data - Downloading files from URLs - Managing download directories - Reading text files with encoding fallback for cross-platform compatibility """ import o...
402
13,363
QwenPaw
src/qwenpaw/agents/utils/as_msg_stat.py
.py
# -*- coding: utf-8 -*- """Schema definitions for AgentScope message statistics.""" from pydantic import BaseModel, Field from ...constant import TRUNCATION_NOTICE_MARKER _DEFAULT_MAX_BLOCK_TEXT_PREVIEW_LENGTH = 100 _DEFAULT_MAX_FORMATTER_TEXT_LENGTH = 1000 class AsBlockStat(BaseModel): """Statistics and metad...
133
4,505
QwenPaw
src/qwenpaw/agents/utils/token_counter.py
.py
# -*- coding: utf-8 -*- """Token counting utilities.""" from typing import TYPE_CHECKING from .estimate_token_counter import EstimatedTokenCounter if TYPE_CHECKING: from qwenpaw.config.config import AgentProfileConfig def get_token_counter( agent_config: "AgentProfileConfig", ) -> EstimatedTokenCounter: ...
27
714
QwenPaw
src/qwenpaw/agents/utils/message_request_normalizer.py
.py
# -*- coding: utf-8 -*- """Normalization helpers for provider chat payloads. The persisted session history remains AgentScope ``Msg`` objects. For provider requests we build a normalized copy before formatting so request-time repair and multimodal downgrade logic does not mutate the stored conversation state. """ fro...
273
10,031
QwenPaw
src/qwenpaw/agents/utils/audio_transcription.py
.py
# -*- coding: utf-8 -*- """Audio transcription utility. Transcribes audio files to text using either: - An OpenAI-compatible ``/v1/audio/transcriptions`` endpoint (Whisper API), or - The locally installed ``openai-whisper`` Python library (Local Whisper). Transcription is only attempted when explicitly enabled via th...
318
9,675
QwenPaw
src/qwenpaw/agents/utils/image_freezing.py
.py
# -*- coding: utf-8 -*- """Freeze local image references into immutable message content.""" from __future__ import annotations import base64 from io import BytesIO from pathlib import Path from typing import Any from urllib.parse import unquote, urlparse from urllib.request import url2pathname from agentscope.messag...
225
7,325
QwenPaw
src/qwenpaw/agents/skills/__init__.py
.py
# -*- coding: utf-8 -*- """Agent skills directory."""
3
54
QwenPaw
src/qwenpaw/agents/skills/pptx-zh/scripts/thumbnail.py
.py
"""Create thumbnail grids from PowerPoint presentation slides. Creates a grid layout of slide thumbnails for quick visual analysis. Labels each thumbnail with its XML filename (e.g., slide1.xml). Hidden slides are shown with a placeholder pattern. Usage: python thumbnail.py input.pptx [output_prefix] [--cols N] ...
307
9,630
QwenPaw
src/qwenpaw/agents/skills/pptx-zh/scripts/clean.py
.py
"""Remove unreferenced files from an unpacked PPTX directory. Usage: python clean.py <unpacked_dir> Example: python clean.py unpacked/ This script removes: - Orphaned slides (not in sldIdLst) and their relationships - [trash] directory (unreferenced files) - Orphaned .rels files for deleted resources - Unreferen...
287
9,583
QwenPaw
src/qwenpaw/agents/skills/pptx-zh/scripts/add_slide.py
.py
"""Add a new slide to an unpacked PPTX directory. Usage: python add_slide.py <unpacked_dir> <source> The source can be: - A slide file (e.g., slide2.xml) - duplicates the slide - A layout file (e.g., slideLayout2.xml) - creates from layout Examples: python add_slide.py unpacked/ slide2.xml # Duplicates s...
196
6,872
QwenPaw
src/qwenpaw/agents/skills/pptx-zh/scripts/office/unpack.py
.py
"""Unpack Office files (DOCX, PPTX, XLSX) for editing. Extracts the ZIP archive, pretty-prints XML files, and optionally: - Merges adjacent runs with identical formatting (DOCX only) - Simplifies adjacent tracked changes from same author (DOCX only) Usage: python unpack.py <office_file> <output_dir> [options] Ex...
133
4,052
QwenPaw
src/qwenpaw/agents/skills/pptx-zh/scripts/office/validate.py
.py
""" Command line tool to validate Office document XML files against XSD schemas and tracked changes. Usage: python validate.py <path> [--original <original_file>] [--auto-repair] [--author NAME] The first argument can be either: - An unpacked directory containing the Office document XML files - A packed Office fi...
112
3,668
QwenPaw
src/qwenpaw/agents/skills/pptx-zh/scripts/office/soffice.py
.py
""" Helper for running LibreOffice (soffice) in environments where AF_UNIX sockets may be blocked (e.g., sandboxed VMs). Detects the restriction at runtime and applies an LD_PRELOAD shim if needed. Usage: from office.soffice import run_soffice, get_soffice_cmd, get_soffice_env # Option 1 – run soffice direct...
219
6,607
QwenPaw
src/qwenpaw/agents/skills/pptx-zh/scripts/office/pack.py
.py
"""Pack a directory into a DOCX, PPTX, or XLSX file. Validates with auto-repair, condenses XML formatting, and creates the Office file. Usage: python pack.py <input_directory> <output_file> [--original <file>] [--validate true|false] Examples: python pack.py unpacked/ output.docx --original input.docx py...
160
4,991
QwenPaw
src/qwenpaw/agents/skills/pptx-zh/scripts/office/validators/redlining.py
.py
""" Validator for tracked changes in Word documents. """ import subprocess import tempfile import zipfile from pathlib import Path class RedliningValidator: def __init__(self, unpacked_dir, original_docx, verbose=False, author="Claude"): self.unpacked_dir = Path(unpacked_dir) self.original_docx ...
248
8,918
QwenPaw
src/qwenpaw/agents/skills/pptx-zh/scripts/office/validators/pptx.py
.py
""" Validator for PowerPoint presentation XML files against XSD schemas. """ import re from .base import BaseSchemaValidator class PPTXSchemaValidator(BaseSchemaValidator): PRESENTATIONML_NAMESPACE = ( "http://schemas.openxmlformats.org/presentationml/2006/main" ) ELEMENT_RELATIONSHIP_TYPES = ...
276
9,824
QwenPaw
src/qwenpaw/agents/skills/pptx-zh/scripts/office/validators/docx.py
.py
""" Validator for Word document XML files against XSD schemas. """ import os import random import re import tempfile import zipfile import defusedxml.minidom import lxml.etree from .base import BaseSchemaValidator class DOCXSchemaValidator(BaseSchemaValidator): WORD_2006_NAMESPACE = "http://schemas.openxmlfor...
448
16,401
QwenPaw
src/qwenpaw/agents/skills/pptx-zh/scripts/office/validators/base.py
.py
""" Base validator with common validation logic for document files. """ import re from pathlib import Path import defusedxml.minidom import lxml.etree class BaseSchemaValidator: IGNORED_VALIDATION_ERRORS = [ "hyphenationZone", "purl.org/dc/terms", ] UNIQUE_ID_REQUIREMENTS = { "...
848
32,651
QwenPaw
src/qwenpaw/agents/skills/pptx-zh/scripts/office/helpers/merge_runs.py
.py
"""Merge adjacent runs with identical formatting in DOCX. Merges adjacent <w:r> elements that have identical <w:rPr> properties. Works on runs in paragraphs and inside tracked changes (<w:ins>, <w:del>). Also: - Removes rsid attributes from runs (revision metadata that doesn't affect rendering) - Removes proofErr ele...
200
5,567
QwenPaw
src/qwenpaw/agents/skills/pptx-zh/scripts/office/helpers/simplify_redlines.py
.py
"""Simplify tracked changes by merging adjacent w:ins or w:del elements. Merges adjacent <w:ins> elements from the same author into a single element. Same for <w:del> elements. This makes heavily-redlined documents easier to work with by reducing the number of tracked change wrappers. Rules: - Only merges w:ins with ...
198
5,754
QwenPaw
src/qwenpaw/agents/skills/docx-en/scripts/comment.py
.py
"""Add comments to DOCX documents. Usage: python comment.py unpacked/ 0 "Comment text" python comment.py unpacked/ 1 "Reply text" --parent 0 Text should be pre-escaped XML (e.g., &amp; for &, &#x2019; for smart quotes). After running, add markers to document.xml: <w:commentRangeStart w:id="0"/> ... comme...
319
10,694
QwenPaw
src/qwenpaw/agents/skills/docx-en/scripts/accept_changes.py
.py
"""Accept all tracked changes in a DOCX file using LibreOffice. Requires LibreOffice (soffice) to be installed. """ import argparse import logging import shutil import subprocess import tempfile from pathlib import Path from office.soffice import get_soffice_cmd, get_soffice_env logger = logging.getLogger(__name__)...
139
4,228
QwenPaw
src/qwenpaw/agents/skills/docx-en/scripts/office/soffice.py
.py
""" Helper for running LibreOffice (soffice) in environments where AF_UNIX sockets may be blocked (e.g., sandboxed VMs). Detects the restriction at runtime and applies an LD_PRELOAD shim if needed. Usage: from office.soffice import run_soffice, get_soffice_cmd, get_soffice_env # Option 1 – run soffice direct...
221
6,772
QwenPaw
src/qwenpaw/agents/skills/xlsx-en/scripts/recalc.py
.py
""" Excel Formula Recalculation Script Recalculates all formulas in an Excel file using LibreOffice """ import json import os import platform import subprocess import sys from pathlib import Path from office.soffice import get_soffice_cmd, get_soffice_env from openpyxl import load_workbook MACRO_DIR_MACOS = "~/Libr...
210
6,526
QwenPaw
src/qwenpaw/agents/memory/agent_md_manager.py
.py
# -*- coding: utf-8 -*- """Agent Markdown manager for reading and writing markdown files in working and memory directories.""" from datetime import datetime, timezone from pathlib import Path from typing import Literal from ..utils.file_handling import read_text_file_with_encoding_fallback from ...config.config impor...
322
11,857
QwenPaw
src/qwenpaw/agents/memory/__init__.py
.py
# -*- coding: utf-8 -*- """Memory management module for QwenPaw agents.""" from typing import TYPE_CHECKING from .agent_md_manager import AgentMdManager from .base_memory_manager import BaseMemoryManager from .reme_light_memory_manager import ReMeLightMemoryManager from .adbpg_memory_manager import ( ADBPGMemoryM...
73
2,120
QwenPaw
src/qwenpaw/agents/memory/reme_light_memory_manager.py
.py
# -*- coding: utf-8 -*- """ReMe-backed memory manager for agents. The public class and registry key keep the historical ``ReMeLight`` naming so existing agent configs continue to work, but the implementation delegates to ReMe's application/job framework. """ import asyncio import hashlib import logging import os from...
1,256
46,349
QwenPaw
src/qwenpaw/agents/memory/reme_config.py
.py
# -*- coding: utf-8 -*- """Embedded ReMe application configuration for QwenPaw memory. ReMe's standalone CLI normally loads YAML such as ``reme/config/default.yaml`` or ``reme/config/qwenpaw.yaml``. QwenPaw embeds ReMe as an in-process application, so it passes an equivalent configuration dict directly to ``reme.appl...
724
27,777
QwenPaw
src/qwenpaw/agents/memory/embedding_model.py
.py
# -*- coding: utf-8 -*- """AgentScope embedding model construction and connectivity checks.""" from __future__ import annotations import asyncio import math import time from dataclasses import dataclass from typing import Any from agentscope.credential import ( DashScopeCredential, GeminiCredential, Olla...
156
4,917
QwenPaw
src/qwenpaw/agents/memory/dummy.py
.py
# -*- coding: utf-8 -*- """No-op memory manager – disables all memory functionality.""" from collections.abc import Callable from agentscope.middleware import MiddlewareBase from agentscope.tool import ToolChunk from .base_memory_manager import BaseMemoryManager, memory_registry @memory_registry.register("none") cl...
43
1,293
QwenPaw
src/qwenpaw/agents/memory/adbpg_client.py
.py
# -*- coding: utf-8 -*- """REST client for ADBPG memory storage.""" import json import logging from dataclasses import dataclass import httpx logger = logging.getLogger(__name__) @dataclass class ADBPGConfig: """ADBPG REST API configuration.""" rest_base_url: str rest_api_key: str search_timeout: ...
157
4,809
QwenPaw
src/qwenpaw/agents/memory/adbpg_prompts.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """ADBPG memory guidance prompts.""" ADBPG_MEMORY_GUIDANCE_ZH = """\ ## 记忆 每次会话都是全新的。你的长期记忆存储在云端数据库(ADBPG)中,对话中的重要信息会自动提取并保存。 ### 🧠 云端长期记忆 - 你的对话内容会**自动保存**到云端长期记忆中 - 系统会自动从对话中提取事实、偏好、决策等关键信息 - 无需手动写入文件,记忆提取由服务端 LLM 完成 - 记忆跨会话持久化 — 即使会话结束,记忆仍然保留 ### 🔍 检索记忆 回答关于过往工作、决...
71
3,275
QwenPaw
src/qwenpaw/agents/memory/adbpg_memory_manager.py
.py
# -*- coding: utf-8 -*- """ADBPG Memory Manager for QwenPaw agents. Provides long-term memory backed by AnalyticDB for PostgreSQL (ADBPG). Context compaction is handled natively by AgentScope's ``Agent.compress_context()``; tool result pruning is handled by ``ToolResultPruningMiddleware``. This class only manages long...
431
14,720
QwenPaw
src/qwenpaw/agents/memory/base_memory_manager.py
.py
# -*- coding: utf-8 -*- """Abstract base class for memory managers.""" import asyncio import json import logging import uuid from abc import ABC, abstractmethod from collections.abc import Callable from copy import deepcopy from datetime import datetime, timezone from typing import Any from agentscope.message import ...
695
24,398
QwenPaw
src/qwenpaw/agents/memory/prompts.py
.py
# -*- coding: utf-8 -*- """Memory guidance prompts.""" MEMORY_GUIDANCE = { "zh": ( "# 长期记忆\n\n" "工作目录下保存着你的个人知识库。当问题涉及用户过去的事实、偏好、" "决策或经验时,先使用 `memory_search` 检索相关信息。检索结果中会包含" "相关内容片段及其文件路径;如果片段不足以回答问题,再使用 `read_file` " "按路径渐进式展开,只读取当前任务所需的内容。" ), "en": ( "# ...
34
1,375
QwenPaw
src/qwenpaw/agents/memory/proactive/proactive_prompts.py
.py
# -*- coding: utf-8 -*- """Prompt templates for proactive conversation feature.""" PROACTIVE_TASK_EXTRACTION_PROMPT = ( "You are given the user's recent session contexts and current screen " "content (if provided) in a reversed order.\n" "\n" "Your job:\n" "1. Find 1–3 likely high-level goals the u...
74
2,989
QwenPaw
src/qwenpaw/agents/memory/proactive/proactive_types.py
.py
# -*- coding: utf-8 -*- """Type definitions for proactive conversation feature.""" from dataclasses import dataclass from typing import Optional from datetime import datetime @dataclass class ProactiveConfig: """Configuration for proactive feature.""" enabled: bool = False idle_minutes: int = 30 las...
38
841
QwenPaw
src/qwenpaw/agents/memory/proactive/proactive_trigger.py
.py
# -*- coding: utf-8 -*- """Trigger logic for proactive conversation feature.""" import asyncio import logging from datetime import datetime, timezone from typing import TYPE_CHECKING, Dict, Optional, Any from .proactive_types import ProactiveConfig from .proactive_responder import generate_proactive_response from .pr...
338
10,592
QwenPaw
src/qwenpaw/agents/memory/proactive/__init__.py
.py
# -*- coding: utf-8 -*- """Proactive memory submodule for CoPaw agents.""" from .proactive_types import ( ProactiveConfig, ProactiveTask, ProactiveQueryResult, ) from .proactive_trigger import ( enable_proactive_for_session, disable_proactive_for_session, proactive_trigger_loop, proactive_t...
31
753
QwenPaw
src/qwenpaw/agents/memory/proactive/proactive_responder.py
.py
# -*- coding: utf-8 -*- """Responder logic for proactive conversation feature.""" import asyncio import logging import re from datetime import datetime, timezone from typing import TYPE_CHECKING, Optional, List, Dict import aiohttp from agentscope.agent import Agent, ReActConfig from agentscope.message import Msg, T...
389
12,035
QwenPaw
src/qwenpaw/agents/memory/proactive/proactive_utils.py
.py
# -*- coding: utf-8 -*- """Utility functions for proactive messaging features.""" from copy import deepcopy import json import logging from datetime import datetime, timedelta, timezone from typing import TYPE_CHECKING, List, Optional, Any from agentscope.agent import Agent from agentscope.message import Msg, TextBlo...
449
13,644
QwenPaw
src/qwenpaw/agents/skill_system/hub.py
.py
# -*- coding: utf-8 -*- """Skills hub client and install helpers.""" from __future__ import annotations import asyncio import base64 import contextvars import io import json import logging import os import re import time import zipfile from collections import OrderedDict from contextlib import asynccontextmanager, con...
2,344
72,938
QwenPaw
src/qwenpaw/agents/skill_system/models.py
.py
# -*- coding: utf-8 -*- """Shared models and constants for the skill system.""" from __future__ import annotations from dataclasses import dataclass from pathlib import Path from typing import Any from pydantic import BaseModel, Field from ...exceptions import SkillConflictError ALL_SKILL_ROUTING_CHANNELS = [ ...
81
1,760
QwenPaw
src/qwenpaw/agents/skill_system/store.py
.py
# -*- coding: utf-8 -*- """Local skill storage, manifest, metadata, and filesystem helpers.""" from __future__ import annotations import hashlib import io import json import logging import os import re import shutil import tempfile import time import zipfile from collections.abc import Callable, Iterator from context...
1,141
35,846
QwenPaw
src/qwenpaw/agents/skill_system/__init__.py
.py
# -*- coding: utf-8 -*- """Skill system exports.""" from .models import ( SkillConflictError, SkillInfo, ) from .pool_service import SkillPoolService, run_pool_auto_update_sync from .registry import ( apply_skill_config_env_overrides, ensure_skill_pool_initialized, ensure_skills_initialized, re...
48
1,220
QwenPaw
src/qwenpaw/agents/skill_system/registry.py
.py
# -*- coding: utf-8 -*- """Skill registries, builtin sync, runtime resolution, and env overrides.""" from __future__ import annotations import hashlib import json import logging import os import re import threading from collections.abc import Iterator from contextlib import contextmanager from pathlib import Path fro...
1,525
51,368
QwenPaw
src/qwenpaw/agents/skill_system/pool_service.py
.py
# -*- coding: utf-8 -*- """Shared skill-pool lifecycle service.""" from __future__ import annotations import hashlib import logging import shutil from pathlib import Path from typing import Any from ...exceptions import SkillsError from ..utils.file_handling import read_text_file_with_encoding_fallback from .models ...
1,264
43,749
QwenPaw
src/qwenpaw/agents/skill_system/workspace_service.py
.py
# -*- coding: utf-8 -*- """Workspace-scoped skill lifecycle service.""" from __future__ import annotations import shutil from pathlib import Path from typing import Any from ...exceptions import SkillsError from ..utils.file_handling import read_text_file_with_encoding_fallback from .models import SkillInfo from .re...
782
26,733
QwenPaw
src/qwenpaw/app/driver_config_service.py
.py
# -*- coding: utf-8 -*- """Application service for persisted Driver configuration.""" from __future__ import annotations import asyncio import logging from pathlib import Path from typing import Any from fastapi import HTTPException from ..drivers.capabilities import DriverRuntimeInfo from ..drivers.contracts impor...
227
7,592