- harness/es.py: append-only event store + проекции (образец — кооп-портал) - harness/levels.py: уровни 1с/1м/1ч/1д, контекст ∝ масштабу - harness/scheduler.py: уровневые потоки, идемпотентные тики, absorbed-стабы - harness/isolated_runner.py + _llm_worker.py: LLM-тик в сабпроцессе (глобальный asyncio-рантайм Strands не переживает 2+ create_harness) - cli.py: init/task/tasks/status/events + requeue (написан самим минутным агентом) - 9router: отдельный ключ sk-simbiot, модель auto (glm-5.3 первым)
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
"""Extension-identifier grammar shared by the server and client extension surfaces."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
from typing import Any
|
|
|
|
__all__ = ["validate_extension_identifier"]
|
|
|
|
# Extension identifiers follow the `_meta` key grammar with a mandatory prefix
|
|
# (SEP-2133 / basic/index.mdx): dot-separated labels, each starting with a
|
|
# letter and ending with a letter or digit (hyphens interior), then `/`, then a
|
|
# name that starts and ends alphanumeric (`.`/`_`/`-` interior).
|
|
_LABEL = r"[A-Za-z](?:[A-Za-z0-9-]*[A-Za-z0-9])?"
|
|
_NAME = r"[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?"
|
|
_IDENTIFIER_RE = re.compile(rf"{_LABEL}(?:\.{_LABEL})*/{_NAME}")
|
|
|
|
|
|
def validate_extension_identifier(identifier: Any, *, owner: str) -> None:
|
|
"""Raise `TypeError` unless `identifier` is a `vendor-prefix/name` string.
|
|
|
|
SEP-2133 requires extension identifiers to carry a reverse-DNS prefix.
|
|
"""
|
|
if not isinstance(identifier, str) or not _IDENTIFIER_RE.fullmatch(identifier):
|
|
raise TypeError(
|
|
f"{owner}.identifier must be a `vendor-prefix/name` string "
|
|
f"(reverse-DNS prefix required), got {identifier!r}"
|
|
)
|