krons 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kronos → krons}/core/__init__.py +31 -31
- {kronos → krons}/core/broadcaster.py +1 -1
- {kronos → krons}/core/element.py +3 -3
- {kronos → krons}/core/event.py +4 -4
- {kronos → krons}/core/eventbus.py +1 -1
- {kronos → krons}/core/flow.py +4 -4
- {kronos → krons}/core/graph.py +4 -4
- {kronos → krons}/core/node.py +11 -11
- {kronos → krons}/core/pile.py +5 -5
- {kronos → krons}/core/processor.py +2 -2
- {kronos → krons}/core/progression.py +2 -2
- {kronos → krons}/enforcement/__init__.py +1 -1
- {kronos → krons}/enforcement/context.py +3 -3
- {kronos → krons}/enforcement/policy.py +3 -3
- {kronos → krons}/enforcement/rule.py +2 -2
- {kronos → krons}/enforcement/service.py +1 -1
- {kronos → krons}/enforcement/validator.py +3 -3
- {kronos → krons}/operations/builder.py +4 -4
- {kronos → krons}/operations/flow.py +5 -5
- {kronos → krons}/operations/node.py +3 -3
- {kronos → krons}/services/__init__.py +13 -13
- {kronos → krons}/services/backend.py +3 -3
- {kronos → krons}/services/hook.py +3 -3
- {kronos → krons}/services/imodel.py +5 -5
- {kronos → krons}/services/registry.py +2 -2
- {kronos → krons}/services/utilities/rate_limited_executor.py +4 -4
- {kronos → krons}/services/utilities/rate_limiter.py +1 -1
- {kronos → krons}/services/utilities/resilience.py +2 -2
- {kronos → krons}/session/exchange.py +3 -3
- {kronos → krons}/session/message.py +1 -1
- {kronos → krons}/session/session.py +7 -7
- {kronos → krons}/specs/adapters/dataclass_field.py +4 -4
- {kronos → krons}/specs/adapters/pydantic_adapter.py +5 -5
- {kronos → krons}/specs/adapters/sql_ddl.py +6 -6
- {kronos → krons}/specs/catalog/__init__.py +2 -2
- {kronos → krons}/specs/catalog/_audit.py +3 -3
- {kronos → krons}/specs/catalog/_common.py +2 -2
- {kronos → krons}/specs/catalog/_content.py +5 -5
- {kronos → krons}/specs/catalog/_enforcement.py +4 -4
- {kronos → krons}/specs/factory.py +7 -7
- {kronos → krons}/specs/operable.py +2 -2
- {kronos → krons}/specs/phrase.py +4 -4
- {kronos → krons}/specs/protocol.py +1 -1
- {kronos → krons}/specs/spec.py +7 -7
- {kronos → krons}/types/base.py +3 -3
- {kronos → krons}/types/db_types.py +2 -2
- {kronos → krons}/types/identity.py +1 -1
- {kronos → krons}/utils/_to_list.py +1 -1
- {kronos → krons}/utils/_utils.py +3 -3
- {kronos → krons}/utils/concurrency/__init__.py +38 -38
- {kronos → krons}/utils/concurrency/_async_call.py +3 -3
- {kronos → krons}/utils/fuzzy/_fuzzy_match.py +2 -2
- {kronos → krons}/utils/sql/_sql_validation.py +1 -1
- {krons-0.1.0.dist-info → krons-0.1.1.dist-info}/METADATA +5 -5
- krons-0.1.1.dist-info/RECORD +101 -0
- krons-0.1.0.dist-info/RECORD +0 -101
- {kronos → krons}/__init__.py +0 -0
- {kronos → krons}/enforcement/common/__init__.py +0 -0
- {kronos → krons}/enforcement/common/boolean.py +0 -0
- {kronos → krons}/enforcement/common/choice.py +0 -0
- {kronos → krons}/enforcement/common/mapping.py +0 -0
- {kronos → krons}/enforcement/common/model.py +0 -0
- {kronos → krons}/enforcement/common/number.py +0 -0
- {kronos → krons}/enforcement/common/string.py +0 -0
- {kronos → krons}/enforcement/registry.py +0 -0
- {kronos → krons}/errors.py +0 -0
- {kronos → krons}/operations/__init__.py +0 -0
- {kronos → krons}/operations/registry.py +0 -0
- {kronos → krons}/protocols.py +0 -0
- {kronos → krons}/py.typed +0 -0
- {kronos → krons}/services/endpoint.py +0 -0
- {kronos → krons}/services/utilities/__init__.py +0 -0
- {kronos → krons}/services/utilities/header_factory.py +0 -0
- {kronos → krons}/session/__init__.py +0 -0
- {kronos → krons}/specs/__init__.py +0 -0
- {kronos → krons}/specs/adapters/__init__.py +0 -0
- {kronos → krons}/specs/adapters/_utils.py +0 -0
- {kronos → krons}/specs/adapters/factory.py +0 -0
- {kronos → krons}/types/__init__.py +0 -0
- {kronos → krons}/types/_sentinel.py +0 -0
- {kronos → krons}/utils/__init__.py +0 -0
- {kronos → krons}/utils/_hash.py +0 -0
- {kronos → krons}/utils/_json_dump.py +0 -0
- {kronos → krons}/utils/_lazy_init.py +0 -0
- {kronos → krons}/utils/_to_num.py +0 -0
- {kronos → krons}/utils/concurrency/_cancel.py +0 -0
- {kronos → krons}/utils/concurrency/_errors.py +0 -0
- {kronos → krons}/utils/concurrency/_patterns.py +0 -0
- {kronos → krons}/utils/concurrency/_primitives.py +0 -0
- {kronos → krons}/utils/concurrency/_priority_queue.py +0 -0
- {kronos → krons}/utils/concurrency/_resource_tracker.py +0 -0
- {kronos → krons}/utils/concurrency/_run_async.py +0 -0
- {kronos → krons}/utils/concurrency/_task.py +0 -0
- {kronos → krons}/utils/concurrency/_utils.py +0 -0
- {kronos → krons}/utils/fuzzy/__init__.py +0 -0
- {kronos → krons}/utils/fuzzy/_extract_json.py +0 -0
- {kronos → krons}/utils/fuzzy/_fuzzy_json.py +0 -0
- {kronos → krons}/utils/fuzzy/_string_similarity.py +0 -0
- {kronos → krons}/utils/fuzzy/_to_dict.py +0 -0
- {kronos → krons}/utils/sql/__init__.py +0 -0
- {krons-0.1.0.dist-info → krons-0.1.1.dist-info}/WHEEL +0 -0
- {krons-0.1.0.dist-info → krons-0.1.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -10,46 +10,46 @@ from typing import TYPE_CHECKING
|
|
|
10
10
|
# Lazy import mapping
|
|
11
11
|
_LAZY_IMPORTS: dict[str, tuple[str, str]] = {
|
|
12
12
|
# broadcaster
|
|
13
|
-
"Broadcaster": ("
|
|
13
|
+
"Broadcaster": ("krons.core.broadcaster", "Broadcaster"),
|
|
14
14
|
# element
|
|
15
|
-
"Element": ("
|
|
15
|
+
"Element": ("krons.core.element", "Element"),
|
|
16
16
|
# event
|
|
17
|
-
"Event": ("
|
|
18
|
-
"EventStatus": ("
|
|
19
|
-
"Execution": ("
|
|
17
|
+
"Event": ("krons.core.event", "Event"),
|
|
18
|
+
"EventStatus": ("krons.core.event", "EventStatus"),
|
|
19
|
+
"Execution": ("krons.core.event", "Execution"),
|
|
20
20
|
# eventbus
|
|
21
|
-
"EventBus": ("
|
|
22
|
-
"Handler": ("
|
|
21
|
+
"EventBus": ("krons.core.eventbus", "EventBus"),
|
|
22
|
+
"Handler": ("krons.core.eventbus", "Handler"),
|
|
23
23
|
# flow
|
|
24
|
-
"Flow": ("
|
|
24
|
+
"Flow": ("krons.core.flow", "Flow"),
|
|
25
25
|
# graph
|
|
26
|
-
"Edge": ("
|
|
27
|
-
"EdgeCondition": ("
|
|
28
|
-
"Graph": ("
|
|
26
|
+
"Edge": ("krons.core.graph", "Edge"),
|
|
27
|
+
"EdgeCondition": ("krons.core.graph", "EdgeCondition"),
|
|
28
|
+
"Graph": ("krons.core.graph", "Graph"),
|
|
29
29
|
# node
|
|
30
|
-
"DEFAULT_NODE_CONFIG": ("
|
|
31
|
-
"NODE_REGISTRY": ("
|
|
32
|
-
"PERSISTABLE_NODE_REGISTRY": ("
|
|
33
|
-
"Node": ("
|
|
34
|
-
"NodeConfig": ("
|
|
35
|
-
"create_node": ("
|
|
36
|
-
"generate_ddl": ("
|
|
30
|
+
"DEFAULT_NODE_CONFIG": ("krons.core.node", "DEFAULT_NODE_CONFIG"),
|
|
31
|
+
"NODE_REGISTRY": ("krons.core.node", "NODE_REGISTRY"),
|
|
32
|
+
"PERSISTABLE_NODE_REGISTRY": ("krons.core.node", "PERSISTABLE_NODE_REGISTRY"),
|
|
33
|
+
"Node": ("krons.core.node", "Node"),
|
|
34
|
+
"NodeConfig": ("krons.core.node", "NodeConfig"),
|
|
35
|
+
"create_node": ("krons.core.node", "create_node"),
|
|
36
|
+
"generate_ddl": ("krons.core.node", "generate_ddl"),
|
|
37
37
|
# phrase
|
|
38
|
-
"PHRASE_REGISTRY": ("
|
|
39
|
-
"Phrase": ("
|
|
40
|
-
"PhraseConfig": ("
|
|
41
|
-
"PhraseError": ("
|
|
42
|
-
"RequirementNotMet": ("
|
|
43
|
-
"create_phrase": ("
|
|
44
|
-
"get_phrase": ("
|
|
45
|
-
"list_phrases": ("
|
|
38
|
+
"PHRASE_REGISTRY": ("krons.core.phrase", "PHRASE_REGISTRY"),
|
|
39
|
+
"Phrase": ("krons.core.phrase", "Phrase"),
|
|
40
|
+
"PhraseConfig": ("krons.core.phrase", "PhraseConfig"),
|
|
41
|
+
"PhraseError": ("krons.core.phrase", "PhraseError"),
|
|
42
|
+
"RequirementNotMet": ("krons.core.phrase", "RequirementNotMet"),
|
|
43
|
+
"create_phrase": ("krons.core.phrase", "create_phrase"),
|
|
44
|
+
"get_phrase": ("krons.core.phrase", "get_phrase"),
|
|
45
|
+
"list_phrases": ("krons.core.phrase", "list_phrases"),
|
|
46
46
|
# pile
|
|
47
|
-
"Pile": ("
|
|
47
|
+
"Pile": ("krons.core.pile", "Pile"),
|
|
48
48
|
# processor
|
|
49
|
-
"Executor": ("
|
|
50
|
-
"Processor": ("
|
|
49
|
+
"Executor": ("krons.core.processor", "Executor"),
|
|
50
|
+
"Processor": ("krons.core.processor", "Processor"),
|
|
51
51
|
# progression
|
|
52
|
-
"Progression": ("
|
|
52
|
+
"Progression": ("krons.core.progression", "Progression"),
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
_LOADED: dict[str, object] = {}
|
|
@@ -69,7 +69,7 @@ def __getattr__(name: str) -> object:
|
|
|
69
69
|
_LOADED[name] = value
|
|
70
70
|
return value
|
|
71
71
|
|
|
72
|
-
raise AttributeError(f"module '
|
|
72
|
+
raise AttributeError(f"module 'krons.core' has no attribute {name!r}")
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
def __dir__() -> list[str]:
|
{kronos → krons}/core/element.py
RENAMED
|
@@ -11,15 +11,15 @@ from uuid import UUID, uuid4
|
|
|
11
11
|
import orjson
|
|
12
12
|
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
|
13
13
|
|
|
14
|
-
from
|
|
14
|
+
from krons.protocols import (
|
|
15
15
|
Deserializable,
|
|
16
16
|
Hashable,
|
|
17
17
|
Observable,
|
|
18
18
|
Serializable,
|
|
19
19
|
implements,
|
|
20
20
|
)
|
|
21
|
-
from
|
|
22
|
-
from
|
|
21
|
+
from krons.types import MaybeSentinel, Unset, UnsetType, is_sentinel, is_unset
|
|
22
|
+
from krons.utils import (
|
|
23
23
|
coerce_created_at,
|
|
24
24
|
json_dump,
|
|
25
25
|
load_type_from_string,
|
{kronos → krons}/core/event.py
RENAMED
|
@@ -11,10 +11,10 @@ from typing import Any, final
|
|
|
11
11
|
import orjson
|
|
12
12
|
from pydantic import Field, field_serializer, field_validator
|
|
13
13
|
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
17
|
-
from
|
|
14
|
+
from krons.errors import KronError, KronTimeoutError
|
|
15
|
+
from krons.protocols import Invocable, Serializable, implements
|
|
16
|
+
from krons.types import Enum, MaybeSentinel, MaybeUnset, Unset, is_sentinel, is_unset
|
|
17
|
+
from krons.utils import async_synchronized, concurrency, json_dumpb
|
|
18
18
|
|
|
19
19
|
from .element import LN_ELEMENT_FIELDS, Element
|
|
20
20
|
|
{kronos → krons}/core/flow.py
RENAMED
|
@@ -9,10 +9,10 @@ from uuid import UUID
|
|
|
9
9
|
|
|
10
10
|
from pydantic import Field, PrivateAttr, field_validator, model_validator
|
|
11
11
|
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
12
|
+
from krons.errors import ExistsError, NotFoundError
|
|
13
|
+
from krons.protocols import Serializable, implements
|
|
14
|
+
from krons.types import Unset, UnsetType
|
|
15
|
+
from krons.utils import extract_types, synchronized
|
|
16
16
|
|
|
17
17
|
from .element import Element
|
|
18
18
|
from .pile import Pile
|
{kronos → krons}/core/graph.py
RENAMED
|
@@ -11,10 +11,10 @@ from uuid import UUID
|
|
|
11
11
|
from pydantic import Field, PrivateAttr, field_validator, model_validator
|
|
12
12
|
from typing_extensions import override
|
|
13
13
|
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
17
|
-
from
|
|
14
|
+
from krons.errors import NotFoundError
|
|
15
|
+
from krons.protocols import Containable, Deserializable, Serializable, implements
|
|
16
|
+
from krons.types import Unset, UnsetType, is_unset
|
|
17
|
+
from krons.utils import synchronized
|
|
18
18
|
|
|
19
19
|
from .element import Element
|
|
20
20
|
from .node import Node
|
{kronos → krons}/core/node.py
RENAMED
|
@@ -15,8 +15,8 @@ from uuid import UUID
|
|
|
15
15
|
|
|
16
16
|
from pydantic import BaseModel, field_serializer, field_validator
|
|
17
17
|
|
|
18
|
-
from
|
|
19
|
-
from
|
|
18
|
+
from krons.protocols import Deserializable, Serializable, implements
|
|
19
|
+
from krons.types import (
|
|
20
20
|
ModelConfig,
|
|
21
21
|
Params,
|
|
22
22
|
Unset,
|
|
@@ -25,8 +25,8 @@ from kronos.types import (
|
|
|
25
25
|
is_unset,
|
|
26
26
|
not_sentinel,
|
|
27
27
|
)
|
|
28
|
-
from
|
|
29
|
-
from
|
|
28
|
+
from krons.types.db_types import VectorMeta, extract_kron_db_meta
|
|
29
|
+
from krons.utils import compute_hash, json_dump, now_utc
|
|
30
30
|
|
|
31
31
|
from .element import Element
|
|
32
32
|
|
|
@@ -258,7 +258,7 @@ class Node(Element):
|
|
|
258
258
|
f"or Element.metadata for simple key-value pairs."
|
|
259
259
|
)
|
|
260
260
|
|
|
261
|
-
# Polymorphic: restore type from
|
|
261
|
+
# Polymorphic: restore type from krons_class in metadata
|
|
262
262
|
if isinstance(value, dict) and "metadata" in value:
|
|
263
263
|
metadata = value.get("metadata", {})
|
|
264
264
|
kron_class = metadata.get("kron_class")
|
|
@@ -503,7 +503,7 @@ class Node(Element):
|
|
|
503
503
|
Computed integrity_hash, or None if integrity_hashing disabled
|
|
504
504
|
|
|
505
505
|
"""
|
|
506
|
-
from
|
|
506
|
+
from krons.utils import compute_chain_hash
|
|
507
507
|
|
|
508
508
|
config = self.get_config()
|
|
509
509
|
if not config.integrity_hashing:
|
|
@@ -704,8 +704,8 @@ def create_node(
|
|
|
704
704
|
>>> Job = create_node("Job", embedding_enabled=True, embedding_dim=1536)
|
|
705
705
|
|
|
706
706
|
"""
|
|
707
|
-
from
|
|
708
|
-
from
|
|
707
|
+
from krons.specs.catalog import AuditSpecs, ContentSpecs
|
|
708
|
+
from krons.specs.operable import Operable
|
|
709
709
|
|
|
710
710
|
# Resolve embedding dimension
|
|
711
711
|
resolved_embedding_dim: int | UnsetType = Unset
|
|
@@ -835,8 +835,8 @@ def generate_ddl(
|
|
|
835
835
|
ValueError: If node_cls has no table_name configured
|
|
836
836
|
|
|
837
837
|
"""
|
|
838
|
-
from
|
|
839
|
-
from
|
|
838
|
+
from krons.specs.catalog import AuditSpecs, ContentSpecs
|
|
839
|
+
from krons.specs.operable import Operable
|
|
840
840
|
|
|
841
841
|
config = node_cls.get_config()
|
|
842
842
|
if not config.is_persisted:
|
|
@@ -855,7 +855,7 @@ def generate_ddl(
|
|
|
855
855
|
|
|
856
856
|
# Flatten content: extract fields from BaseModel instead of generic JSONB
|
|
857
857
|
if config.flatten_content and content_type is not None:
|
|
858
|
-
from
|
|
858
|
+
from krons.specs.adapters.pydantic_adapter import PydanticSpecAdapter
|
|
859
859
|
|
|
860
860
|
if isinstance(content_type, type) and issubclass(content_type, BaseModel):
|
|
861
861
|
all_specs.extend(PydanticSpecAdapter.extract_specs(content_type))
|
{kronos → krons}/core/pile.py
RENAMED
|
@@ -12,11 +12,11 @@ from uuid import UUID
|
|
|
12
12
|
from pydantic import Field, PrivateAttr, field_serializer, field_validator
|
|
13
13
|
from typing_extensions import override
|
|
14
14
|
|
|
15
|
-
from
|
|
16
|
-
from
|
|
17
|
-
from
|
|
18
|
-
from
|
|
19
|
-
from
|
|
15
|
+
from krons.errors import ExistsError, NotFoundError
|
|
16
|
+
from krons.protocols import Containable, Deserializable, Serializable, implements
|
|
17
|
+
from krons.types import Unset, UnsetType, is_unset
|
|
18
|
+
from krons.utils import extract_types, load_type_from_string, synchronized
|
|
19
|
+
from krons.utils.concurrency import Lock as AsyncLock
|
|
20
20
|
|
|
21
21
|
from .element import Element
|
|
22
22
|
from .progression import Progression
|
|
@@ -6,8 +6,8 @@ from __future__ import annotations
|
|
|
6
6
|
import math
|
|
7
7
|
from typing import TYPE_CHECKING, Any, ClassVar, Self
|
|
8
8
|
|
|
9
|
-
from
|
|
10
|
-
from
|
|
9
|
+
from krons.errors import ConfigurationError, NotFoundError, QueueFullError
|
|
10
|
+
from krons.utils import concurrency
|
|
11
11
|
|
|
12
12
|
from .event import Event, EventStatus
|
|
13
13
|
from .flow import Flow
|
|
@@ -9,8 +9,8 @@ from uuid import UUID
|
|
|
9
9
|
|
|
10
10
|
from pydantic import Field, PrivateAttr, field_validator
|
|
11
11
|
|
|
12
|
-
from
|
|
13
|
-
from
|
|
12
|
+
from krons.errors import NotFoundError
|
|
13
|
+
from krons.protocols import Containable, implements
|
|
14
14
|
|
|
15
15
|
from .element import Element
|
|
16
16
|
|
|
@@ -14,7 +14,7 @@ Mental model:
|
|
|
14
14
|
Policy = external evaluation protocol (implementations in domain libs)
|
|
15
15
|
|
|
16
16
|
Usage:
|
|
17
|
-
from
|
|
17
|
+
from krons.enforcement import Rule, Validator, RuleRegistry
|
|
18
18
|
|
|
19
19
|
# Register rules
|
|
20
20
|
registry = RuleRegistry()
|
|
@@ -11,11 +11,11 @@ from datetime import datetime
|
|
|
11
11
|
from typing import TYPE_CHECKING, Any, Protocol
|
|
12
12
|
from uuid import UUID, uuid4
|
|
13
13
|
|
|
14
|
-
from
|
|
15
|
-
from
|
|
14
|
+
from krons.types.base import DataClass
|
|
15
|
+
from krons.types.identity import ID
|
|
16
16
|
|
|
17
17
|
if TYPE_CHECKING:
|
|
18
|
-
from
|
|
18
|
+
from krons.session import Branch, Session
|
|
19
19
|
|
|
20
20
|
__all__ = ("QueryFn", "RequestContext")
|
|
21
21
|
|
|
@@ -13,9 +13,9 @@ from collections.abc import Sequence
|
|
|
13
13
|
from dataclasses import dataclass, field
|
|
14
14
|
from typing import Any, Protocol, runtime_checkable
|
|
15
15
|
|
|
16
|
-
from
|
|
17
|
-
from
|
|
18
|
-
from
|
|
16
|
+
from krons.enforcement.context import RequestContext
|
|
17
|
+
from krons.specs.catalog._enforcement import EnforcementLevel
|
|
18
|
+
from krons.types.base import DataClass
|
|
19
19
|
|
|
20
20
|
__all__ = (
|
|
21
21
|
"EnforcementLevel",
|
|
@@ -8,8 +8,8 @@ from dataclasses import dataclass, field
|
|
|
8
8
|
from enum import IntEnum, auto
|
|
9
9
|
from typing import Any
|
|
10
10
|
|
|
11
|
-
from
|
|
12
|
-
from
|
|
11
|
+
from krons.errors import ValidationError
|
|
12
|
+
from krons.types import Params
|
|
13
13
|
|
|
14
14
|
__all__ = ("Rule", "RuleParams", "RuleQualifier", "ValidationError")
|
|
15
15
|
|
|
@@ -12,7 +12,7 @@ from typing import Any
|
|
|
12
12
|
|
|
13
13
|
from pydantic import Field, PrivateAttr
|
|
14
14
|
|
|
15
|
-
from
|
|
15
|
+
from krons.services import ServiceBackend, ServiceConfig
|
|
16
16
|
|
|
17
17
|
from .context import RequestContext
|
|
18
18
|
from .policy import EnforcementLevel, PolicyEngine, PolicyResolver
|
|
@@ -7,14 +7,14 @@ from collections import deque
|
|
|
7
7
|
from datetime import datetime
|
|
8
8
|
from typing import TYPE_CHECKING, Any, ClassVar
|
|
9
9
|
|
|
10
|
-
from
|
|
11
|
-
from
|
|
10
|
+
from krons.types import is_sentinel
|
|
11
|
+
from krons.utils.concurrency import is_coro_func
|
|
12
12
|
|
|
13
13
|
from .registry import RuleRegistry, get_default_registry
|
|
14
14
|
from .rule import Rule, ValidationError
|
|
15
15
|
|
|
16
16
|
if TYPE_CHECKING:
|
|
17
|
-
from
|
|
17
|
+
from krons.specs import Operable, Spec
|
|
18
18
|
|
|
19
19
|
__all__ = ("Validator",)
|
|
20
20
|
|
|
@@ -12,14 +12,14 @@ from __future__ import annotations
|
|
|
12
12
|
from typing import TYPE_CHECKING, Any
|
|
13
13
|
from uuid import UUID
|
|
14
14
|
|
|
15
|
-
from
|
|
16
|
-
from
|
|
17
|
-
from
|
|
15
|
+
from krons.core import Edge, Graph
|
|
16
|
+
from krons.types import Undefined, UndefinedType, is_sentinel, not_sentinel
|
|
17
|
+
from krons.utils._utils import to_uuid
|
|
18
18
|
|
|
19
19
|
from .node import Operation
|
|
20
20
|
|
|
21
21
|
if TYPE_CHECKING:
|
|
22
|
-
from
|
|
22
|
+
from krons.session import Branch
|
|
23
23
|
|
|
24
24
|
__all__ = ("Builder", "OperationGraphBuilder")
|
|
25
25
|
|
|
@@ -15,15 +15,15 @@ from dataclasses import dataclass
|
|
|
15
15
|
from typing import TYPE_CHECKING, Any
|
|
16
16
|
from uuid import UUID
|
|
17
17
|
|
|
18
|
-
from
|
|
19
|
-
from
|
|
20
|
-
from
|
|
21
|
-
from
|
|
18
|
+
from krons.core import EventStatus, Graph
|
|
19
|
+
from krons.types import Undefined, UndefinedType, is_sentinel
|
|
20
|
+
from krons.utils import concurrency
|
|
21
|
+
from krons.utils.concurrency import CapacityLimiter, CompletionStream
|
|
22
22
|
|
|
23
23
|
from .node import Operation
|
|
24
24
|
|
|
25
25
|
if TYPE_CHECKING:
|
|
26
|
-
from
|
|
26
|
+
from krons.session import Branch, Session
|
|
27
27
|
|
|
28
28
|
logger = logging.getLogger(__name__)
|
|
29
29
|
|
|
@@ -6,11 +6,11 @@ from typing import TYPE_CHECKING, Any
|
|
|
6
6
|
|
|
7
7
|
from pydantic import Field, PrivateAttr
|
|
8
8
|
|
|
9
|
-
from
|
|
10
|
-
from
|
|
9
|
+
from krons.core import Event, Node
|
|
10
|
+
from krons.types import Undefined, UndefinedType, is_sentinel
|
|
11
11
|
|
|
12
12
|
if TYPE_CHECKING:
|
|
13
|
-
from
|
|
13
|
+
from krons.session import Branch, Session
|
|
14
14
|
|
|
15
15
|
__all__ = ("Operation", "create_operation")
|
|
16
16
|
|
|
@@ -18,18 +18,18 @@ from typing import TYPE_CHECKING
|
|
|
18
18
|
|
|
19
19
|
# Lazy import mapping
|
|
20
20
|
_LAZY_IMPORTS: dict[str, tuple[str, str]] = {
|
|
21
|
-
"Calling": ("
|
|
22
|
-
"NormalizedResponse": ("
|
|
23
|
-
"ServiceBackend": ("
|
|
24
|
-
"ServiceConfig": ("
|
|
25
|
-
"ServiceRegistry": ("
|
|
26
|
-
"iModel": ("
|
|
27
|
-
"Endpoint": ("
|
|
28
|
-
"EndpointConfig": ("
|
|
29
|
-
"APICalling": ("
|
|
30
|
-
"HookRegistry": ("
|
|
31
|
-
"HookEvent": ("
|
|
32
|
-
"HookPhase": ("
|
|
21
|
+
"Calling": ("krons.services.backend", "Calling"),
|
|
22
|
+
"NormalizedResponse": ("krons.services.backend", "NormalizedResponse"),
|
|
23
|
+
"ServiceBackend": ("krons.services.backend", "ServiceBackend"),
|
|
24
|
+
"ServiceConfig": ("krons.services.backend", "ServiceConfig"),
|
|
25
|
+
"ServiceRegistry": ("krons.services.registry", "ServiceRegistry"),
|
|
26
|
+
"iModel": ("krons.services.imodel", "iModel"),
|
|
27
|
+
"Endpoint": ("krons.services.endpoint", "Endpoint"),
|
|
28
|
+
"EndpointConfig": ("krons.services.endpoint", "EndpointConfig"),
|
|
29
|
+
"APICalling": ("krons.services.endpoint", "APICalling"),
|
|
30
|
+
"HookRegistry": ("krons.services.hook", "HookRegistry"),
|
|
31
|
+
"HookEvent": ("krons.services.hook", "HookEvent"),
|
|
32
|
+
"HookPhase": ("krons.services.hook", "HookPhase"),
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
_LOADED: dict[str, object] = {}
|
|
@@ -49,7 +49,7 @@ def __getattr__(name: str) -> object:
|
|
|
49
49
|
_LOADED[name] = value
|
|
50
50
|
return value
|
|
51
51
|
|
|
52
|
-
raise AttributeError(f"module '
|
|
52
|
+
raise AttributeError(f"module 'krons.services' has no attribute {name!r}")
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
def __dir__() -> list[str]:
|
|
@@ -9,8 +9,8 @@ from typing import Any
|
|
|
9
9
|
|
|
10
10
|
from pydantic import BaseModel, Field, PrivateAttr, field_validator, model_validator
|
|
11
11
|
|
|
12
|
-
from
|
|
13
|
-
from
|
|
12
|
+
from krons.core import Element, Event, EventStatus
|
|
13
|
+
from krons.types import HashableModel, Unset, UnsetType, is_sentinel
|
|
14
14
|
|
|
15
15
|
from .hook import HookBroadcaster, HookEvent, HookPhase, HookRegistry
|
|
16
16
|
|
|
@@ -221,7 +221,7 @@ class Calling(Event):
|
|
|
221
221
|
class ServiceBackend(Element):
|
|
222
222
|
"""Base class for all service backends (Tool, Endpoint, etc.).
|
|
223
223
|
|
|
224
|
-
Inherits from
|
|
224
|
+
Inherits from krons.Element for UUID-based identity.
|
|
225
225
|
Subclasses must implement event_type and call() methods.
|
|
226
226
|
"""
|
|
227
227
|
|
|
@@ -9,9 +9,9 @@ from typing import Any, ClassVar, TypeVar
|
|
|
9
9
|
from pydantic import Field, PrivateAttr, field_validator
|
|
10
10
|
from typing_extensions import TypedDict
|
|
11
11
|
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
12
|
+
from krons.core import Broadcaster, Event, EventStatus
|
|
13
|
+
from krons.types import Enum, Undefined
|
|
14
|
+
from krons.utils import concurrency
|
|
15
15
|
|
|
16
16
|
SC = TypeVar("SC")
|
|
17
17
|
StreamHandlers = dict[str | type, Callable[[SC], Awaitable[None]]]
|
|
@@ -7,9 +7,9 @@ from typing import TYPE_CHECKING, Any
|
|
|
7
7
|
|
|
8
8
|
from pydantic import Field, field_serializer, field_validator
|
|
9
9
|
|
|
10
|
-
from
|
|
11
|
-
from
|
|
12
|
-
from
|
|
10
|
+
from krons.core import Element, Executor
|
|
11
|
+
from krons.protocols import Invocable, implements
|
|
12
|
+
from krons.utils.concurrency import sleep
|
|
13
13
|
|
|
14
14
|
from .backend import ServiceBackend
|
|
15
15
|
from .endpoint import Endpoint
|
|
@@ -317,7 +317,7 @@ class iModel(Element): # noqa: N801
|
|
|
317
317
|
|
|
318
318
|
def _store_claude_code_session_id(self, calling: Calling) -> None:
|
|
319
319
|
"""Extract and store Claude Code session_id for context continuation."""
|
|
320
|
-
from
|
|
320
|
+
from krons.types import is_sentinel
|
|
321
321
|
|
|
322
322
|
from .backend import NormalizedResponse
|
|
323
323
|
|
|
@@ -395,7 +395,7 @@ class iModel(Element): # noqa: N801
|
|
|
395
395
|
if not isinstance(v, dict):
|
|
396
396
|
raise ValueError("backend must be a dict or ServiceBackend instance")
|
|
397
397
|
|
|
398
|
-
from
|
|
398
|
+
from krons.core import Element
|
|
399
399
|
|
|
400
400
|
backend = Element.from_dict(v)
|
|
401
401
|
|
|
@@ -6,8 +6,8 @@ from __future__ import annotations
|
|
|
6
6
|
from typing import Any
|
|
7
7
|
from uuid import UUID
|
|
8
8
|
|
|
9
|
-
from
|
|
10
|
-
from
|
|
9
|
+
from krons.core import Pile
|
|
10
|
+
from krons.types import Undefined, UndefinedType, is_sentinel
|
|
11
11
|
|
|
12
12
|
from .imodel import iModel
|
|
13
13
|
|
|
@@ -14,16 +14,16 @@ from typing import TYPE_CHECKING, Any, Self
|
|
|
14
14
|
|
|
15
15
|
from typing_extensions import override
|
|
16
16
|
|
|
17
|
-
from
|
|
18
|
-
from
|
|
19
|
-
from
|
|
17
|
+
from krons.core import Event, Executor, Processor
|
|
18
|
+
from krons.services.endpoint import APICalling
|
|
19
|
+
from krons.utils.concurrency import get_cancelled_exc_class, sleep
|
|
20
20
|
|
|
21
21
|
from .rate_limiter import TokenBucket
|
|
22
22
|
|
|
23
23
|
if TYPE_CHECKING:
|
|
24
24
|
import asyncio
|
|
25
25
|
|
|
26
|
-
from
|
|
26
|
+
from krons.core import Pile
|
|
27
27
|
|
|
28
28
|
__all__ = ("RateLimitedExecutor", "RateLimitedProcessor")
|
|
29
29
|
|
|
@@ -8,7 +8,7 @@ from __future__ import annotations
|
|
|
8
8
|
import logging
|
|
9
9
|
from dataclasses import dataclass
|
|
10
10
|
|
|
11
|
-
from
|
|
11
|
+
from krons.utils.concurrency import Lock, current_time, sleep
|
|
12
12
|
|
|
13
13
|
__all__ = ("RateLimitConfig", "TokenBucket")
|
|
14
14
|
|
|
@@ -16,8 +16,8 @@ from dataclasses import dataclass, field
|
|
|
16
16
|
from enum import Enum
|
|
17
17
|
from typing import Any, TypedDict, TypeVar
|
|
18
18
|
|
|
19
|
-
from
|
|
20
|
-
from
|
|
19
|
+
from krons.errors import KronConnectionError
|
|
20
|
+
from krons.utils.concurrency import Lock, current_time, sleep
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
class _MetricsDict(TypedDict):
|
|
@@ -14,9 +14,9 @@ from uuid import UUID
|
|
|
14
14
|
|
|
15
15
|
from pydantic import PrivateAttr
|
|
16
16
|
|
|
17
|
-
from
|
|
18
|
-
from
|
|
19
|
-
from
|
|
17
|
+
from krons.core import Element, Flow, Pile, Progression
|
|
18
|
+
from krons.errors import ExistsError
|
|
19
|
+
from krons.utils import concurrency
|
|
20
20
|
|
|
21
21
|
from .message import Message
|
|
22
22
|
|
|
@@ -16,17 +16,17 @@ from uuid import UUID
|
|
|
16
16
|
|
|
17
17
|
from pydantic import Field
|
|
18
18
|
|
|
19
|
-
from
|
|
20
|
-
from
|
|
21
|
-
from
|
|
22
|
-
from
|
|
23
|
-
from
|
|
24
|
-
from
|
|
19
|
+
from krons.core import Element, Flow, Progression
|
|
20
|
+
from krons.errors import AccessError, NotFoundError
|
|
21
|
+
from krons.operations.node import Operation
|
|
22
|
+
from krons.operations.registry import OperationRegistry
|
|
23
|
+
from krons.services import ServiceRegistry
|
|
24
|
+
from krons.types import HashableModel, Unset, UnsetType, not_sentinel
|
|
25
25
|
|
|
26
26
|
from .message import Message
|
|
27
27
|
|
|
28
28
|
if TYPE_CHECKING:
|
|
29
|
-
from
|
|
29
|
+
from krons.services.backend import Calling
|
|
30
30
|
|
|
31
31
|
__all__ = (
|
|
32
32
|
"Branch",
|