smartmemory-client 0.5.0__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.
Files changed (31) hide show
  1. smartmemory_client-0.5.0/CHANGELOG.md +133 -0
  2. smartmemory_client-0.5.0/LICENSE +21 -0
  3. smartmemory_client-0.5.0/MANIFEST.in +7 -0
  4. smartmemory_client-0.5.0/PKG-INFO +547 -0
  5. smartmemory_client-0.5.0/README.md +513 -0
  6. smartmemory_client-0.5.0/VERSION +1 -0
  7. smartmemory_client-0.5.0/pyproject.toml +90 -0
  8. smartmemory_client-0.5.0/setup.cfg +4 -0
  9. smartmemory_client-0.5.0/smartmemory_client/__init__.py +61 -0
  10. smartmemory_client-0.5.0/smartmemory_client/client.py +3279 -0
  11. smartmemory_client-0.5.0/smartmemory_client/models/__init__.py +10 -0
  12. smartmemory_client-0.5.0/smartmemory_client/models/conversation.py +29 -0
  13. smartmemory_client-0.5.0/smartmemory_client/models/memory_item.py +94 -0
  14. smartmemory_client-0.5.0/smartmemory_client.egg-info/PKG-INFO +547 -0
  15. smartmemory_client-0.5.0/smartmemory_client.egg-info/SOURCES.txt +29 -0
  16. smartmemory_client-0.5.0/smartmemory_client.egg-info/dependency_links.txt +1 -0
  17. smartmemory_client-0.5.0/smartmemory_client.egg-info/requires.txt +10 -0
  18. smartmemory_client-0.5.0/smartmemory_client.egg-info/top_level.txt +1 -0
  19. smartmemory_client-0.5.0/tests/test_client.py +89 -0
  20. smartmemory_client-0.5.0/tests/test_client_errors.py +295 -0
  21. smartmemory_client-0.5.0/tests/test_client_full_coverage.py +626 -0
  22. smartmemory_client-0.5.0/tests/test_code_search.py +146 -0
  23. smartmemory_client-0.5.0/tests/test_decision_methods.py +259 -0
  24. smartmemory_client-0.5.0/tests/test_procedure_candidates.py +310 -0
  25. smartmemory_client-0.5.0/tests/test_procedure_drift.py +235 -0
  26. smartmemory_client-0.5.0/tests/test_procedure_evolution.py +278 -0
  27. smartmemory_client-0.5.0/tests/test_procedure_matches.py +193 -0
  28. smartmemory_client-0.5.0/tests/test_procedures.py +241 -0
  29. smartmemory_client-0.5.0/tests/test_relation_contract.py +40 -0
  30. smartmemory_client-0.5.0/tests/test_summary_client.py +169 -0
  31. smartmemory_client-0.5.0/tests/test_token_usage.py +137 -0
@@ -0,0 +1,133 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ### Added
10
+
11
+ - **CORE-SUMMARY-1: Memory snapshot SDK methods.** Six new methods on `SmartMemoryClient`: `summary_generate(window_start=None, include_markdown=True)`, `summary_latest()`, `summary_get(snapshot_id)`, `summary_list(is_heartbeat=None, limit=20, before=None)`, `summary_delta(from_snapshot_id, to_snapshot_id)`, `summary_delete(snapshot_id)`. Read methods return `None` on 404; write methods raise `SmartMemoryClientError`. Tests cover happy path + 404 + 4xx + 500 per the global error-coverage rule. Contract: [`smart-memory-docs/docs/features/CORE-SUMMARY-1/snapshot-contract.json`](../smart-memory-docs/docs/features/CORE-SUMMARY-1/snapshot-contract.json).
12
+
13
+ - **CORE-CRUD-UPDATE-1: `client.update()` exposes `properties` and `write_mode`.** Signature extended: `client.update(item_id, content=None, metadata=None, properties=None, write_mode=None)`. The convenience pair (`content`/`metadata`) still works — when omitted, no behavior change. Pass `properties={...}` for direct node-property updates; `properties` takes precedence over the conveniences when both are provided. `write_mode="merge"|"replace"` controls write semantics; default merges. Returns True on success, False on any HTTP error (unchanged). Contract: `smart-memory-docs/docs/features/CORE-CRUD-UPDATE-1/update-contract.json`.
14
+
15
+ ### Changed — BREAKING
16
+
17
+ - **CORE-MEMORY-DYNAMICS-1 M1b (fixup 2026-04-20):** golden CRUD integration test (`tests/integration/test_crud_golden.py::test_add_different_memory_types`) parametrize list updated from `[..., "working"]` to `[..., "pending"]`. Client callers that hardcode `memory_type="working"` will now receive a `400` validation error from the server post-M1b rename. Commit `3ca985f`.
18
+
19
+ ### Added
20
+
21
+ - **CORE-MEMORY-DYNAMICS-1 M1a: `SmartMemoryClient.get_working_context(session_id, query, k=20, max_tokens=None, strategy=None) → Dict[str, Any]`.** New method posting to `POST /memory/context` via the shared `_request` helper. Returns contract-shaped response per `smart-memory-docs/docs/features/CORE-MEMORY-DYNAMICS-1/context-api-contract.json` (keys: `decision_id`, `items`, `drift_warnings`, `strategy_used`, `tokens_used`, `tokens_budget`, `deprecation`). Optional params filtered by `is not None` (not truthiness) so `max_tokens=0` and `strategy=""` are sent to the server for validation — protects against truthiness-filter regressions. Server `400 budget_too_small` and `5xx` failures raise `SmartMemoryClientError` per existing SDK error convention. 8 unit tests covering happy path, auth+workspace header emission, optional-param encoding, falsy-but-valid values, and 400/500 error paths. No `memory_recall` shim on this SDK — the SDK never exposed `memory_recall`.
22
+
23
+ ### Changed
24
+
25
+ #### Header Rename: X-Team-Id → X-Workspace-Id (SCOPE-WS-1)
26
+ - Constructor now accepts `workspace_id` parameter (preferred); `team_id` kept as deprecated alias
27
+ - `team_id` emits `DeprecationWarning` only when used as the actual fallback (not when `workspace_id` is also provided)
28
+ - Both `team_id` and `workspace_id` deprecated env vars (`SMARTMEMORY_TEAM_ID`) remain supported; `SMARTMEMORY_WORKSPACE_ID` is new preferred env var
29
+ - `X-Team-Id` request header replaced with `X-Workspace-Id` in all HTTP calls
30
+ - `team_id` alias and `SMARTMEMORY_TEAM_ID` env var will be removed in v0.5.0
31
+
32
+ ### Added
33
+ - **Procedure Schema Drift Detection (CFS-4)**: 5 new methods for schema drift management
34
+ - `list_drift_events()` — list drift events with filtering (procedure_id, resolved, breaking_only, date range)
35
+ - `get_drift_event(event_id)` — get drift event detail with full changes list
36
+ - `resolve_drift_event(event_id, note)` — mark a drift event as resolved
37
+ - `sweep_drift()` — trigger workspace-wide drift sweep
38
+ - `list_schema_snapshots(procedure_id)` — list schema snapshot history
39
+ - **Drift detection tests** (`tests/test_procedure_drift.py`): 16 tests covering all 5 endpoints with happy path, error codes, parameter filtering
40
+ - **Error handling tests** (`tests/test_client_errors.py`): 21 tests covering HTTP error codes (400, 401, 403, 404, 422, 500), connection errors, timeouts, success responses, and request argument forwarding
41
+
42
+ ### Fixed
43
+ - **Package structure**: Created missing `models/__init__.py` for proper model exports
44
+ - **Module exports**: Fixed `__init__.py` to properly export `MemoryItem` and `ConversationContextModel`
45
+ - **Version detection**: Use `importlib.metadata` for installed package version with fallback to VERSION file
46
+ - **Test assertions**: Fixed API path assertions to match actual client implementation
47
+
48
+ ### Added
49
+
50
+ #### Usage Methods
51
+ - `get_usage_limits()` - Get quota limits for current subscription tier
52
+ - `get_current_usage()` - Get current usage statistics
53
+ - `get_available_tiers()` - Get available subscription tiers
54
+
55
+ #### Reasoning Traces (System 2 Memory)
56
+ - `extract_reasoning()` - Extract reasoning traces from content
57
+ - `store_reasoning_trace()` - Store reasoning trace with artifact links
58
+ - `query_reasoning()` - Query reasoning traces ("why" queries)
59
+ - `get_reasoning_trace()` - Get specific reasoning trace by ID
60
+
61
+ #### Synthesis Evolution
62
+ - `synthesize_opinions()` - Form opinions from episodic patterns
63
+ - `synthesize_observations()` - Create entity summaries from facts
64
+ - `reinforce_opinions()` - Update opinion confidence based on evidence
65
+
66
+ ---
67
+
68
+ ## [0.2.6] - 2025-11-25
69
+
70
+ ### 🎯 Interface Alignment with Core Library
71
+
72
+ Aligned client method names and return types with core `smartmemory` library for portable code.
73
+
74
+ ### Added
75
+ - **New API methods** for complete service coverage:
76
+ - `add_edge()` - Direct edge creation between nodes with custom properties
77
+ - `reflect()` - Memory pattern analysis and insights
78
+ - `summarize()` - High-level memory content summary
79
+
80
+ ### Changed
81
+ - **Method renames** to match core library:
82
+ - `get_summary()` → `summary()`
83
+ - `get_orphaned_notes()` → `orphaned_notes()`
84
+ - `summarize_memories()` → `summarize()`
85
+ - `prune_memories()` → `prune()`
86
+ - **MemoryItem** enhanced with:
87
+ - `from_dict()` factory method for consistent parsing
88
+ - Dict-like access (`item["content"]`) for compatibility
89
+ - Additional fields: `user_id`, `workspace_id`, `tenant_id`, `tags`
90
+ - **Return types**: `get()` and `search()` now use `MemoryItem.from_dict()` for consistent parsing
91
+ - **Fixed** `get_neighbors()` to use standard `_request()` helper
92
+
93
+ ### Removed
94
+ - Deleted stale work artifacts: `CLEANUP_CHECKLIST.md`, `PACKAGE_SETUP_COMPLETE.md`, `SSG_UPDATE.md`
95
+ - Removed duplicate methods in Usage section
96
+
97
+ ---
98
+
99
+ ## [0.1.17] - 2025-11-23
100
+
101
+ ### Added
102
+ - **SSG (Similarity Graph Traversal) support** for enhanced semantic retrieval
103
+ - New `search_advanced()` method with `query_traversal` and `triangulation_fulldim` algorithms
104
+ - Optional `use_ssg` parameter in `search()` method for better multi-hop reasoning
105
+ - Superior retrieval quality: 100% test pass rate, 0.91 precision/recall (vs 0.88 basic)
106
+ - Reference: Eric Lester. (2025). Novel Semantic Similarity Graph Traversal Algorithms for Semantic Retrieval Augmented Generation Systems.
107
+ - Initial client implementation
108
+ - Full API coverage for SmartMemory Service
109
+ - JWT authentication support
110
+ - Type-safe Pydantic models
111
+ - Comprehensive error handling
112
+ - Comprehensive documentation
113
+ - Example usage for Maya and Studio integration
114
+ - Sync script for updating from service repository
115
+ - GitHub Actions workflows for testing and publishing
116
+
117
+ ### Features
118
+ - ✅ Type-safe API with Pydantic models
119
+ - ✅ Automatic JWT authentication
120
+ - ✅ Full API coverage
121
+ - ✅ Comprehensive error handling
122
+ - ✅ Environment variable support
123
+ - ✅ Context manager support
124
+ - ✅ Detailed logging
125
+
126
+ ### Documentation
127
+ - Complete README with examples
128
+ - API reference
129
+ - Authentication guide
130
+ - Integration examples
131
+ - Development guide
132
+
133
+ [1.0.0]: https://github.com/smartmemory/smart-memory-client/releases/tag/v1.0.0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 SmartMemory Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,7 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CHANGELOG.md
4
+ recursive-include smartmemory_client *.py
5
+ recursive-include smartmemory_client/generated *.py
6
+ exclude tests
7
+ exclude docs