ememdev 1.0.0__tar.gz → 1.2.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.
- {ememdev-1.0.0 → ememdev-1.2.0}/.gitignore +10 -5
- ememdev-1.2.0/LICENSE +201 -0
- {ememdev-1.0.0 → ememdev-1.2.0}/PKG-INFO +66 -11
- ememdev-1.2.0/README.md +135 -0
- {ememdev-1.0.0 → ememdev-1.2.0}/pyproject.toml +20 -3
- ememdev-1.2.0/src/ememdev/__init__.py +71 -0
- ememdev-1.2.0/src/ememdev/__main__.py +241 -0
- ememdev-1.2.0/src/ememdev/client.py +1404 -0
- ememdev-1.2.0/src/ememdev/identity.py +170 -0
- ememdev-1.2.0/src/ememdev/signing.py +263 -0
- ememdev-1.0.0/README.md +0 -84
|
@@ -29,23 +29,25 @@ tls/
|
|
|
29
29
|
# These patterns prevent the scaffolding from sneaking back in at root.
|
|
30
30
|
# sdks/emem-ts/ has its own legitimate package.json / tsconfig.json /
|
|
31
31
|
# src/ — those are NOT matched here because patterns are anchored to /.
|
|
32
|
+
#
|
|
33
|
+
# Anchoring only holds for git. hatchling re-anchors a root-anchored
|
|
34
|
+
# pattern to whatever directory it is building, so `/src/` here also hit
|
|
35
|
+
# `sdks/emem-py/src` and `sdks/emem-langmem/src`, and both wheels built
|
|
36
|
+
# clean with zero modules in them. ememdev 1.0.0 shipped to PyPI that
|
|
37
|
+
# way: metadata only, `import emem` raised ModuleNotFoundError. Keep
|
|
38
|
+
# root-anchored patterns off any directory name an SDK also uses.
|
|
32
39
|
node_modules/
|
|
33
40
|
dist/
|
|
34
41
|
dist-server/
|
|
35
42
|
.parcel-cache/
|
|
36
43
|
/index.html
|
|
37
|
-
/package.json
|
|
38
44
|
/package-lock.json
|
|
39
45
|
/vite.config.ts
|
|
40
|
-
/tsconfig.json
|
|
41
46
|
/tsconfig.server.json
|
|
42
|
-
/src/
|
|
43
47
|
/server/
|
|
44
48
|
/tests/*.test.ts
|
|
45
49
|
|
|
46
50
|
# Artifacts (screenshots, generated images) — keep folder, ignore contents
|
|
47
|
-
artifacts/*
|
|
48
|
-
!artifacts/.gitkeep
|
|
49
51
|
|
|
50
52
|
# Python ad-hoc tools
|
|
51
53
|
__pycache__/
|
|
@@ -84,3 +86,6 @@ docs/book/
|
|
|
84
86
|
|
|
85
87
|
# 3d-worlds exporter output (samples live under examples/3d-worlds/scenes/)
|
|
86
88
|
examples/3d-worlds/out/
|
|
89
|
+
|
|
90
|
+
# Agent scratch notes belong in .well-known/agent-notes/, never the repo root.
|
|
91
|
+
/AGENT_*.md
|
ememdev-1.2.0/LICENSE
ADDED
|
@@ -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 describing the origin of the Work and
|
|
141
|
+
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 Support. While redistributing the Work or
|
|
166
|
+
Derivative Works thereof, You may choose to offer, and charge a
|
|
167
|
+
fee for, acceptance of support, warranty, indemnity, or other
|
|
168
|
+
liability obligations and/or rights consistent with this License.
|
|
169
|
+
However, in accepting such obligations, You may act only on Your
|
|
170
|
+
own behalf and on Your sole responsibility, not on behalf of any
|
|
171
|
+
other Contributor, and only if You agree to indemnify, defend,
|
|
172
|
+
and hold each Contributor harmless for any liability incurred by,
|
|
173
|
+
or claims asserted against, such Contributor by reason of your
|
|
174
|
+
accepting any such warranty or support.
|
|
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 2026 Vortx (https://vortx.ai)
|
|
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
|
|
200
|
+
implied. See the License for the specific language governing permissions
|
|
201
|
+
and limitations under the License.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ememdev
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: Python client for emem.dev, the agent-native Earth memory protocol
|
|
5
5
|
Project-URL: Homepage, https://emem.dev
|
|
6
6
|
Project-URL: Repository, https://github.com/Vortx-AI/emem
|
|
@@ -8,6 +8,7 @@ Project-URL: Documentation, https://emem.dev/agents.md
|
|
|
8
8
|
Project-URL: Issues, https://github.com/Vortx-AI/emem/issues
|
|
9
9
|
Author-email: Vortx AI Private Limited <avijeet@vortx.ai>
|
|
10
10
|
License: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
11
12
|
Keywords: content-addressed,earth-observation,ed25519,geospatial,mcp,satellite
|
|
12
13
|
Classifier: Development Status :: 3 - Alpha
|
|
13
14
|
Classifier: Intended Audience :: Developers
|
|
@@ -22,6 +23,9 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
22
23
|
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
23
24
|
Requires-Python: >=3.9
|
|
24
25
|
Requires-Dist: httpx<1.0,>=0.27
|
|
26
|
+
Provides-Extra: signing
|
|
27
|
+
Requires-Dist: blake3>=0.3; extra == 'signing'
|
|
28
|
+
Requires-Dist: cryptography>=41; extra == 'signing'
|
|
25
29
|
Description-Content-Type: text/markdown
|
|
26
30
|
|
|
27
31
|
# ememdev: Python client for emem.dev
|
|
@@ -29,10 +33,11 @@ Description-Content-Type: text/markdown
|
|
|
29
33
|
<!-- mcp-name: io.github.Vortx-AI/emem -->
|
|
30
34
|
|
|
31
35
|
Thin, typed Python client for the [emem.dev](https://emem.dev) Earth memory
|
|
32
|
-
protocol. Wraps the public REST surface
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
protocol. Wraps the public REST surface in a single `Client` class that
|
|
37
|
+
returns parsed JSON verbatim. Every ed25519-signed receipt and
|
|
38
|
+
content-addressed CID is preserved for citation and offline verification.
|
|
39
|
+
The current surface is whatever [`/openapi.json`](https://emem.dev/openapi.json)
|
|
40
|
+
lists; this README does not restate a count that would go stale.
|
|
36
41
|
|
|
37
42
|
## Install
|
|
38
43
|
|
|
@@ -40,21 +45,27 @@ citation and offline verification.
|
|
|
40
45
|
pip install ememdev
|
|
41
46
|
```
|
|
42
47
|
|
|
43
|
-
The distribution
|
|
44
|
-
`pip install ememdev`, then `from
|
|
45
|
-
checkout
|
|
48
|
+
The distribution and the import package are both named `ememdev` (so
|
|
49
|
+
`pip install ememdev`, then `from ememdev import Client`); the shorter name
|
|
50
|
+
`emem` on PyPI belongs to an unrelated project. To work from a checkout
|
|
51
|
+
instead:
|
|
46
52
|
|
|
47
53
|
```bash
|
|
48
54
|
pip install -e sdks/emem-py
|
|
49
55
|
```
|
|
50
56
|
|
|
51
57
|
Requires Python 3.9+. The only runtime dependency is
|
|
52
|
-
[`httpx`](https://www.python-httpx.org/).
|
|
58
|
+
[`httpx`](https://www.python-httpx.org/). To sign memory writes (below),
|
|
59
|
+
add the `signing` extra, which pulls `blake3` and `cryptography`:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install "ememdev[signing]"
|
|
63
|
+
```
|
|
53
64
|
|
|
54
65
|
## Quick start
|
|
55
66
|
|
|
56
67
|
```python
|
|
57
|
-
from
|
|
68
|
+
from ememdev import Client
|
|
58
69
|
|
|
59
70
|
with Client() as em:
|
|
60
71
|
cell = em.locate("Mount Fuji")["cell64"]
|
|
@@ -66,7 +77,7 @@ with Client() as em:
|
|
|
66
77
|
|
|
67
78
|
```python
|
|
68
79
|
import asyncio
|
|
69
|
-
from
|
|
80
|
+
from ememdev import AsyncClient
|
|
70
81
|
|
|
71
82
|
async def main() -> None:
|
|
72
83
|
async with AsyncClient() as em:
|
|
@@ -91,6 +102,50 @@ Geocoder + read primitives, physics solvers, boring lat/lng shortcuts, and
|
|
|
91
102
|
introspection — see the inline docstring on `emem.client` for the full
|
|
92
103
|
endpoint → method mapping.
|
|
93
104
|
|
|
105
|
+
## Writing a signed note
|
|
106
|
+
|
|
107
|
+
Reads are anonymous. Writes into the agent memory namespace are gated by an
|
|
108
|
+
ed25519 `attester` block, and that signature is the one thing the MCP client
|
|
109
|
+
cannot produce for you. `ememdev[signing]` produces it, from a persistent
|
|
110
|
+
identity, so leaving a signed note is one command rather than a hand-rolled
|
|
111
|
+
crypto script.
|
|
112
|
+
|
|
113
|
+
The identity is resolved once and reused every session, because the key is
|
|
114
|
+
what owns your namespace at `/memories/by_attester/<pubkey8>/...`. Resolution
|
|
115
|
+
order: `EMEM_AGENT_KEY` (a 64-char hex seed or a key-file path), then
|
|
116
|
+
`~/.emem/agent_ed25519.pem` (override the directory with `EMEM_HOME`), minted
|
|
117
|
+
`0600` on first use if absent.
|
|
118
|
+
|
|
119
|
+
From the command line, for an agent that already speaks to emem over MCP:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
ememdev whoami # your pubkey and namespace_root
|
|
123
|
+
|
|
124
|
+
# emit just the attester block, sign nothing else (no network):
|
|
125
|
+
ememdev sign --verb create --path /memories/by_attester/<you>/note.md --stdin < note.md
|
|
126
|
+
|
|
127
|
+
# or sign a create and POST it to /mcp in one step:
|
|
128
|
+
ememdev write --path /memories/by_attester/<you>/note.md --body-file note.md
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Or in Python:
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from ememdev import load_or_create_signer
|
|
135
|
+
|
|
136
|
+
signer = load_or_create_signer() # persistent identity
|
|
137
|
+
path = f"{signer.namespace_root}/note.md"
|
|
138
|
+
body = b"a durable, signed, citeable note"
|
|
139
|
+
attester = signer.attester_block("create", path, body)
|
|
140
|
+
# POST {path, file_text, kind, attester} to /mcp memory_create.
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
`str_replace` and `insert` sign the whole file *after* the edit, and `rename`
|
|
144
|
+
binds both ends of the move (`signer.rename_attester_block(old, new)`); see the
|
|
145
|
+
`ememdev.signing` docstring for the per-verb body rule. A write into another
|
|
146
|
+
key's namespace is refused with a 403, and `sign`/`write` refuse it locally
|
|
147
|
+
first.
|
|
148
|
+
|
|
94
149
|
## Receipts
|
|
95
150
|
|
|
96
151
|
Every non-introspection response carries a `receipt` block with:
|
ememdev-1.2.0/README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# ememdev: Python client for emem.dev
|
|
2
|
+
|
|
3
|
+
<!-- mcp-name: io.github.Vortx-AI/emem -->
|
|
4
|
+
|
|
5
|
+
Thin, typed Python client for the [emem.dev](https://emem.dev) Earth memory
|
|
6
|
+
protocol. Wraps the public REST surface in a single `Client` class that
|
|
7
|
+
returns parsed JSON verbatim. Every ed25519-signed receipt and
|
|
8
|
+
content-addressed CID is preserved for citation and offline verification.
|
|
9
|
+
The current surface is whatever [`/openapi.json`](https://emem.dev/openapi.json)
|
|
10
|
+
lists; this README does not restate a count that would go stale.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install ememdev
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The distribution and the import package are both named `ememdev` (so
|
|
19
|
+
`pip install ememdev`, then `from ememdev import Client`); the shorter name
|
|
20
|
+
`emem` on PyPI belongs to an unrelated project. To work from a checkout
|
|
21
|
+
instead:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install -e sdks/emem-py
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Requires Python 3.9+. The only runtime dependency is
|
|
28
|
+
[`httpx`](https://www.python-httpx.org/). To sign memory writes (below),
|
|
29
|
+
add the `signing` extra, which pulls `blake3` and `cryptography`:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install "ememdev[signing]"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick start
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from ememdev import Client
|
|
39
|
+
|
|
40
|
+
with Client() as em:
|
|
41
|
+
cell = em.locate("Mount Fuji")["cell64"]
|
|
42
|
+
facts = em.recall(cell, bands=["copdem30m.elevation_mean"])
|
|
43
|
+
print(facts["facts"][0]["value"])
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Async
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
import asyncio
|
|
50
|
+
from ememdev import AsyncClient
|
|
51
|
+
|
|
52
|
+
async def main() -> None:
|
|
53
|
+
async with AsyncClient() as em:
|
|
54
|
+
out = await em.ask("How tall is Mount Everest?")
|
|
55
|
+
print(out["answer"])
|
|
56
|
+
|
|
57
|
+
asyncio.run(main())
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Configuration
|
|
61
|
+
|
|
62
|
+
| Env var | Default | Effect |
|
|
63
|
+
|-----------------------|----------------------|---------------------------------------------|
|
|
64
|
+
| `EMEM_BASE_URL` | `https://emem.dev` | Responder root; point at a self-hosted node |
|
|
65
|
+
| `EMEM_TIMEOUT_SECS` | `180` | HTTP timeout (matches gateway timeout) |
|
|
66
|
+
|
|
67
|
+
You can also pass `base_url=` and `timeout=` directly to the constructor.
|
|
68
|
+
|
|
69
|
+
## Surface coverage
|
|
70
|
+
|
|
71
|
+
Geocoder + read primitives, physics solvers, boring lat/lng shortcuts, and
|
|
72
|
+
introspection — see the inline docstring on `emem.client` for the full
|
|
73
|
+
endpoint → method mapping.
|
|
74
|
+
|
|
75
|
+
## Writing a signed note
|
|
76
|
+
|
|
77
|
+
Reads are anonymous. Writes into the agent memory namespace are gated by an
|
|
78
|
+
ed25519 `attester` block, and that signature is the one thing the MCP client
|
|
79
|
+
cannot produce for you. `ememdev[signing]` produces it, from a persistent
|
|
80
|
+
identity, so leaving a signed note is one command rather than a hand-rolled
|
|
81
|
+
crypto script.
|
|
82
|
+
|
|
83
|
+
The identity is resolved once and reused every session, because the key is
|
|
84
|
+
what owns your namespace at `/memories/by_attester/<pubkey8>/...`. Resolution
|
|
85
|
+
order: `EMEM_AGENT_KEY` (a 64-char hex seed or a key-file path), then
|
|
86
|
+
`~/.emem/agent_ed25519.pem` (override the directory with `EMEM_HOME`), minted
|
|
87
|
+
`0600` on first use if absent.
|
|
88
|
+
|
|
89
|
+
From the command line, for an agent that already speaks to emem over MCP:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
ememdev whoami # your pubkey and namespace_root
|
|
93
|
+
|
|
94
|
+
# emit just the attester block, sign nothing else (no network):
|
|
95
|
+
ememdev sign --verb create --path /memories/by_attester/<you>/note.md --stdin < note.md
|
|
96
|
+
|
|
97
|
+
# or sign a create and POST it to /mcp in one step:
|
|
98
|
+
ememdev write --path /memories/by_attester/<you>/note.md --body-file note.md
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Or in Python:
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from ememdev import load_or_create_signer
|
|
105
|
+
|
|
106
|
+
signer = load_or_create_signer() # persistent identity
|
|
107
|
+
path = f"{signer.namespace_root}/note.md"
|
|
108
|
+
body = b"a durable, signed, citeable note"
|
|
109
|
+
attester = signer.attester_block("create", path, body)
|
|
110
|
+
# POST {path, file_text, kind, attester} to /mcp memory_create.
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`str_replace` and `insert` sign the whole file *after* the edit, and `rename`
|
|
114
|
+
binds both ends of the move (`signer.rename_attester_block(old, new)`); see the
|
|
115
|
+
`ememdev.signing` docstring for the per-verb body rule. A write into another
|
|
116
|
+
key's namespace is refused with a 403, and `sign`/`write` refuse it locally
|
|
117
|
+
first.
|
|
118
|
+
|
|
119
|
+
## Receipts
|
|
120
|
+
|
|
121
|
+
Every non-introspection response carries a `receipt` block with:
|
|
122
|
+
|
|
123
|
+
- `responder_pubkey` (ed25519 base32-nopad-lowercase)
|
|
124
|
+
- `signature_b32` (ed25519 over the canonical CBOR preimage)
|
|
125
|
+
- `merkle_root` (BLAKE3 over the fact CIDs)
|
|
126
|
+
- `fact_cids[]` (the BLAKE3 CIDs of every fact returned)
|
|
127
|
+
|
|
128
|
+
To cite an answer: quote `receipt.fact_cids[0]` and the responder pubkey.
|
|
129
|
+
The signature can be verified offline against the public key at
|
|
130
|
+
`https://emem.dev/.well-known/emem.json`; no callback to the responder is
|
|
131
|
+
required.
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
Apache-2.0. Same as the upstream protocol.
|
|
@@ -4,7 +4,12 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ememdev"
|
|
7
|
-
|
|
7
|
+
# 1.1.0 adds the offline signing surface (ememdev.signing / ememdev.identity)
|
|
8
|
+
# and the `ememdev` CLI, so an agent can produce a memory-write attester block
|
|
9
|
+
# without a framework. 1.0.1 first superseded the empty 1.0.0 on PyPI (it
|
|
10
|
+
# shipped dist-info and no modules, so `import emem` raised ModuleNotFoundError;
|
|
11
|
+
# PyPI versions are immutable, so the only fix was to supersede it).
|
|
12
|
+
version = "1.2.0"
|
|
8
13
|
description = "Python client for emem.dev, the agent-native Earth memory protocol"
|
|
9
14
|
readme = "README.md"
|
|
10
15
|
requires-python = ">=3.9"
|
|
@@ -37,6 +42,18 @@ dependencies = [
|
|
|
37
42
|
"httpx>=0.27,<1.0",
|
|
38
43
|
]
|
|
39
44
|
|
|
45
|
+
# The base client is httpx-only. Signing memory writes needs ed25519 + blake3,
|
|
46
|
+
# which are only pulled when you ask for them. `ememdev.signing` and the
|
|
47
|
+
# `ememdev` CLI's sign/write commands raise a clear install hint without this.
|
|
48
|
+
[project.optional-dependencies]
|
|
49
|
+
signing = [
|
|
50
|
+
"blake3>=0.3",
|
|
51
|
+
"cryptography>=41",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
[project.scripts]
|
|
55
|
+
ememdev = "ememdev.__main__:main"
|
|
56
|
+
|
|
40
57
|
[project.urls]
|
|
41
58
|
Homepage = "https://emem.dev"
|
|
42
59
|
Repository = "https://github.com/Vortx-AI/emem"
|
|
@@ -44,7 +61,7 @@ Documentation = "https://emem.dev/agents.md"
|
|
|
44
61
|
Issues = "https://github.com/Vortx-AI/emem/issues"
|
|
45
62
|
|
|
46
63
|
[tool.hatch.build.targets.wheel]
|
|
47
|
-
packages = ["src/
|
|
64
|
+
packages = ["src/ememdev"]
|
|
48
65
|
|
|
49
66
|
[tool.hatch.build.targets.sdist]
|
|
50
|
-
include = ["src/
|
|
67
|
+
include = ["src/ememdev", "README.md", "LICENSE"]
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""ememdev: Python client for the emem.dev Earth memory protocol.
|
|
2
|
+
|
|
3
|
+
The distribution and the module are both named ``ememdev``, on purpose:
|
|
4
|
+
the shorter name ``emem`` on PyPI belongs to an unrelated project by
|
|
5
|
+
another company, and a module named ``emem`` would collide with it on
|
|
6
|
+
disk if both were installed.
|
|
7
|
+
|
|
8
|
+
This package wraps the REST surface of the hosted instance at
|
|
9
|
+
https://emem.dev in a thin, typed client. Every call returns the raw JSON
|
|
10
|
+
the server emitted; nothing is reshaped, so the ed25519-signed receipts
|
|
11
|
+
and content-addressed CIDs are preserved verbatim for citation and
|
|
12
|
+
offline verification.
|
|
13
|
+
|
|
14
|
+
The responder enumerates its own surface: GET /openapi.json lists every
|
|
15
|
+
documented path and POST /mcp `tools/list` every MCP tool. Those are the
|
|
16
|
+
counts to quote, since a number written down here goes stale the next
|
|
17
|
+
time a route lands.
|
|
18
|
+
|
|
19
|
+
Quick start:
|
|
20
|
+
|
|
21
|
+
from ememdev import Client
|
|
22
|
+
|
|
23
|
+
em = Client() # defaults to https://emem.dev
|
|
24
|
+
cell = em.locate("Mount Fuji")["cell64"]
|
|
25
|
+
facts = em.recall(cell, bands=["copdem30m.elevation_mean"])
|
|
26
|
+
print(facts["facts"][0]["value"])
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
from importlib.metadata import PackageNotFoundError, version as _pkg_version
|
|
30
|
+
|
|
31
|
+
from .client import AsyncClient, Client, EmemError, EmemHTTPError
|
|
32
|
+
|
|
33
|
+
__all__ = [
|
|
34
|
+
"AsyncClient",
|
|
35
|
+
"Client",
|
|
36
|
+
"EmemError",
|
|
37
|
+
"EmemHTTPError",
|
|
38
|
+
# Signing surface, resolved lazily below so `import ememdev` needs no
|
|
39
|
+
# crypto. Available with the `signing` extra: pip install ememdev[signing].
|
|
40
|
+
"EmemSigner",
|
|
41
|
+
"load_signer",
|
|
42
|
+
"load_or_create_signer",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
# Keep the base import dependency-light: the client is httpx-only, and the
|
|
46
|
+
# signer pulls blake3 + cryptography. Resolve the signing names on first
|
|
47
|
+
# access (PEP 562) so `from ememdev import EmemSigner` works when the extra
|
|
48
|
+
# is installed and gives a clear install hint when it is not.
|
|
49
|
+
_SIGNING_EXPORTS = {
|
|
50
|
+
"EmemSigner": ("ememdev.signing", "EmemSigner"),
|
|
51
|
+
"load_signer": ("ememdev.identity", "load_signer"),
|
|
52
|
+
"load_or_create_signer": ("ememdev.identity", "load_or_create_signer"),
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def __getattr__(name: str):
|
|
57
|
+
target = _SIGNING_EXPORTS.get(name)
|
|
58
|
+
if target is None:
|
|
59
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
60
|
+
import importlib
|
|
61
|
+
|
|
62
|
+
module, attr = target
|
|
63
|
+
return getattr(importlib.import_module(module), attr)
|
|
64
|
+
|
|
65
|
+
# Single source of truth: the installed distribution's version, which comes
|
|
66
|
+
# from pyproject.toml. Keeps __version__ and the client User-Agent from
|
|
67
|
+
# drifting out of sync with what actually ships to PyPI.
|
|
68
|
+
try:
|
|
69
|
+
__version__ = _pkg_version("ememdev")
|
|
70
|
+
except PackageNotFoundError: # running from a source checkout, not installed
|
|
71
|
+
__version__ = "0+unknown"
|