harborrag-memory 2.0.0a1__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.
- harborrag_memory/__init__.py +63 -0
- harborrag_memory/config.py +19 -0
- harborrag_memory/errors.py +21 -0
- harborrag_memory/manager.py +148 -0
- harborrag_memory/schemas.py +32 -0
- harborrag_memory/tiers/__init__.py +15 -0
- harborrag_memory/tiers/long_term.py +57 -0
- harborrag_memory/tiers/short_term.py +45 -0
- harborrag_memory/tiers/working.py +94 -0
- harborrag_memory-2.0.0a1.dist-info/METADATA +128 -0
- harborrag_memory-2.0.0a1.dist-info/RECORD +13 -0
- harborrag_memory-2.0.0a1.dist-info/WHEEL +4 -0
- harborrag_memory-2.0.0a1.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""Scope-aware short-term, working, and long-term memory for HarborRAG."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from harborrag_core.ports.conversation import (
|
|
6
|
+
ConversationIdentity,
|
|
7
|
+
ConversationMemory,
|
|
8
|
+
ConversationRepository,
|
|
9
|
+
ConversationSessions,
|
|
10
|
+
ConversationTurn,
|
|
11
|
+
new_session_id,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
from .config import MemoryManagerConfig
|
|
15
|
+
from .errors import MemoryConfigurationError, MemoryError, MemoryScopeError
|
|
16
|
+
from .manager import MemoryManager, MemorySnapshot
|
|
17
|
+
from .schemas import (
|
|
18
|
+
Memory,
|
|
19
|
+
MemoryOwner,
|
|
20
|
+
MemoryQuery,
|
|
21
|
+
MemoryRepository,
|
|
22
|
+
MemoryScope,
|
|
23
|
+
MemoryType,
|
|
24
|
+
new_memory_id,
|
|
25
|
+
scope_owner_fields,
|
|
26
|
+
visible_to,
|
|
27
|
+
)
|
|
28
|
+
from .tiers import (
|
|
29
|
+
InMemoryWorkingMemoryStore,
|
|
30
|
+
LongTermMemory,
|
|
31
|
+
ShortTermMemory,
|
|
32
|
+
WorkingMemory,
|
|
33
|
+
WorkingMemoryStore,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
__all__ = [
|
|
37
|
+
"ConversationIdentity",
|
|
38
|
+
"ConversationMemory",
|
|
39
|
+
"ConversationTurn",
|
|
40
|
+
"InMemoryWorkingMemoryStore",
|
|
41
|
+
"LongTermMemory",
|
|
42
|
+
"ConversationRepository",
|
|
43
|
+
"ConversationSessions",
|
|
44
|
+
"Memory",
|
|
45
|
+
"MemoryConfigurationError",
|
|
46
|
+
"MemoryError",
|
|
47
|
+
"MemoryManager",
|
|
48
|
+
"MemoryManagerConfig",
|
|
49
|
+
"MemoryOwner",
|
|
50
|
+
"MemoryQuery",
|
|
51
|
+
"MemoryRepository",
|
|
52
|
+
"MemoryScope",
|
|
53
|
+
"MemoryScopeError",
|
|
54
|
+
"MemorySnapshot",
|
|
55
|
+
"MemoryType",
|
|
56
|
+
"ShortTermMemory",
|
|
57
|
+
"WorkingMemory",
|
|
58
|
+
"WorkingMemoryStore",
|
|
59
|
+
"new_memory_id",
|
|
60
|
+
"new_session_id",
|
|
61
|
+
"scope_owner_fields",
|
|
62
|
+
"visible_to",
|
|
63
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Configuration objects for the memory facade."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(frozen=True, slots=True)
|
|
9
|
+
class MemoryManagerConfig:
|
|
10
|
+
"""Default behavior for the top-level memory facade."""
|
|
11
|
+
|
|
12
|
+
recent_turn_limit: int = 2
|
|
13
|
+
working_ttl_seconds: int = 3600
|
|
14
|
+
|
|
15
|
+
def __post_init__(self) -> None:
|
|
16
|
+
if not 1 <= self.recent_turn_limit <= 1000:
|
|
17
|
+
raise ValueError("recent_turn_limit must be between 1 and 1000")
|
|
18
|
+
if not 1 <= self.working_ttl_seconds <= 31_536_000:
|
|
19
|
+
raise ValueError("working_ttl_seconds must be between 1 and 31536000")
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Memory-specific exceptions."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from harborrag_core.contracts.errors import (
|
|
6
|
+
HarborConfigurationError,
|
|
7
|
+
HarborError,
|
|
8
|
+
HarborSecurityError,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class MemoryError(HarborError):
|
|
13
|
+
"""Base class for memory orchestration errors."""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class MemoryConfigurationError(HarborConfigurationError, MemoryError):
|
|
17
|
+
"""Raised when a caller asks for a memory capability that is not configured."""
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class MemoryScopeError(HarborSecurityError, MemoryError):
|
|
21
|
+
"""Raised when a caller provides an owner that does not satisfy a scope."""
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"""Top-level memory orchestration facade.
|
|
2
|
+
|
|
3
|
+
Chat and agent code can use this as a single entry point while the actual
|
|
4
|
+
storage and retrieval responsibilities remain split between the tier-specific
|
|
5
|
+
facades and their adapter-backed repositories.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import asyncio
|
|
11
|
+
from collections.abc import Mapping
|
|
12
|
+
from dataclasses import dataclass, field
|
|
13
|
+
from typing import Any
|
|
14
|
+
|
|
15
|
+
from harborrag_core.chunking.metadata import FrozenMetadata
|
|
16
|
+
from harborrag_core.ports.conversation import ConversationTurn
|
|
17
|
+
from harborrag_core.ports.memory import Memory, MemoryOwner, MemoryQuery
|
|
18
|
+
|
|
19
|
+
from .config import MemoryManagerConfig
|
|
20
|
+
from .errors import MemoryConfigurationError, MemoryScopeError
|
|
21
|
+
from .tiers import LongTermMemory, ShortTermMemory, WorkingMemory
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@dataclass(frozen=True, slots=True)
|
|
25
|
+
class MemorySnapshot:
|
|
26
|
+
"""One read-only view of the caller's current memory state."""
|
|
27
|
+
|
|
28
|
+
recent_turns: tuple[ConversationTurn, ...] = ()
|
|
29
|
+
working_state: Mapping[str, Any] = field(default_factory=FrozenMetadata)
|
|
30
|
+
memories: tuple[Memory, ...] = ()
|
|
31
|
+
|
|
32
|
+
def __post_init__(self) -> None:
|
|
33
|
+
object.__setattr__(self, "working_state", FrozenMetadata(self.working_state))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class MemoryManager:
|
|
37
|
+
"""Single facade for short-term, working, and long-term memory."""
|
|
38
|
+
|
|
39
|
+
def __init__(
|
|
40
|
+
self,
|
|
41
|
+
short_term: ShortTermMemory | None = None,
|
|
42
|
+
working: WorkingMemory | None = None,
|
|
43
|
+
long_term: LongTermMemory | None = None,
|
|
44
|
+
*,
|
|
45
|
+
config: MemoryManagerConfig | None = None,
|
|
46
|
+
) -> None:
|
|
47
|
+
self._short_term = short_term
|
|
48
|
+
self._working = working
|
|
49
|
+
self._long_term = long_term
|
|
50
|
+
self._config = config or MemoryManagerConfig()
|
|
51
|
+
|
|
52
|
+
async def recent(
|
|
53
|
+
self, owner: MemoryOwner, *, limit: int | None = None
|
|
54
|
+
) -> tuple[ConversationTurn, ...]:
|
|
55
|
+
selected_limit = self._config.recent_turn_limit if limit is None else limit
|
|
56
|
+
return await self._require_short_term().recent(owner, limit=selected_limit)
|
|
57
|
+
|
|
58
|
+
async def append(self, owner: MemoryOwner, turn: ConversationTurn) -> None:
|
|
59
|
+
await self._require_short_term().append(owner, turn)
|
|
60
|
+
|
|
61
|
+
async def clear(self, owner: MemoryOwner) -> None:
|
|
62
|
+
await self._require_short_term().clear(owner)
|
|
63
|
+
|
|
64
|
+
async def scratch(self, owner: MemoryOwner) -> dict[str, Any]:
|
|
65
|
+
return await self._require_working().scratch(owner)
|
|
66
|
+
|
|
67
|
+
async def update(
|
|
68
|
+
self,
|
|
69
|
+
owner: MemoryOwner,
|
|
70
|
+
state: dict[str, Any],
|
|
71
|
+
*,
|
|
72
|
+
ttl_seconds: int | None = None,
|
|
73
|
+
) -> None:
|
|
74
|
+
await self._require_working().update(owner, state, ttl_seconds=ttl_seconds)
|
|
75
|
+
|
|
76
|
+
async def clear_working(self, owner: MemoryOwner) -> None:
|
|
77
|
+
await self._require_working().clear(owner)
|
|
78
|
+
|
|
79
|
+
async def save(self, caller: MemoryOwner, memory: Memory) -> None:
|
|
80
|
+
await self._require_long_term().save(caller, memory)
|
|
81
|
+
|
|
82
|
+
async def get(self, caller: MemoryOwner, memory_id: str) -> Memory | None:
|
|
83
|
+
return await self._require_long_term().get(caller, memory_id)
|
|
84
|
+
|
|
85
|
+
async def search(self, caller: MemoryOwner, query: MemoryQuery) -> tuple[Memory, ...]:
|
|
86
|
+
return await self._require_long_term().search(caller, query)
|
|
87
|
+
|
|
88
|
+
async def delete(self, caller: MemoryOwner, memory_id: str) -> None:
|
|
89
|
+
await self._require_long_term().delete(caller, memory_id)
|
|
90
|
+
|
|
91
|
+
async def snapshot(
|
|
92
|
+
self,
|
|
93
|
+
owner: MemoryOwner,
|
|
94
|
+
*,
|
|
95
|
+
query: MemoryQuery | None = None,
|
|
96
|
+
recent_limit: int | None = None,
|
|
97
|
+
) -> MemorySnapshot:
|
|
98
|
+
if query is not None and query.owner != owner:
|
|
99
|
+
raise MemoryScopeError("snapshot query owner must match the authenticated caller")
|
|
100
|
+
selected_limit = self._config.recent_turn_limit if recent_limit is None else recent_limit
|
|
101
|
+
recent_call = (
|
|
102
|
+
self._short_term.recent(owner, limit=selected_limit)
|
|
103
|
+
if self._short_term is not None
|
|
104
|
+
else _empty_turns()
|
|
105
|
+
)
|
|
106
|
+
working_call = (
|
|
107
|
+
self._working.scratch(owner) if self._working is not None else _empty_working_state()
|
|
108
|
+
)
|
|
109
|
+
memory_call = (
|
|
110
|
+
self._long_term.search(owner, query)
|
|
111
|
+
if query is not None and self._long_term is not None
|
|
112
|
+
else _empty_memories()
|
|
113
|
+
)
|
|
114
|
+
recent_turns, working_state, memories = await asyncio.gather(
|
|
115
|
+
recent_call, working_call, memory_call
|
|
116
|
+
)
|
|
117
|
+
return MemorySnapshot(
|
|
118
|
+
recent_turns=recent_turns,
|
|
119
|
+
working_state=working_state,
|
|
120
|
+
memories=memories,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
def _require_short_term(self) -> ShortTermMemory:
|
|
124
|
+
if self._short_term is None:
|
|
125
|
+
raise MemoryConfigurationError("short-term memory is not configured")
|
|
126
|
+
return self._short_term
|
|
127
|
+
|
|
128
|
+
def _require_working(self) -> WorkingMemory:
|
|
129
|
+
if self._working is None:
|
|
130
|
+
raise MemoryConfigurationError("working memory is not configured")
|
|
131
|
+
return self._working
|
|
132
|
+
|
|
133
|
+
def _require_long_term(self) -> LongTermMemory:
|
|
134
|
+
if self._long_term is None:
|
|
135
|
+
raise MemoryConfigurationError("long-term memory is not configured")
|
|
136
|
+
return self._long_term
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
async def _empty_turns() -> tuple[ConversationTurn, ...]:
|
|
140
|
+
return ()
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
async def _empty_working_state() -> dict[str, Any]:
|
|
144
|
+
return {}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
async def _empty_memories() -> tuple[Memory, ...]:
|
|
148
|
+
return ()
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""Canonical HarborRAG memory schema exports.
|
|
2
|
+
|
|
3
|
+
The core package owns the actual dataclasses and protocols. This module gives
|
|
4
|
+
``harborrag-memory`` a stable, first-class import surface for the shared memory
|
|
5
|
+
model without duplicating the types.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from harborrag_core.ports.memory import (
|
|
11
|
+
Memory,
|
|
12
|
+
MemoryOwner,
|
|
13
|
+
MemoryQuery,
|
|
14
|
+
MemoryRepository,
|
|
15
|
+
MemoryScope,
|
|
16
|
+
MemoryType,
|
|
17
|
+
new_memory_id,
|
|
18
|
+
scope_owner_fields,
|
|
19
|
+
visible_to,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
"Memory",
|
|
24
|
+
"MemoryOwner",
|
|
25
|
+
"MemoryQuery",
|
|
26
|
+
"MemoryRepository",
|
|
27
|
+
"MemoryScope",
|
|
28
|
+
"MemoryType",
|
|
29
|
+
"new_memory_id",
|
|
30
|
+
"scope_owner_fields",
|
|
31
|
+
"visible_to",
|
|
32
|
+
]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Memory tiers: short-term, working, and long-term."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .long_term import LongTermMemory
|
|
6
|
+
from .short_term import ShortTermMemory
|
|
7
|
+
from .working import InMemoryWorkingMemoryStore, WorkingMemory, WorkingMemoryStore
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"InMemoryWorkingMemoryStore",
|
|
11
|
+
"LongTermMemory",
|
|
12
|
+
"ShortTermMemory",
|
|
13
|
+
"WorkingMemory",
|
|
14
|
+
"WorkingMemoryStore",
|
|
15
|
+
]
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""Long-term memory tier: durable, searchable memories scoped by owner."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from harborrag_core.ports.memory import (
|
|
6
|
+
Memory,
|
|
7
|
+
MemoryOwner,
|
|
8
|
+
MemoryQuery,
|
|
9
|
+
MemoryRepository,
|
|
10
|
+
MemoryScope,
|
|
11
|
+
visible_to,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
from ..errors import MemoryScopeError
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class LongTermMemory:
|
|
18
|
+
"""Facade over the canonical long-term memory repository."""
|
|
19
|
+
|
|
20
|
+
def __init__(self, repository: MemoryRepository) -> None:
|
|
21
|
+
self._repository = repository
|
|
22
|
+
|
|
23
|
+
async def save(self, caller: MemoryOwner, memory: Memory) -> None:
|
|
24
|
+
_authorize_write(caller, memory)
|
|
25
|
+
await self._repository.save(memory)
|
|
26
|
+
|
|
27
|
+
async def remember(self, caller: MemoryOwner, memory: Memory) -> None:
|
|
28
|
+
"""Alias for :meth:`save`."""
|
|
29
|
+
|
|
30
|
+
await self.save(caller, memory)
|
|
31
|
+
|
|
32
|
+
async def get(self, caller: MemoryOwner, memory_id: str) -> Memory | None:
|
|
33
|
+
return await self._repository.get(caller, memory_id)
|
|
34
|
+
|
|
35
|
+
async def search(self, caller: MemoryOwner, query: MemoryQuery) -> tuple[Memory, ...]:
|
|
36
|
+
_require_same_owner(caller, query.owner)
|
|
37
|
+
return await self._repository.search(query)
|
|
38
|
+
|
|
39
|
+
async def delete(self, caller: MemoryOwner, memory_id: str) -> None:
|
|
40
|
+
await self._repository.delete(caller, memory_id)
|
|
41
|
+
|
|
42
|
+
async def forget(self, caller: MemoryOwner, memory_id: str) -> None:
|
|
43
|
+
await self.delete(caller, memory_id)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _authorize_write(caller: MemoryOwner, memory: Memory) -> None:
|
|
47
|
+
if memory.scope is MemoryScope.GLOBAL:
|
|
48
|
+
raise MemoryScopeError("global memory writes require an administrative capability")
|
|
49
|
+
if caller.tenant_id != memory.owner.tenant_id or not visible_to(
|
|
50
|
+
memory.scope, memory.owner, caller
|
|
51
|
+
):
|
|
52
|
+
raise MemoryScopeError("caller is not authorized to write memory for this owner")
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _require_same_owner(caller: MemoryOwner, requested: MemoryOwner) -> None:
|
|
56
|
+
if caller != requested:
|
|
57
|
+
raise MemoryScopeError("memory query owner must match the authenticated caller")
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""Short-term (conversation) memory tier."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from harborrag_core.ports.conversation import (
|
|
6
|
+
ConversationIdentity,
|
|
7
|
+
ConversationRepository,
|
|
8
|
+
ConversationTurn,
|
|
9
|
+
)
|
|
10
|
+
from harborrag_core.ports.memory import MemoryOwner
|
|
11
|
+
|
|
12
|
+
from ..errors import MemoryScopeError
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ShortTermMemory:
|
|
16
|
+
"""Recent-turn memory for one authenticated conversation session."""
|
|
17
|
+
|
|
18
|
+
def __init__(self, conversation: ConversationRepository) -> None:
|
|
19
|
+
self._conversation = conversation
|
|
20
|
+
|
|
21
|
+
async def recent(self, owner: MemoryOwner, *, limit: int = 2) -> tuple[ConversationTurn, ...]:
|
|
22
|
+
if not 1 <= limit <= 1000:
|
|
23
|
+
raise ValueError("recent memory limit must be between 1 and 1000")
|
|
24
|
+
return await self._conversation.recent(_conversation_identity(owner), limit=limit)
|
|
25
|
+
|
|
26
|
+
async def append(self, owner: MemoryOwner, turn: ConversationTurn) -> None:
|
|
27
|
+
await self._conversation.append(_conversation_identity(owner), turn)
|
|
28
|
+
|
|
29
|
+
async def record(self, owner: MemoryOwner, turn: ConversationTurn) -> None:
|
|
30
|
+
"""Compatibility alias for :meth:`append`."""
|
|
31
|
+
|
|
32
|
+
await self.append(owner, turn)
|
|
33
|
+
|
|
34
|
+
async def clear(self, owner: MemoryOwner) -> None:
|
|
35
|
+
await self._conversation.clear(_conversation_identity(owner))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _conversation_identity(owner: MemoryOwner) -> ConversationIdentity:
|
|
39
|
+
if owner.principal_id is None or owner.session_id is None:
|
|
40
|
+
raise MemoryScopeError("short-term memory requires principal_id and session_id")
|
|
41
|
+
return ConversationIdentity(
|
|
42
|
+
tenant_id=owner.tenant_id,
|
|
43
|
+
principal_id=owner.principal_id,
|
|
44
|
+
session_id=owner.session_id,
|
|
45
|
+
)
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
from copy import deepcopy
|
|
5
|
+
from time import monotonic
|
|
6
|
+
from typing import Any, Protocol
|
|
7
|
+
|
|
8
|
+
from harborrag_core.ports.memory import MemoryOwner
|
|
9
|
+
|
|
10
|
+
from ..errors import MemoryScopeError
|
|
11
|
+
|
|
12
|
+
_MAX_TTL_SECONDS = 31_536_000
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class WorkingMemoryStore(Protocol):
|
|
16
|
+
"""Persistence-neutral contract for one run's scratch state."""
|
|
17
|
+
|
|
18
|
+
async def get(self, owner: MemoryOwner) -> dict[str, Any] | None: ...
|
|
19
|
+
|
|
20
|
+
async def put(self, owner: MemoryOwner, state: dict[str, Any], *, ttl_seconds: int) -> None: ...
|
|
21
|
+
|
|
22
|
+
async def delete(self, owner: MemoryOwner) -> None: ...
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class InMemoryWorkingMemoryStore:
|
|
26
|
+
"""Process-local ``WorkingMemoryStore`` for tests and unconfigured runtimes."""
|
|
27
|
+
|
|
28
|
+
def __init__(self) -> None:
|
|
29
|
+
self._values: dict[MemoryOwner, tuple[float, dict[str, Any]]] = {}
|
|
30
|
+
self._lock = asyncio.Lock()
|
|
31
|
+
|
|
32
|
+
async def get(self, owner: MemoryOwner) -> dict[str, Any] | None:
|
|
33
|
+
_require_run_owner(owner)
|
|
34
|
+
async with self._lock:
|
|
35
|
+
entry = self._values.get(owner)
|
|
36
|
+
if entry is None:
|
|
37
|
+
return None
|
|
38
|
+
expires_at, state = entry
|
|
39
|
+
if expires_at <= monotonic():
|
|
40
|
+
self._values.pop(owner, None)
|
|
41
|
+
return None
|
|
42
|
+
return deepcopy(state)
|
|
43
|
+
|
|
44
|
+
async def put(self, owner: MemoryOwner, state: dict[str, Any], *, ttl_seconds: int) -> None:
|
|
45
|
+
_require_run_owner(owner)
|
|
46
|
+
_validate_ttl(ttl_seconds)
|
|
47
|
+
async with self._lock:
|
|
48
|
+
self._values[owner] = (monotonic() + ttl_seconds, deepcopy(state))
|
|
49
|
+
|
|
50
|
+
async def delete(self, owner: MemoryOwner) -> None:
|
|
51
|
+
_require_run_owner(owner)
|
|
52
|
+
async with self._lock:
|
|
53
|
+
self._values.pop(owner, None)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class WorkingMemory:
|
|
57
|
+
"""Scratch state scoped to one agent run, expiring after its TTL."""
|
|
58
|
+
|
|
59
|
+
def __init__(self, store: WorkingMemoryStore, *, default_ttl_seconds: int = 3600) -> None:
|
|
60
|
+
_validate_ttl(default_ttl_seconds)
|
|
61
|
+
self._store = store
|
|
62
|
+
self._default_ttl_seconds = default_ttl_seconds
|
|
63
|
+
|
|
64
|
+
async def scratch(self, owner: MemoryOwner) -> dict[str, Any]:
|
|
65
|
+
_require_run_owner(owner)
|
|
66
|
+
return await self._store.get(owner) or {}
|
|
67
|
+
|
|
68
|
+
async def update(
|
|
69
|
+
self,
|
|
70
|
+
owner: MemoryOwner,
|
|
71
|
+
state: dict[str, Any],
|
|
72
|
+
*,
|
|
73
|
+
ttl_seconds: int | None = None,
|
|
74
|
+
) -> None:
|
|
75
|
+
_require_run_owner(owner)
|
|
76
|
+
selected_ttl = self._default_ttl_seconds if ttl_seconds is None else ttl_seconds
|
|
77
|
+
_validate_ttl(selected_ttl)
|
|
78
|
+
await self._store.put(owner, deepcopy(state), ttl_seconds=selected_ttl)
|
|
79
|
+
|
|
80
|
+
async def clear(self, owner: MemoryOwner) -> None:
|
|
81
|
+
_require_run_owner(owner)
|
|
82
|
+
await self._store.delete(owner)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _require_run_owner(owner: MemoryOwner) -> None:
|
|
86
|
+
if owner.principal_id is None or owner.session_id is None or owner.run_id is None:
|
|
87
|
+
raise MemoryScopeError(
|
|
88
|
+
"working memory requires tenant_id, principal_id, session_id, and run_id"
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _validate_ttl(ttl_seconds: int) -> None:
|
|
93
|
+
if not 1 <= ttl_seconds <= _MAX_TTL_SECONDS:
|
|
94
|
+
raise ValueError(f"working memory TTL must be between 1 and {_MAX_TTL_SECONDS}")
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: harborrag-memory
|
|
3
|
+
Version: 2.0.0a1
|
|
4
|
+
Summary: Scope-aware short-term, working, and long-term memory for HarborRAG.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.12
|
|
8
|
+
Requires-Dist: harborrag-core==2.0.0a1
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
|
|
11
|
+
# harborrag-memory
|
|
12
|
+
|
|
13
|
+
Scope-aware memory shared by chat and agent orchestration in
|
|
14
|
+
[HarborRAG](https://github.com/cbtw-apac/HarborRAG). This package owns the memory facade;
|
|
15
|
+
storage lives in `harborrag-adapters` and the contracts live in `harborrag-core`.
|
|
16
|
+
|
|
17
|
+
It is a required dependency of `harborrag-runtime`, so any HarborRAG install already has it.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install harborrag-memory
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Three tiers, one facade
|
|
24
|
+
|
|
25
|
+
| Tier | Holds | Lifetime |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| Short-term | conversation turns | the session |
|
|
28
|
+
| Working | per-run scratch state | the run, bounded by a TTL |
|
|
29
|
+
| Long-term | durable memories in a repository | until deleted |
|
|
30
|
+
|
|
31
|
+
`MemoryManager` is the single facade chat and agent code imports. Each tier is optional -
|
|
32
|
+
pass only the ones you configured, and calling into an unconfigured tier raises
|
|
33
|
+
`MemoryConfigurationError`.
|
|
34
|
+
|
|
35
|
+
## Everything is scoped by `MemoryOwner`
|
|
36
|
+
|
|
37
|
+
Every public operation takes a `MemoryOwner`: the isolation key a memory is written under,
|
|
38
|
+
or the identity a query is issued as.
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from harborrag_memory import MemoryOwner
|
|
42
|
+
|
|
43
|
+
owner = MemoryOwner(
|
|
44
|
+
tenant_id="tenant-1",
|
|
45
|
+
project_id="handbook",
|
|
46
|
+
principal_id="user-1",
|
|
47
|
+
session_id="session-1",
|
|
48
|
+
run_id="run-1",
|
|
49
|
+
)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
How much of that owner is load-bearing depends on the memory's `MemoryScope`:
|
|
53
|
+
|
|
54
|
+
| Scope | Owner fields that must match |
|
|
55
|
+
| --- | --- |
|
|
56
|
+
| `GLOBAL` | none |
|
|
57
|
+
| `TENANT` | `tenant_id` |
|
|
58
|
+
| `PROJECT` | `tenant_id`, `project_id` |
|
|
59
|
+
| `USER` | `tenant_id`, `principal_id` |
|
|
60
|
+
| `SESSION` | `tenant_id`, `principal_id`, `session_id` |
|
|
61
|
+
| `RUN` | every field through `run_id` |
|
|
62
|
+
|
|
63
|
+
> **Security rule.** Build the owner from authenticated request context. Never pass
|
|
64
|
+
> user-supplied owner fields through - doing so lets a caller read another tenant's,
|
|
65
|
+
> project's, or user's memory. `snapshot()` enforces this by rejecting a query whose owner
|
|
66
|
+
> does not match the authenticated caller.
|
|
67
|
+
|
|
68
|
+
## Worked example
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import asyncio
|
|
72
|
+
|
|
73
|
+
from harborrag_memory import (
|
|
74
|
+
InMemoryWorkingMemoryStore,
|
|
75
|
+
MemoryManager,
|
|
76
|
+
MemoryOwner,
|
|
77
|
+
WorkingMemory,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
async def main() -> None:
|
|
82
|
+
owner = MemoryOwner(
|
|
83
|
+
tenant_id="tenant-1",
|
|
84
|
+
principal_id="user-1",
|
|
85
|
+
session_id="session-1",
|
|
86
|
+
run_id="run-1",
|
|
87
|
+
)
|
|
88
|
+
memory = MemoryManager(working=WorkingMemory(InMemoryWorkingMemoryStore()))
|
|
89
|
+
|
|
90
|
+
await memory.update(owner, {"step": "retrieval", "candidates": 12})
|
|
91
|
+
print(await memory.scratch(owner)) # {'step': 'retrieval', 'candidates': 12}
|
|
92
|
+
|
|
93
|
+
snapshot = await memory.snapshot(owner) # recent turns + working state + memories
|
|
94
|
+
print(snapshot.working_state)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
asyncio.run(main())
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Facade surface
|
|
101
|
+
|
|
102
|
+
| Tier | Methods |
|
|
103
|
+
| --- | --- |
|
|
104
|
+
| Short-term | `recent(owner, limit=...)`, `append(owner, turn)`, `clear(owner)` |
|
|
105
|
+
| Working | `scratch(owner)`, `update(owner, state, ttl_seconds=...)`, `clear_working(owner)` |
|
|
106
|
+
| Long-term | `save(caller, memory)`, `get(caller, memory_id)`, `search(caller, query)`, `delete(caller, memory_id)` |
|
|
107
|
+
| Combined | `snapshot(owner, query=..., recent_limit=...)` |
|
|
108
|
+
|
|
109
|
+
## Module ownership
|
|
110
|
+
|
|
111
|
+
- `tiers/short_term.py` - conversation history facade.
|
|
112
|
+
- `tiers/working.py` - per-run scratch state facade and local store.
|
|
113
|
+
- `tiers/long_term.py` - canonical repository facade for durable memory.
|
|
114
|
+
- `manager.py` - `MemoryManager`, the single facade chat and agent import.
|
|
115
|
+
- `schemas.py` - stable re-exports of the core-owned memory contracts.
|
|
116
|
+
- `config.py` - `MemoryManagerConfig`, including the default recent-turn limit.
|
|
117
|
+
- `errors.py` - `MemoryError`, `MemoryConfigurationError`, `MemoryScopeError`.
|
|
118
|
+
|
|
119
|
+
## Development
|
|
120
|
+
|
|
121
|
+
Tests for this package live in `packages/harborrag-memory/tests/`. Run them from the
|
|
122
|
+
repository root:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
uv run pytest packages/harborrag-memory/tests
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Licensed under the Apache License 2.0.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
harborrag_memory/__init__.py,sha256=k4DWuET3Swb0crKv3CXHAd7fcuNVPz03TuLHezALLcs,1422
|
|
2
|
+
harborrag_memory/config.py,sha256=MWiuefpn2YRHen7_HgY6kzOPhVNG1QYgxI5I-yXLUnk,625
|
|
3
|
+
harborrag_memory/errors.py,sha256=L0odKpr6TYYfMSnxV6m58x_yK2siredWYbwm4zC8KJg,576
|
|
4
|
+
harborrag_memory/manager.py,sha256=Ip7qpp7yagGqaaEnaHGTfgAeG2ss6mPcYQOHmFm77q8,5328
|
|
5
|
+
harborrag_memory/schemas.py,sha256=1hiVFbrPy0GR3pJYurnjzN11aLhoiAkHxzopvWlOEXo,680
|
|
6
|
+
harborrag_memory/tiers/__init__.py,sha256=OYzz6bBf_oJRxyphFVkmP_Pb-FrGQTb4PM378eB_sVU,395
|
|
7
|
+
harborrag_memory/tiers/long_term.py,sha256=jF-Z0Ywf_gi5RzyFl-b360zBtenMNi8dWR2c_KKTwGE,1992
|
|
8
|
+
harborrag_memory/tiers/short_term.py,sha256=LfyYSWqPCmMzIWmnfOdj6Sb-KHaISE9JDSMwtLk-r4c,1652
|
|
9
|
+
harborrag_memory/tiers/working.py,sha256=iKjxYXMqtZkD_beGxs6o_ZGgj8fhQn_iW-6W4lJ4kv0,3192
|
|
10
|
+
harborrag_memory-2.0.0a1.dist-info/METADATA,sha256=Ihm0ZOKUek-mOM3o1JlzfbFldGFQCsr7UyROfI-anns,4080
|
|
11
|
+
harborrag_memory-2.0.0a1.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
12
|
+
harborrag_memory-2.0.0a1.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
13
|
+
harborrag_memory-2.0.0a1.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|