urdyn-memory 0.1.0__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.
urdyn/__init__.py ADDED
@@ -0,0 +1,53 @@
1
+ """Urdyn Memory Engine.
2
+
3
+ A standalone, local-first, persistent, model-independent memory engine.
4
+ """
5
+
6
+ from ._errors import (
7
+ UrdynAlreadyInitializedError,
8
+ UrdynError,
9
+ UrdynManifestError,
10
+ UrdynNotFoundError,
11
+ UrdynSemanticUnavailableError,
12
+ UrdynSourceError,
13
+ UrdynStorageError,
14
+ )
15
+ from ._attempt import Attempt
16
+ from ._conflict import Conflict
17
+ from ._context import DEFAULT_CONTEXT_BUDGET, CompiledContext, ContextItem, ContextSection
18
+ from ._evidence import Evidence
19
+ from ._guard import GuardResult
20
+ from ._memory import Memory
21
+ from ._preflight import Preflight, PreflightConflict
22
+ from ._semantic_store import SemanticState
23
+ from ._skill import Skill
24
+ from ._source import SeedResult, Source, SourceObservation
25
+ from ._workspace import Urdyn, SemanticSetupResult
26
+
27
+ __all__ = [
28
+ "Urdyn",
29
+ "Memory",
30
+ "Evidence",
31
+ "Attempt",
32
+ "Preflight",
33
+ "PreflightConflict",
34
+ "CompiledContext",
35
+ "ContextSection",
36
+ "ContextItem",
37
+ "DEFAULT_CONTEXT_BUDGET",
38
+ "Skill",
39
+ "GuardResult",
40
+ "SemanticSetupResult",
41
+ "SemanticState",
42
+ "Conflict",
43
+ "Source",
44
+ "SourceObservation",
45
+ "SeedResult",
46
+ "UrdynError",
47
+ "UrdynNotFoundError",
48
+ "UrdynAlreadyInitializedError",
49
+ "UrdynManifestError",
50
+ "UrdynStorageError",
51
+ "UrdynSourceError",
52
+ "UrdynSemanticUnavailableError",
53
+ ]
urdyn/_attempt.py ADDED
@@ -0,0 +1,41 @@
1
+ """The canonical `Attempt` model.
2
+
3
+ An `Attempt` is an observable record of trying to do something: what task
4
+ was being worked on, what approach was taken, and what happened. It is not
5
+ knowledge or a conclusion (that is what `Memory`/`Lesson` are for) — it is
6
+ a fact about what was done, kept even when the outcome was failure.
7
+
8
+ Attempts are append-only: a failed attempt is never rewritten to look
9
+ successful. A later successful attempt at the same task is a separate,
10
+ independent `Attempt` record.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import dataclasses
16
+ import datetime as dt
17
+ import re
18
+
19
+ ATTEMPT_ID_PATTERN = re.compile(r"[0-9a-f]{32}")
20
+
21
+ OUTCOME_SUCCEEDED = "succeeded"
22
+ OUTCOME_FAILED = "failed"
23
+ OUTCOME_PARTIAL = "partial"
24
+ VALID_OUTCOMES = frozenset({OUTCOME_SUCCEEDED, OUTCOME_FAILED, OUTCOME_PARTIAL})
25
+
26
+
27
+ @dataclasses.dataclass(frozen=True, slots=True)
28
+ class Attempt:
29
+ """A single recorded attempt at a task, persisted by Urdyn.
30
+
31
+ `evidence_ids` is the same provenance mechanism used by `Memory`: the
32
+ ids of `Evidence` supporting what happened (e.g. an error message or a
33
+ test result), not a copy of that evidence's content.
34
+ """
35
+
36
+ attempt_id: str
37
+ task: str
38
+ approach: str
39
+ outcome: str
40
+ recorded_at: dt.datetime
41
+ evidence_ids: tuple[str, ...] = ()