forked from tinyhumansai/tinymemory
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCargo.toml
More file actions
192 lines (178 loc) · 8.49 KB
/
Copy pathCargo.toml
File metadata and controls
192 lines (178 loc) · 8.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
[workspace]
# `sync` is the engine-neutral Composio normalisers (issue #18 §B3).
members = [".", "api", "core", "sync", "sources", "adapters/tinycortex", "adapters/remote", "conformance"]
default-members = [".", "api", "core", "sync", "sources", "adapters/tinycortex", "adapters/remote", "conformance"]
# `vendor/` holds engine submodules (tinycortex, tinybus, tinyagents), each of
# which is its own workspace with its own lockfile. Same exclusion
# `vendor/tinycortex` uses for its own nested vendor directory.
#
# `crates/tinymemory-module` is excluded for a harder reason than tidiness, and
# it is worth writing down because the obvious arrangement does not work.
#
# That crate depends on `vendor/tinybus/crates/tinybus`, whose manifest inherits
# `edition`/`version` from `vendor/tinybus`'s own `[workspace.package]`. If the
# module is a member here, cargo resolves that inheritance against **this** root
# instead of the nested one and fails with `workspace.package.edition was not
# defined`. `exclude` does not prevent it: exclusion governs membership, not the
# root cargo picks when resolving a dependency's inherited fields. Verified by
# defining `[workspace.package]` here temporarily, which moved the error from
# `edition` to `version` rather than fixing it.
#
# So the module is its own workspace root with its own `Cargo.lock` — which is
# also what tinybus's module documentation prescribes ("integrations themselves
# remain separate repositories and are never workspace members") and what a
# separately released artifact wants anyway. Build it with
# `--manifest-path crates/tinymemory-module/Cargo.toml`.
exclude = ["vendor", "crates/tinymemory-module"]
[package]
name = "tinymemory"
# Not published: `tinymemory-core` depends on `tinycortex-api`, which is
# consumed by path and is not on crates.io, so `cargo package` cannot resolve
# the graph. Every consumer takes this repo by path or git.
publish = false
version = "1.0.1"
edition = "2021"
rust-version = "1.96"
license = "MIT"
description = "Engine-neutral memory contract, driver registry, and engine adapters"
repository = "https://github.com/tinyhumansai/tinymemory"
documentation = "https://docs.rs/tinymemory"
readme = "README.md"
keywords = ["memory", "agent", "llm", "retrieval"]
categories = ["database"]
# Keep the published package to what a consumer actually needs.
exclude = [
".github/",
".gitmodules",
"docs/",
"vendor/",
"worktrees/",
".env.example",
"deny.toml",
]
[dependencies]
# The contract itself. Re-exported wholesale from `src/lib.rs` so a host takes
# one dependency rather than two, and so `tinymemory::MemoryProvider` and
# `tinymemory_api::provider::MemoryProvider` are the same type.
tinymemory-api = { path = "api" }
# The engines, each behind its own feature (#18 §D1). Optional, so the default
# build is still the contract, the registry and the mandatory composition and
# nothing that links C.
#
# This direction only became legal once `mandatory` and the reserved driver ids
# moved into `tinymemory-api`: the adapters used to depend on this crate for
# them, and a facade depending back on the adapters is a package cycle cargo
# forbids.
tinymemory-tinycortex = { path = "adapters/tinycortex", optional = true }
tinymemory-remote = { path = "adapters/remote", optional = true }
# The mandatory capability families are `async fn`s on object-safe traits.
async-trait = "0.1"
# `Memory` is anyhow-typed; `mandatory::engine_error` maps it onto `MemoryError`.
anyhow = "1"
# Diagnostics on the shared store/recall/export paths.
log = "0.4"
# `ExportRecord::payload` is a `serde_json::Value`.
serde_json = "1"
# `DriverClass` is read out of a host's config file, so its serde form is the
# config form and is pinned by a test.
serde = { version = "1", features = ["derive"] }
[dev-dependencies]
# The mandatory-family tests are async.
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
# `TestHostConfig`, for the driver-selection tests. A dev-dependency: the
# facade must not carry a test double into a consumer's graph.
tinymemory-api = { path = "api", features = ["test-support"] }
# The reference driver and the behavioural suite, for the workspace-level
# integration tests. A dev-dependency only: the facade must not carry a test
# harness into a consumer's dependency graph.
tinymemory-conformance = { path = "conformance" }
# The extracted Composio normalisers, for the integration test that runs them
# against a driver that is not TinyCortex (issue #18 §B3).
tinymemory-sync = { path = "sync" }
[features]
# Nothing by default. A host that names no engine links no engine.
default = []
# --- Engines ---------------------------------------------------------------
# Each pulls exactly the adapter that serves it. `supermemory`, `mem0` and
# `cognee` share one adapter crate, so enabling several costs one dependency
# rather than three.
tinycortex = ["dep:tinymemory-tinycortex"]
supermemory = ["dep:tinymemory-remote"]
mem0 = ["dep:tinymemory-remote"]
cognee = ["dep:tinymemory-remote"]
# --- Capability add-ons ----------------------------------------------------
# Each requires the engine that serves it, so asking for a capability cannot
# produce a build where nothing implements it.
memory-git = ["tinycortex", "tinymemory-tinycortex/memory-git"]
# Lints apply to this package only, deliberately. `api/` is contract code moved
# verbatim from `tinycortex-api` and is held byte-identical; subjecting it to a
# stricter lint set than it was written under would force cosmetic edits through
# a surface whose serde representations and enum wire strings are persisted on
# disk. Adapter crates opt in individually.
[lints.rust]
unsafe_code = "forbid"
missing_docs = "warn"
missing_debug_implementations = "warn"
unreachable_pub = "warn"
rust_2018_idioms = { level = "warn", priority = -1 }
[lints.clippy]
all = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
# Library code must not panic on its own; tests and examples may.
unwrap_used = "warn"
expect_used = "warn"
panic = "warn"
todo = "warn"
unimplemented = "warn"
# Public fallible/panicking APIs must document their failure modes.
missing_errors_doc = "warn"
missing_panics_doc = "warn"
# Documentation hygiene.
doc_markdown = "warn"
# `#[must_use]` on pure public functions.
must_use_candidate = "warn"
[lints.rustdoc]
broken_intra_doc_links = "warn"
private_intra_doc_links = "warn"
# The engine adapters name their engines by version requirement, not by path,
# so a host that already pins its own engine checkout unifies onto one copy
# through its own patch table. These entries are what make a *standalone* build
# of this workspace resolve them to the nested `vendor/` submodules.
# `tinycortex-api` takes this workspace's own contract crate by git, because
# neither crate is published (tinymemory#18 §A1). Without this entry cargo
# resolves the git copy *and* the path copy as two distinct crates, and
# `tinymemory_api::MemoryCategory` from one is not the same type as from the
# other — which is the exact duplication §A1 exists to delete, reintroduced by
# the fix for it. The error is loud rather than silent, but only at the seam.
#
# Patch tables apply from the workspace root being built, so this covers builds
# and tests here. A host that embeds this workspace needs the same entry, the
# same way it already patches tinycortex.
[patch."https://github.com/tinyhumansai/tinymemory"]
tinymemory-api = { path = "api" }
[patch.crates-io]
tinycortex = { path = "vendor/tinycortex" }
tinycortex-api = { path = "vendor/tinycortex/api" }
# `tinymemory-core`'s summariser and embedder factory name tinyagents' chat and
# embedding model traits. It is not published, so a standalone build of this
# workspace has to be told where it is — hence its own submodule alongside
# tinycortex and tinybus.
#
# Deliberately NOT `vendor/tinycortex/vendor/tinyagents`: the engine pins v2.1.0
# there, which predates `RECOMMENDED_OLLAMA_CONTEXT_TOKENS` that the embedder
# factory needs. Reaching through another submodule's pin also makes this
# crate's dependency an accident of the engine's, which is not a relationship
# worth having.
#
# A host that embeds this crate patches tinyagents itself — patch tables only
# apply from the workspace root being built — so this entry affects standalone
# builds and `cargo test` here, and nothing downstream.
tinyagents = { path = "vendor/tinyagents" }
[profile.release]
# Cross-crate optimization and smaller, faster binaries for release builds.
lto = "thin"
codegen-units = 1
strip = "debuginfo"
[[example]]
name = "tinycortex"
required-features = ["tinycortex"]