memwal 0.2.3.dev0__tar.gz → 0.2.3.dev2__tar.gz
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.
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/CHANGELOG.md +6 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/PKG-INFO +1 -1
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/memwal/__init__.py +1 -1
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/memwal/client.py +17 -9
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/memwal/mock.py +1 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/memwal/types.py +11 -3
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/pyproject.toml +1 -1
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_client.py +50 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_missing_response_fields.py +1 -1
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/.gitignore +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/README.md +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/examples/.env.example +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/examples/.gitignore +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/examples/async_remember_demo.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/examples/interactive_demo.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/examples/verify_credentials.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/memwal/compatibility.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/memwal/middleware.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/memwal/utils.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/notebooks/walrus_memory_python_sdk.ipynb +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/run_tests.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/__init__.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_ask_validation.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_auth_rejected_message.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_blank_text.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_destroy_and_cancel_shield.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_empty_namespace.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_env_presets.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_forget.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_integration.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_json_body.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_list_namespaces.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_middleware.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_mock.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_nonfinite_validation.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_normalize_server_url.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_polling_delay.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_recall_validation.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_recall_weights.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_remember_derived_key.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_retry_after_http_date.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_signing.py +0 -0
- {memwal-0.2.3.dev0 → memwal-0.2.3.dev2}/tests/test_transport_retry.py +0 -0
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# memwal
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `RestoreResult` includes additive `source_capped` (defaults to `False` when an older relayer omits it). Raising `limit` only lets restore see more blobs when `source_capped` is true and `limit < 20`; when `source_capped` is true and `truncated` is false, blobs past the owner-wide candidate cap are not reachable by retry.
|
|
8
|
+
|
|
3
9
|
## 0.2.3
|
|
4
10
|
|
|
5
11
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: memwal
|
|
3
|
-
Version: 0.2.3.
|
|
3
|
+
Version: 0.2.3.dev2
|
|
4
4
|
Summary: Python SDK for Walrus Memory — Privacy-first AI memory with Ed25519 signing
|
|
5
5
|
Project-URL: Homepage, https://memory.walrus.xyz
|
|
6
6
|
Project-URL: Documentation, https://memory.walrus.xyz
|
|
@@ -1495,14 +1495,20 @@ class MemWal:
|
|
|
1495
1495
|
negative-cache hits plus any new permanent failures this call.
|
|
1496
1496
|
Transient download/decrypt/embed errors are not counted here; when
|
|
1497
1497
|
a page yields only those, ``truncated`` is true so the caller
|
|
1498
|
-
retries.
|
|
1499
|
-
|
|
1498
|
+
retries. A mixed or all-permanent page leaves ``truncated`` as the
|
|
1499
|
+
limit/cap rules set it. Defaults to ``0`` when talking to a
|
|
1500
|
+
relayer older than COMG-719 that omits the field.
|
|
1500
1501
|
* ``total`` — count of on-chain blobs the relayer saw for
|
|
1501
|
-
``(owner, namespace)`` before the limit was applied
|
|
1502
|
+
``(owner, namespace)`` before the limit was applied (only blobs
|
|
1503
|
+
inside the sidecar fetch).
|
|
1502
1504
|
* ``truncated`` — True when this restore is known-incomplete (limit
|
|
1503
1505
|
truncation or an upstream on-chain candidate-fetch cap; see
|
|
1504
1506
|
:class:`~memwal.types.RestoreResult`). Defaults to ``False`` when
|
|
1505
1507
|
talking to a relayer older than WALM-319 that omits the field.
|
|
1508
|
+
* ``source_capped`` — the sidecar's owner-wide candidate fetch hit
|
|
1509
|
+
its cap (``min(limit * 5, 100)``). Independent of ``truncated``.
|
|
1510
|
+
Defaults to ``False`` when talking to a relayer older than
|
|
1511
|
+
WALM-451 that omits the field.
|
|
1506
1512
|
|
|
1507
1513
|
Args:
|
|
1508
1514
|
namespace: Namespace to restore. Exact match — no prefix or
|
|
@@ -1517,12 +1523,12 @@ class MemWal:
|
|
|
1517
1523
|
:class:`RestoreResult`.
|
|
1518
1524
|
|
|
1519
1525
|
Notes:
|
|
1520
|
-
* **No pagination cursor** — restore is single-shot.
|
|
1521
|
-
``limit``
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
+
* **No pagination cursor** — restore is single-shot. Raising
|
|
1527
|
+
``limit`` only lets restore see more blobs when
|
|
1528
|
+
``source_capped`` is true and ``limit < 20`` (that expands the
|
|
1529
|
+
candidate fetch up to 100). When ``source_capped`` is true and
|
|
1530
|
+
``truncated`` is false, blobs past the owner-wide cap stay out
|
|
1531
|
+
of reach; retrying cannot surface them.
|
|
1526
1532
|
* **Performance** scales linearly in ``limit``: up to 10 Walrus
|
|
1527
1533
|
downloads in parallel, then 3 SEAL decrypts in parallel, then
|
|
1528
1534
|
embeddings. Expect seconds-per-blob on cold caches.
|
|
@@ -1545,6 +1551,8 @@ class MemWal:
|
|
|
1545
1551
|
truncated=data.get("truncated", False),
|
|
1546
1552
|
# Relayers older than COMG-719 omit `failed`; default to 0.
|
|
1547
1553
|
failed=data.get("failed", 0),
|
|
1554
|
+
# Relayers older than WALM-451 omit `source_capped`; default to False.
|
|
1555
|
+
source_capped=data.get("source_capped", False),
|
|
1548
1556
|
)
|
|
1549
1557
|
|
|
1550
1558
|
async def list_namespaces(
|
|
@@ -129,6 +129,9 @@ class RecallResult:
|
|
|
129
129
|
"""Result from recall()."""
|
|
130
130
|
|
|
131
131
|
results: List[RecallMemory]
|
|
132
|
+
# Memories the relayer returned for this call (≤ limit, capped at 100).
|
|
133
|
+
# Not a namespace-wide count. Client-side max_distance does not lower it, so
|
|
134
|
+
# len(results) can be smaller than total.
|
|
132
135
|
total: int
|
|
133
136
|
# Matches omitted because download or decrypt failed. 0 also means the
|
|
134
137
|
# relayer omitted the field (older servers).
|
|
@@ -233,9 +236,8 @@ class RestoreResult:
|
|
|
233
236
|
#: (WALM-431 / GH #762). Also true when an inspected page produced only
|
|
234
237
|
#: transients (download/decrypt/embed) so the caller retries (WALM-480).
|
|
235
238
|
#:
|
|
236
|
-
#:
|
|
237
|
-
#:
|
|
238
|
-
#: missing. Follow-up field: WALM-451 (``sourceCapped``).
|
|
239
|
+
#: Independent of ``source_capped``: a saturated cap with a non-full
|
|
240
|
+
#: missing page yields ``truncated=False`` while ``source_capped=True``.
|
|
239
241
|
#:
|
|
240
242
|
#: Relayers older than WALM-319 don't send this field at all; the SDK
|
|
241
243
|
#: defaults it to ``False`` in that case rather than requiring it.
|
|
@@ -244,6 +246,12 @@ class RestoreResult:
|
|
|
244
246
|
#: hits plus any new permanent failures this call. Relayers older than
|
|
245
247
|
#: COMG-719 omit this field; the SDK defaults it to ``0``.
|
|
246
248
|
failed: int = 0
|
|
249
|
+
#: True when the sidecar's owner-wide candidate fetch hit its cap
|
|
250
|
+
#: (``min(limit * 5, 100)``). Independent of ``truncated``. When true,
|
|
251
|
+
#: ``total`` counts only blobs inside that fetch; blobs past the cap are
|
|
252
|
+
#: not visible to this restore call. Relayers that omit the field
|
|
253
|
+
#: default to ``False``.
|
|
254
|
+
source_capped: bool = False
|
|
247
255
|
|
|
248
256
|
|
|
249
257
|
@dataclass
|
|
@@ -1450,6 +1450,56 @@ class TestRestore:
|
|
|
1450
1450
|
|
|
1451
1451
|
assert result.failed == 0
|
|
1452
1452
|
|
|
1453
|
+
@respx.mock
|
|
1454
|
+
async def test_restore_preserves_source_capped(
|
|
1455
|
+
self, memwal_client: MemWal
|
|
1456
|
+
) -> None:
|
|
1457
|
+
mock_seal_session_prereqs()
|
|
1458
|
+
respx.post(f"{_TEST_SERVER}/api/restore").mock(
|
|
1459
|
+
return_value=httpx.Response(
|
|
1460
|
+
200,
|
|
1461
|
+
json={
|
|
1462
|
+
"restored": 0,
|
|
1463
|
+
"skipped": 3,
|
|
1464
|
+
"total": 3,
|
|
1465
|
+
"namespace": "my-app",
|
|
1466
|
+
"owner": "0xowner",
|
|
1467
|
+
"truncated": False,
|
|
1468
|
+
"source_capped": True,
|
|
1469
|
+
},
|
|
1470
|
+
)
|
|
1471
|
+
)
|
|
1472
|
+
|
|
1473
|
+
result = await memwal_client.restore("my-app", limit=100)
|
|
1474
|
+
|
|
1475
|
+
assert result.source_capped is True
|
|
1476
|
+
assert result.truncated is False
|
|
1477
|
+
|
|
1478
|
+
@respx.mock
|
|
1479
|
+
async def test_restore_source_capped_defaults_false_when_omitted(
|
|
1480
|
+
self, memwal_client: MemWal
|
|
1481
|
+
) -> None:
|
|
1482
|
+
"""Relayers older than WALM-451 omit `source_capped` — the SDK must
|
|
1483
|
+
default it to False rather than requiring the field."""
|
|
1484
|
+
mock_seal_session_prereqs()
|
|
1485
|
+
respx.post(f"{_TEST_SERVER}/api/restore").mock(
|
|
1486
|
+
return_value=httpx.Response(
|
|
1487
|
+
200,
|
|
1488
|
+
json={
|
|
1489
|
+
"restored": 5,
|
|
1490
|
+
"skipped": 2,
|
|
1491
|
+
"total": 7,
|
|
1492
|
+
"namespace": "my-app",
|
|
1493
|
+
"owner": "0xowner",
|
|
1494
|
+
"truncated": False,
|
|
1495
|
+
},
|
|
1496
|
+
)
|
|
1497
|
+
)
|
|
1498
|
+
|
|
1499
|
+
result = await memwal_client.restore("my-app", limit=100)
|
|
1500
|
+
|
|
1501
|
+
assert result.source_capped is False
|
|
1502
|
+
|
|
1453
1503
|
|
|
1454
1504
|
class TestHealth:
|
|
1455
1505
|
@respx.mock
|
|
@@ -122,4 +122,4 @@ async def test_well_formed_bodies_still_parse() -> None:
|
|
|
122
122
|
restore = await _client(
|
|
123
123
|
{"restored": 1, "skipped": 0, "total": 1, "namespace": "ns", "owner": "0xo"}
|
|
124
124
|
).restore("ns")
|
|
125
|
-
assert restore.truncated is False and restore.failed == 0
|
|
125
|
+
assert restore.truncated is False and restore.failed == 0 and restore.source_capped is False
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|