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
plugins/apps/qwenpaw-creator/scripts/build_example_archive.py
.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=too-many-branches,too-many-statements """Build an OSS-hosted inspiration example archive from a real Project. Only ``backend/examples/manifest.json`` ships inside the plugin; the archive itself is uploaded to OSS and downloaded on de...
754
27,614
QwenPaw
plugins/apps/qwenpaw-creator/scripts/dev_watch.py
.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """dev_watch.py — Watch creator sources and hot-sync into a running QwenPaw. Frontend: expects `vite build --watch` (started by dev.sh) to keep rebuilding ui/dist incrementally; any dist change is rsynced into the installed plugin copy. Plugin static files are read from d...
175
6,055
QwenPaw
plugins/apps/qwenpaw-creator/backend/main.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=wrong-import-order,wrong-import-position,ungrouped-imports """QwenPaw Creator — PawApp backend entry point. Exports a :class:`PawApp` instance named ``app`` (also aliased as ``plugin``) which the PluginLoader discovers and registers. All Creator REST route...
351
11,601
QwenPaw
plugins/apps/qwenpaw-creator/backend/dev_main.py
.py
# -*- coding: utf-8 -*- # pylint: disable=wrong-import-position,ungrouped-imports """Standalone FastAPI app for local Creator UI development.""" from __future__ import annotations import asyncio from contextlib import asynccontextmanager from fastapi import FastAPI from utils.env import load_project_env load_proje...
105
3,493
QwenPaw
plugins/apps/qwenpaw-creator/backend/domain/ids.py
.py
# -*- coding: utf-8 -*- """ID and timestamp helpers; IDs never carry legacy aliases.""" from __future__ import annotations from datetime import datetime, timezone from uuid import uuid4 def new_id(prefix: str) -> str: clean = prefix.strip().lower().replace("_", "-") return f"{clean}-{uuid4().hex}" def utc...
21
439
QwenPaw
plugins/apps/qwenpaw-creator/backend/domain/errors.py
.py
# -*- coding: utf-8 -*- """Typed domain failures mapped to structured HTTP errors by the API layer.""" from __future__ import annotations class CreatorError(Exception): status_code = 400 code = "CREATOR_ERROR" retryable = False def __init__(self, message: str, *, details: dict | None = None) -> None...
62
1,289
QwenPaw
plugins/apps/qwenpaw-creator/backend/domain/refs.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """Parsers for runtime target locators and persistent workspace references.""" from __future__ import annotations import re from dataclasses import dataclass from pathlib import PurePosixPath from urllib.parse import quote, unquote, urlparse from .errors import Validation...
84
2,622
QwenPaw
plugins/apps/qwenpaw-creator/backend/domain/__init__.py
.py
# -*- coding: utf-8 -*- """Stable domain contracts for the Creator runtime.""" from .enums import ( CreatorCommandType, CreatorGoalStatus, CreatorProgressPhase, CreatorSessionStatus, SpecialistRole, SpecialistRunStatus, TransactionStatus, ) __all__ = [ "CreatorCommandType", "Creato...
23
466
QwenPaw
plugins/apps/qwenpaw-creator/backend/domain/enums.py
.py
# -*- coding: utf-8 -*- """Single-source string enums shared by runtime, API and tests.""" from __future__ import annotations from enum import StrEnum class ShotCamera(StrEnum): STATIC = "⊙ 静止" PUSH_IN = "↑ 推近" PULL_OUT = "↓ 拉远" PAN_RIGHT = "→ 横摇右" PAN_LEFT = "← 横摇左" CRANE = "↕ 升降" ORBIT...
173
5,123
QwenPaw
plugins/apps/qwenpaw-creator/backend/domain/events.py
.py
# -*- coding: utf-8 -*- """Durable event names exposed by the single Creator event stream.""" EVENT_TYPES = frozenset( { "session.created", "session.status_changed", "session.waiting_runtime", "message.accepted", "message.queued", "message.appended", "message...
67
2,055
QwenPaw
plugins/apps/qwenpaw-creator/backend/schemas/assets.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 from __future__ import annotations from datetime import datetime from typing import Any, Literal from pydantic import Field, field_validator, model_serializer, model_validator from .common import StrictModel class TextOrUrlAssetRequest(StrictModel): client_request_i...
542
18,851
QwenPaw
plugins/apps/qwenpaw-creator/backend/schemas/models.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations from typing import Any, Literal from pydantic import BaseModel, ConfigDict, Field, model_validator from .common import StrictModel class _ConfigBase(BaseModel): """Config models tolerate schema drift (extra fields from newer/older front-ends or per...
295
9,549
QwenPaw
plugins/apps/qwenpaw-creator/backend/schemas/__init__.py
.py
# -*- coding: utf-8 -*- """Pydantic transport contracts for the one-shot Creator API."""
3
89
QwenPaw
plugins/apps/qwenpaw-creator/backend/schemas/sessions.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations from typing import Any, Literal from pydantic import Field from .common import ContentPart, StrictModel from .status import AgentStatusBarView CreatorSessionStatus = Literal[ "IDLE", "RUNNING", "WAITING_RUNTIME", "INTERRUPT_REQUESTED", ...
107
3,157
QwenPaw
plugins/apps/qwenpaw-creator/backend/schemas/run_review.py
.py
# -*- coding: utf-8 -*- """Pydantic models for the in-run review bypass (backend-internal). Both run-review switches are code-level only, so these models intentionally do not join the frontend API contract; reports are persisted under each Project's ``runtime/run-review/`` directory. """ from __future__ import annota...
80
2,256
QwenPaw
plugins/apps/qwenpaw-creator/backend/schemas/skills.py
.py
# -*- coding: utf-8 -*- """Backend-internal schema for manually configured external skills. ``<CREATOR_DATA_ROOT>/config/skills_config.json`` is edited by hand only; there is no frontend surface or plugin config block for it. The document shape is ``{"skills": [SkillEntry, ...]}``. """ from __future__ import annotati...
55
1,432
QwenPaw
plugins/apps/qwenpaw-creator/backend/schemas/projects.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations from typing import Literal from pydantic import Field, field_validator from .common import StrictModel class ExecutionProviderModelScope(StrictModel): """One exact provider/model pair covered by project preauthorization.""" provider: str = Field(m...
84
2,870
QwenPaw
plugins/apps/qwenpaw-creator/backend/schemas/status.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations from typing import Any from pydantic import Field from domain.enums import CreatorProgressPhase from .common import StrictModel class CreatorTaskProgress(StrictModel): goal_id: str | None = Field(None, alias="goalId") phase: CreatorProgressPhase ...
37
1,044
QwenPaw
plugins/apps/qwenpaw-creator/backend/schemas/render_review.py
.py
# -*- coding: utf-8 -*- """Pydantic models for the render self-review module (backend-internal). The self-review switch is code-level only, so these models intentionally do not join the frontend API contract; they are persisted under each Project's ``runtime/render-review/`` directory and consumed by the review loop. ...
107
3,271
QwenPaw
plugins/apps/qwenpaw-creator/backend/schemas/observability.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations from typing import Literal from pydantic import Field from .common import StrictModel class ObservabilityConfigData(StrictModel): enabled: bool = True trace_directory: str = Field( default="observability/traces", min_length=1, ...
29
610
QwenPaw
plugins/apps/qwenpaw-creator/backend/schemas/common.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations from typing import Any, Literal from pydantic import BaseModel, ConfigDict, Field class StrictModel(BaseModel): model_config = ConfigDict(extra="forbid", populate_by_name=True) class ContentPart(StrictModel): type: Literal["text", "image_url", "vi...
31
777
QwenPaw
plugins/apps/qwenpaw-creator/backend/schemas/tasks.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations from typing import Any, Literal from pydantic import Field from domain.enums import ( SpecialistRole, SpecialistRunStatus, TaskKind, TaskStatus, ) from .common import StrictModel class TaskView(StrictModel): id: str project_id: str...
67
2,182
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/storage_root.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """Creator data-root configuration independent of any storage backend.""" from __future__ import annotations import os from pathlib import Path CREATOR_DATA_ROOT_ENV = "CREATOR_DATA_ROOT" class CreatorDataRootError(RuntimeError): """Raised when the mandatory extern...
44
1,184
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/external_skills.py
.py
# -*- coding: utf-8 -*- # pylint: disable=too-many-return-statements """Agent skills: domain knowledge catalogs for the Creator main Agent. A skill is a local directory carrying a single SKILL.md document. Builtin skills ship inside the backend source tree under ``skills/``; additional directories can be declared in `...
489
17,280
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/document_reader.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=too-many-branches # pylint: disable=too-many-statements """Multi-format document reading built on vendored Qwen-MM-Plugins renderers. Renders a local document into page images (persisted by the caller-supplied output directory) plus a bounded text excerpt....
293
9,752
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/specialist_tools.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=too-many-return-statements # pylint: disable=too-many-branches # pylint: disable=too-many-statements """File-native toolkits owned by Creator specialists. The Agent runtime consumes this registry as a generic AgentScope tool surface. Business capabilities ...
1,534
58,932
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/object_grounding.py
.py
# -*- coding: utf-8 -*- """VLM-backed object localization with normalized and pixel bounding boxes.""" from __future__ import annotations import io import json import math import re from collections.abc import Sequence from typing import Any from PIL import Image, ImageDraw, ImageFont from models import config as m...
390
12,571
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/workspace/__init__.py
.py
# -*- coding: utf-8 -*- """Content-addressed blob storage retained for web grounding staging.""" from .content_store import ContentStore, StoredContent, atomic_replace_bytes __all__ = [ "ContentStore", "StoredContent", "atomic_replace_bytes", ]
11
259
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/workspace/content_store.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """Content-addressed storage for immutable Creator blobs and artifacts. This module is deliberately independent from any source-tree workspace layout. It stores bytes under the external Creator data root and never exposes a mutable project directory to agents. Callers per...
414
13,584
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/media/source_observation.py
.py
# -*- coding: utf-8 -*- """Time-window observation of original source footage (回原片核验). Completes the video-memory two-step query paradigm: after ``query_source_memory`` locates candidate ``hitWindowsMs``, a specialist calls ``observe_source_clip`` to cut that window from the original source media, watch it through the...
820
27,503
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/media/contracts.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """Narrow ports shared by persistent media workers. Workers deliberately receive these ports. They never treat an in-process queue, coroutine, or provider object as authoritative state; the injected Task Registry and validity resolver are backed by durable Creator Runtime ...
171
4,620
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/media/source_intelligence.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=line-too-long,too-many-branches,too-many-statements """Typed Source Intelligence contract and canonical Text Workspace codec.""" from __future__ import annotations import re from collections.abc import Mapping, Sequence from typing import Any from urllib....
821
26,731
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/media/__init__.py
.py
# -*- coding: utf-8 -*- """Persistent media capability package. Concrete contracts and stores are imported from their owning modules so a provider or frozen AI Edit module can be collected without initializing the whole runtime graph. """
8
240
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/media/source_memory.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=too-many-lines """Long-source hierarchical graph memory inside Source Intelligence. Write path: after ``commit_source_intelligence`` publishes a regular index, sources longer than the threshold get a background Task (ungated: no execution authorization) th...
2,218
81,775
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/media/source_video_reader.py
.py
# -*- coding: utf-8 -*- """Coarse-to-fine on-demand video reading (先粗看再细看). Ports the upstream ``read_video`` three-stage adaptive sampler as a Creator specialist tool: ① dynamic FPS picks a frame count for the requested window, ② a mid-window probe frame measures per-frame bytes and pre-caps the count against the res...
706
24,327
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/migrations.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """Deterministic, in-memory migrations for ``project.json`` documents. Schema migrations are intentionally separate from Project content commits. They upgrade an older raw document before Pydantic validation; persisting the upgraded form still has to go through the normal P...
567
19,944
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/locator_map.py
.py
# -*- coding: utf-8 -*- # pylint: disable=too-many-return-statements """Map a committed JSON pointer to a frontend navigation locator. Every review operation carries a ``ui_locator`` so the AgentDock review panel can (a) jump the user to the place the change lives and (b) render the right kind of diff/preview. Text e...
182
6,023
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/review.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=too-many-branches,too-many-statements """Filesystem Runtime Review decisions over real Project JSON values.""" from __future__ import annotations from contextlib import nullcontext from dataclasses import dataclass from datetime import UTC, datetime from ...
1,803
67,887
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/assets.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=too-many-boolean-expressions,too-many-branches # pylint: disable=too-many-return-statements,too-many-statements # pylint: disable=try-except-raise """Crash-safe, immutable file storage below one Project's ``assets/`` tree. ``project.json`` owns the meaning...
1,018
34,563
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/models.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=too-many-boolean-expressions,too-many-branches # pylint: disable=too-many-statements """Pydantic authority for Creator's single-file Project domain model. The models in this module deliberately contain no SQLite or HTTP concerns. They describe only the dur...
2,020
72,347
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/store.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=try-except-raise """Filesystem ProjectStore for the single ``project.json`` authority.""" from __future__ import annotations from collections.abc import Callable, Iterator from dataclasses import dataclass from datetime import datetime import os from path...
735
27,936
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/edit_impact.py
.py
# -*- coding: utf-8 -*- # pylint: disable=too-many-branches,too-many-statements """Typed side effects for explicit frontend Element draft commits. User operations remain ordinary Project JSON Pointer edits. Before the Project commit is published, this module derives which selected artifacts no longer describe the edi...
653
21,683
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/__init__.py
.py
# -*- coding: utf-8 -*- """Single-file Project schema and filesystem persistence primitives.""" from .agent_tools import ( AGENT_PROJECT_TOOL_SCHEMAS, ELEMENTS_AT_TOOL_NAME, JQ_PROJECT_TOOL_NAME, READ_PROJECT_TOOL_NAME, AgentProjectCommitResult, AgentElementsAtResult, AgentProjectSnapshotRe...
145
3,451
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/schema_prompt.py
.py
# -*- coding: utf-8 -*- """Deterministic Project schema prompt generated once per runtime schema.""" from __future__ import annotations import hashlib import json from dataclasses import dataclass from functools import lru_cache from .models import Project from .prompts import render_workspace_schema_prompt @datac...
34
856
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/facade.py
.py
# -*- coding: utf-8 -*- """Async application facade for the synchronous filesystem primitives.""" from __future__ import annotations import asyncio from dataclasses import dataclass from hashlib import sha256 import logging from pathlib import Path import threading from typing import Any, Mapping from services.runti...
645
22,815
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/poller.py
.py
# -*- coding: utf-8 -*- """Backend file poller and last-good Project snapshot cache.""" from __future__ import annotations import asyncio from dataclasses import dataclass, replace from datetime import UTC, datetime import random import threading from collections.abc import Callable from typing import Literal from u...
250
8,574
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/patch_ops.py
.py
# -*- coding: utf-8 -*- """Deterministic patch operations over one Project document. ``patch_project`` moves bracket depth off the model: instead of hand- writing one deep nested document (where LLM bracket-balance errors grow with depth x length), the model emits a flat list of small operations and the Runtime assemb...
256
8,361
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/agent_tools.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """Model-facing read/jq tools over the single-file Project authority. The model supplies only the Project identity and a jq transformation. The base snapshot for three-way merge is the last snapshot this request-scoped boundary actually observed; the model never echoes ETa...
1,500
59,405
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/jq_transform.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """Bounded jq execution for producing an in-memory Project candidate.""" from __future__ import annotations import json import os import subprocess import tempfile from dataclasses import dataclass from typing import Any, Mapping from services.runtime_files.runtime_depend...
200
7,051
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/remote_cache.py
.py
# -*- coding: utf-8 -*- # pylint: disable=raise-missing-from """Operational cache helpers for URL-backed SourceAssetVersions. The public URL is the immutable Project source identity. Downloaded bytes are only a Runtime cache: they must not create a second AssetVersion or advance the Project generation when they arrive...
213
6,551
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/candidate_normalization.py
.py
# -*- coding: utf-8 -*- """Deterministic pre-validation normalization of jq_project candidates. Models repeatedly emit harmless *identity echoes*: denormalized id fields inside EntityCollection items whose value merely repeats the collection key or the owning parent's id (for example ``entityId`` inside a VisualVarian...
164
6,027
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/recovery.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=too-many-boolean-expressions,too-many-branches # pylint: disable=too-many-return-statements,too-many-statements """Idempotent startup recovery for Project commit journals. Recovery never rewrites ``project.json``. It may only complete Runtime facts when t...
1,628
64,224
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/commit.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=too-many-boolean-expressions,too-many-branches # pylint: disable=too-many-statements """The generic Project commit boundary. This is intentionally the only write primitive for ``project.json``. It has no content-tree CRUD methods: callers provide a real b...
1,407
54,959
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/json_pointer.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=too-many-branches """Generic JSON Pointer diff, hashing, CAS, and merge helpers. The Project commit boundary deliberately operates on JSON values instead of knowing about any particular Creator domain entity. A model or browser may therefore change severa...
319
10,610
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/serialization.py
.py
# -*- coding: utf-8 -*- # pylint: disable=too-many-return-statements,try-except-raise # pylint: disable=unnecessary-lambda """Deterministic JSON encoding and ETags for ``project.json``.""" from __future__ import annotations from collections.abc import Mapping from datetime import datetime, timezone from enum import E...
260
8,943
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/project_files/prompts/__init__.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """Placeholder-verified Project Workspace prompt templates.""" from __future__ import annotations from pathlib import Path _PROMPT_PATH = Path(__file__).resolve().parent / "workspace_schema.system.txt" _SCHEMA_PLACEHOLDER = "{{project_json_schema}}" def render_workspac...
24
726
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/source_analysis/__init__.py
.py
# -*- coding: utf-8 -*- """File-native Source Intelligence execution and query boundary.""" from .service import ( DefaultSourceMediaAnalyzer, SourceAgentToolContext, SourceAnalysisDispatch, SourceAnalysisJob, SourceAnalyzerConfigurationError, SourceAnalyzerOutput, SourceMediaAnalysisInput,...
35
989
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/source_analysis/service.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=protected-access,raise-missing-from # pylint: disable=too-many-boolean-expressions,too-many-branches # pylint: disable=too-many-return-statements,too-many-statements """File-native Source Intelligence validation, modality tools, and publishing. The outer S...
2,755
104,782
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/source_analysis/codec.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=too-many-statements """Canonical provider-output normalization for file-native Source Intelligence.""" from __future__ import annotations from collections.abc import Mapping, Sequence from typing import Any from domain.errors import ValidationError from ...
237
7,499
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/web_grounding/pipeline.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=line-too-long,protected-access,too-many-branches # pylint: disable=too-many-nested-blocks,too-many-statements """End-to-end web-grounding orchestration and compatibility implementation. The module has three layers: - detect whether a prompt depends on exte...
890
33,618
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/web_grounding/visual_jobs.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=line-too-long,too-many-branches """Per-entity visual query jobs and strict-identity policy.""" from __future__ import annotations import json import re from typing import Any from .common import clean_text as _clean_text from .common import coerce_bool a...
716
24,569
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/web_grounding/staging.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=unused-argument """Download and content-address visual grounding candidates.""" from __future__ import annotations import io import mimetypes import os from pathlib import Path from typing import Any from urllib.parse import urlparse import httpx from PI...
275
9,409
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/web_grounding/models.py
.py
# -*- coding: utf-8 -*- """Shared typed contracts for the grounding pipeline.""" from __future__ import annotations from typing import NotRequired, TypedDict class VisualJob(TypedDict): query: str entity_name: str entity_type: str usage: str strict_identity: bool job_key: NotRequired[str] ...
61
1,261
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/web_grounding/__init__.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """Public facade for Creator web grounding. Callers should import from this package. Implementation details live in focused modules; ``pipeline`` owns orchestration and retains compatibility helpers while the remaining seams are extracted. """ from .pipeline import ( c...
35
968
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/web_grounding/rendering.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """Render source-backed grounding data for downstream Creator agents.""" from __future__ import annotations from typing import Any def _clean(value: Any, *, max_chars: int) -> str: text = " ".join(str(value or "").split()) return text[:max_chars] def fact_from_...
79
2,834
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/web_grounding/common.py
.py
# -*- coding: utf-8 -*- """Small normalization helpers shared across grounding stages.""" from __future__ import annotations import html import re from typing import Any def clean_text(value: Any, *, max_chars: int | None = None) -> str: text = html.unescape(str(value or "")) text = re.sub(r"<[^>]+>", " ", ...
64
1,883
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/web_grounding/triage.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=line-too-long,redefined-outer-name,reimported # pylint: disable=too-many-branches,too-many-return-statements,unused-import """Grounding triage, entity normalization, and visual-query planning.""" from __future__ import annotations import json import os im...
812
30,364
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/web_grounding/verification.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=line-too-long,too-many-branches """VLM verification, reference-quality policy, and per-job ranking.""" from __future__ import annotations import asyncio import json import random import time from typing import Any from models import config as model_confi...
642
26,450
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/web_grounding/providers/serper.py
.py
# -*- coding: utf-8 -*- """Serper (google.serper.dev) provider boundary. The adapter implementation remains private to the pipeline, mirroring the Tavily extraction; this module defines the ownership boundary for provider-specific endpoint constants and response parsing. """ SERPER_SEARCH_URL = "https://google.serper...
25
997
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/web_grounding/providers/dashscope.py
.py
# -*- coding: utf-8 -*- """DashScope/Qwen visual-search provider boundary.""" PROVIDER_NAME = "dashscope_web_search_image"
5
124
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/web_grounding/providers/__init__.py
.py
# -*- coding: utf-8 -*- """Search-provider adapters used by web grounding."""
3
78
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/web_grounding/providers/tavily.py
.py
# -*- coding: utf-8 -*- """Tavily provider boundary. The adapter implementation remains private to the pipeline for this first behavior-preserving extraction; this module defines the ownership boundary for provider-specific configuration and response parsing. """ TAVILY_SEARCH_URL = "https://api.tavily.com/search"
10
318
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/web_grounding/providers/adapters.py
.py
# -*- coding: utf-8 -*- # pylint: disable=too-many-branches """Provider transport and response-normalization adapters.""" from __future__ import annotations import asyncio import json import os from typing import Any import httpx from utils.logger import setup_logger from ..common import clean_text as _clean_text ...
758
24,440
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/web_grounding/providers/search.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=line-too-long,too-many-branches,too-many-statements """Provider search aggregation, fallback, and result deduplication.""" from __future__ import annotations import asyncio import io import math from pathlib import Path from typing import Any import http...
891
33,037
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/web_grounding/providers/config.py
.py
# -*- coding: utf-8 -*- """Provider configuration and retry policy.""" from __future__ import annotations import os from urllib.parse import urlparse import httpx from models import config as model_config DEFAULT_VISUAL_SEARCH_PROVIDERS = ( "tavily", "serper", "dashscope_web_search_image", ) DEFAULT_VI...
148
4,283
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/render_review/review.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """Render self-review loop: frame evidence → VLM review → advisory feedback. The loop is an adviser, never a gate: it runs detached after a final composition is published, writes its reports under the Project's ``runtime/render-review/`` directory and, on a revise verdict, ...
915
32,793
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/render_review/__init__.py
.py
# -*- coding: utf-8 -*- """Render self-review module (code-level switch, advisory, frontend-free). Enabled only through the ``CREATOR_SELF_REVIEW_ENABLED`` environment switch (``models.config.is_self_review_enabled``); with the switch off the module is never imported into any execution path's behavior. """ from servi...
30
802
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/render_review/protocol.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """Eight-row self-review protocol: prompt template and report parsing. The seven Appeal rubric rows come verbatim from the vendored ``review_rubrics.APPEAL_RUBRIC_ROWS`` (Qwen-MM-Plugins video-edit skill, ``review/final-review.md`` §D) so self-review and the bypass run_revi...
313
14,546
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/render_review/scene_review.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """Scene-level pre-compose review (upstream scene-loop, zero-render). Reviews one ``scene_ledger`` row of a Timeline BEFORE the master compose: evidence comes exclusively from cheap sources — ffmpeg keyframe seeks on the ORIGINAL source files mapped through each Edit Elemen...
827
30,281
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/render_review/frames.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """Frame and audio evidence extraction for the render self-review loop. Frames are sampled uniformly across the full duration (first and last frame always included) and resized to the VLM video resolution budget via the vendored ``image_budget.smart_resize``. The audio prof...
340
11,545
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/observability/__init__.py
.py
# -*- coding: utf-8 -*- """Creator-owned structured tracing and diagnostics.""" from .config import ( load_observability_config, observability_config_path, project_observability_directory, project_observability_root, save_observability_config, ) from .tracing import ( bind_trace_context, cu...
35
787
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/observability/tracing.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=no-else-raise,too-many-return-statements,too-many-branches """Small, dependency-free tracing layer for the complete Creator runtime. The runtime persists business authority in ``project.json`` and scoped Runtime JSON/JSONL files. These traces serve a diff...
491
14,101
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/observability/config.py
.py
# -*- coding: utf-8 -*- """Creator Data Workspace-backed observability configuration.""" from __future__ import annotations import json import os from functools import lru_cache from pathlib import Path from typing import Any from domain.errors import ValidationError from schemas.observability import ObservabilityCo...
248
7,539
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/run_review/feedback.py
.py
# -*- coding: utf-8 -*- """Feedback delivery for the async media review (mirrors render_review). Findings are admitted as a durable RUNTIME mutation-instruction message via ``admit_user_request``; the ``admission_guard`` re-validates the reviewed artifact's slot selection inside the Project lifecycle boundary, so a su...
137
4,262
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/run_review/admission.py
.py
# -*- coding: utf-8 -*- """Round admission and loop safety for the in-run review bypass. The async media side reuses the render-review claim semantics (PR #77): per-slot state files under a cross-process lock, a bounded reviewed-version history for idempotent replay, and a lease token bound to process + event loop so ...
292
9,578
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/run_review/rubric_prompts.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=line-too-long """Prompt builders derived from the vendored upstream review rules. Every run-review prompt (and the taste principles rendered into the agent prompts) is generated from ``vendor.media_toolkit.review_rubrics`` so the wording stays aligned with...
201
9,489
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/run_review/__init__.py
.py
# -*- coding: utf-8 -*- """In-run review bypass: sync text/motion advisories + async media review. Two independent code-level switches (both default off): - ``CREATOR_SYNC_REVIEW_ENABLED`` — synchronous Appeal-rubric review of freshly committed creative text, attached to the jq_project tool result. - ``CREATOR_MEDI...
18
724
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/run_review/media_review.py
.py
# -*- coding: utf-8 -*- """Async bypass review of generated image/element-video artifacts. Mirrors the render-review scheduling contract (PR #77): every successful convergence of a reviewed command may call :func:`schedule_media_review`; the switch, the command filter and the already-reviewed dedup all live on the rev...
565
19,566
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/run_review/text_review.py
.py
# -*- coding: utf-8 -*- """Synchronous in-run review of freshly committed text/motion artifacts. Runs inline inside the ``jq_project`` tool worker (a ``to_thread`` context): when the sync switch is on and the commit touched reviewable creative text, the changed values are scored against the vendored Appeal rubric and ...
301
10,078
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/file_agent_runtime/driver.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=cell-var-from-loop,protected-access,too-many-branches # pylint: disable=too-many-statements,unused-argument """SQLite-free Creator Agent loop over Project and Runtime files.""" from __future__ import annotations import asyncio from collections.abc import ...
6,603
262,762
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/file_agent_runtime/subagents.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """File-native Creator specialist contracts and prompt selection.""" from __future__ import annotations from collections.abc import Sequence from copy import deepcopy from pathlib import Path from typing import Any from pydantic import BaseModel, ConfigDict, Field, field_...
300
12,253
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/file_agent_runtime/models.py
.py
# -*- coding: utf-8 -*- """Durable records owned by the file-native Creator Agent driver.""" from __future__ import annotations from enum import StrEnum from typing import Any from pydantic import Field, model_validator from services.runtime_files.models import ( AwareDatetime, ChangeOrigin, NonEmptyStr...
97
2,995
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/file_agent_runtime/tool_protocol.py
.py
# -*- coding: utf-8 -*- """AgentScope tool-call boundary guards for the file-native Runtime.""" from __future__ import annotations from collections.abc import Awaitable, Callable import re class NonNativeToolMarkupError(ValueError): """Raised when a TextBlock contains provider control markup.""" _NON_NATIVE_T...
97
3,143
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/file_agent_runtime/model_client.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 # pylint: disable=too-many-branches,too-many-nested-blocks,too-many-statements """AgentScope 2.0 chat-model boundary for the file Creator Runtime.""" from __future__ import annotations from collections.abc import Awaitable, Callable, Mapping, Sequence from dataclasses impo...
1,115
42,471
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/file_agent_runtime/checkpoints.py
.py
# -*- coding: utf-8 -*- """Creation pit-stop checkpoints for the file-native Creator Runtime. Two hard stops protect the user's money from compounding mistakes: planning errors are cheap to fix as text and expensive to fix as media, and a wrong character design silently poisons every storyboard and video built on top ...
151
5,651
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/file_agent_runtime/__init__.py
.py
# -*- coding: utf-8 -*- """Public surface for the SQLite-free Creator Agent Runtime.""" from .driver import ( FileAgentRuntimeError, FileCreatorAgentRuntime, StaleAgentRun, ) from .model_client import ( AgentChatClient, AgentModelConfigurationError, AgentModelError, AgentModelTurn, Agen...
56
1,404
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/file_agent_runtime/registry.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """Process-level lifecycle hooks for the file-native Creator Agent driver.""" from __future__ import annotations import threading from services.project_files.facade import CreatorFileServices from .driver import FileCreatorAgentRuntime from .model_client import AgentChat...
111
3,006
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/file_agent_runtime/work_graph.py
.py
# -*- coding: utf-8 -*- """Derived work graph: the project's production plan as a DAG snapshot. The graph is a pure projection of ``project.json`` plus runtime task records — never a second source of truth. Node identity is canonical (entity/element derived), dependencies mirror the deterministic gates the Runtime alr...
826
31,121
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/file_agent_runtime/work_scheduler.py
.py
# -*- coding: utf-8 -*- """Event-driven scheduler that fans out READY media nodes in parallel. The model plans; the Runtime executes. Media generation parameters are deterministically assembled from project.json, so once the work graph marks a media node READY there is nothing left that needs a model turn — the schedu...
594
22,579
QwenPaw
plugins/apps/qwenpaw-creator/backend/services/file_agent_runtime/run_store.py
.py
# -*- coding: utf-8 -*- # flake8: noqa: E501 """Atomic file store for top-level Creator Agent runs.""" from __future__ import annotations from collections.abc import Collection, Mapping from contextlib import contextmanager import os from pathlib import Path import stat from typing import Any from services.runtime_f...
238
8,611