- 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 первым)
61 lines
1.4 KiB
Python
61 lines
1.4 KiB
Python
"""
|
|
Type-annotation related support for the referencing library.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from collections.abc import Mapping as Mapping
|
|
from typing import TYPE_CHECKING, Any, Protocol
|
|
|
|
try:
|
|
from typing_extensions import TypeVar
|
|
except ImportError: # pragma: no cover
|
|
from typing import TypeVar
|
|
|
|
if TYPE_CHECKING:
|
|
from referencing._core import Resolved, Resolver, Resource
|
|
|
|
#: A URI which identifies a `Resource`.
|
|
URI = str
|
|
|
|
#: The type of documents within a registry.
|
|
D = TypeVar("D", default=Any)
|
|
|
|
|
|
class Retrieve(Protocol[D]):
|
|
"""
|
|
A retrieval callable, usable within a `Registry` for resource retrieval.
|
|
|
|
Does not make assumptions about where the resource might be coming from.
|
|
"""
|
|
|
|
def __call__(self, uri: URI) -> Resource[D]:
|
|
"""
|
|
Retrieve the resource with the given URI.
|
|
|
|
Raise `referencing.exceptions.NoSuchResource` if you wish to indicate
|
|
the retriever cannot lookup the given URI.
|
|
"""
|
|
...
|
|
|
|
|
|
class Anchor(Protocol[D]):
|
|
"""
|
|
An anchor within a `Resource`.
|
|
|
|
Beyond "simple" anchors, some specifications like JSON Schema's 2020
|
|
version have dynamic anchors.
|
|
"""
|
|
|
|
@property
|
|
def name(self) -> str:
|
|
"""
|
|
Return the name of this anchor.
|
|
"""
|
|
...
|
|
|
|
def resolve(self, resolver: Resolver[D]) -> Resolved[D]:
|
|
"""
|
|
Return the resource for this anchor.
|
|
"""
|
|
...
|