-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathCargo.toml
More file actions
234 lines (212 loc) · 9.8 KB
/
Copy pathCargo.toml
File metadata and controls
234 lines (212 loc) · 9.8 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# The engine crate is also the workspace root so `api/` is never an orphan
# package: `cargo fmt --all`, `cargo check`, and `cargo test` from this
# directory cover the stable-contract crate too. `vendor/` is excluded so the
# vendored dependencies are not pulled in as implicit members.
[workspace]
members = [".", "api"]
# `default-members` would otherwise fall back to the root package alone (this is
# a root-package workspace, not a virtual one), so a bare `cargo test` here
# would silently skip `api/`. Naming both members keeps the contract crate in
# every default build/test.
default-members = [".", "api"]
exclude = ["vendor"]
[package]
name = "tinycortex"
# Not published. The engine's contract crate now depends on `tinymemory-api` by
# git, and cargo refuses a git dependency in a published crate. Publishing was
# already broken rather than merely unused: since `api/` was split out,
# `cargo package` has failed with `no matching package named 'tinycortex-api'
# found`, because that crate was never published either. This records the state
# the repository has actually been in, and buys the git dependency that lets the
# duplicate contract go away (tinymemory#18 §A1).
publish = false
version = "0.1.2"
edition = "2021"
license = "GPL-3.0-only"
repository = "https://github.com/tinyhumansai/tinycortex"
description = "Rust core for the TinyCortex memory system"
readme = "README.md"
exclude = [
".github/",
".vscode/",
"benchmarks/",
"docs/",
"gitbooks/",
"paper/",
"requirements.txt",
"viewer/",
]
[features]
# Dependency-light, fully synchronous core. No heavyweight native or async
# dependencies are pulled in by default; every heavy capability is opt-in below.
default = []
# Async background worker loops for the job queue (`memory::queue::runtime`).
# Turns `tokio` into a real (optional) dependency rather than a test-only one so
# a host can run the append/seal/flush pipeline as always-on loops instead of
# driving `run_once` by hand.
tokio = ["dep:tokio"]
# Git-backed source snapshots / diffs / checkpoints (`memory::diff`). Gates the
# heavy native `git2`/libgit2 dependency; with the feature off the whole `diff`
# module (and libgit2) compiles out.
git-diff = ["dep:git2"]
# reqwest-based embedding / LLM HTTP providers (`memory::providers`). Pulls in
# the reqwest stack and needs an async runtime, so it implies `tokio`.
providers-http = ["dep:reqwest", "tokio"]
# Live source synchronization (Composio HTTP pipelines and workspace scans).
# Host schedulers, credentials, RPC, and event buses remain outside the crate.
sync = ["dep:reqwest", "dep:tracing", "tokio"]
# Persona distillation surface (`memory::persona`): ingests local coding-agent
# history, instruction files, and git commits into a durable persona memory
# layer (doc 06). Adds NO new dependencies — readers reuse `serde_json`,
# `walkdir`, `rusqlite`, `sha2` from core; the git-history reader additionally
# requires the `git-diff` feature. A live run also wants `providers-http` for
# the OpenRouter reference provider, but the pipeline depends only on the
# `ChatProvider` / `Summariser` / `EmbeddingBackend` traits.
persona = []
# Git-backed wiki mirror of derived summary nodes
# (`memory::store::content::wiki_git`): initialises `<content_root>/wiki/.git`,
# commits `summaries/**`, and stores read high-water marks as lightweight
# `refs/tags/read/*` pointers. Enables `git2` directly rather than implying
# `git-diff`, which would additionally compile in the unrelated `memory::diff`
# module — the same posture as `sync` and `providers-http` both enabling
# `dep:reqwest` independently.
wiki-git = ["dep:git2", "dep:hex"]
# Obsidian vault interop (`memory::store::content::{obsidian,obsidian_registry}`):
# stages the bundled `.obsidian/` defaults into the content root, and
# best-effort detection of whether that root is a vault Obsidian already knows
# about (its `obsidian.json` registry).
obsidian = ["dep:dirs"]
# Contact resolution and scoring (`memory::people`): a SQLite store of people,
# handle aliases and interactions, a deterministic handle → `PersonId` resolver,
# and a recency × frequency × reciprocity × depth scorer.
#
# Implies `tokio` because the store shares its connection as an
# `Arc<tokio::sync::Mutex<Connection>>` across tasks. It adds no other
# dependency — `rusqlite`, `chrono`, `uuid` and `serde` are already core.
people = ["tokio"]
# The macOS system address book (`memory::people::address_book`) as a seed
# source for the people store. Gated on the target *and* this feature: the four
# objc2 crates it needs are macOS-only and are not worth compiling for a host
# that never seeds from Contacts. Off (or non-macOS) leaves a stub that returns
# an empty contact list, so a refresh seeds nothing rather than failing.
contacts = ["people", "dep:objc2", "dep:objc2-foundation", "dep:objc2-contacts", "dep:block2"]
[dependencies]
anyhow = "1"
log = "0.4"
futures = "0.3"
async-trait = "0.1"
chrono = { version = "0.4", features = ["serde"] }
parking_lot = "0.12"
rand = "0.10"
regex = "1"
rusqlite = { version = "0.40", features = ["bundled"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
schemars = "1"
sha2 = "0.10"
thiserror = "2"
# Provider-neutral inference contracts. Pinned until TinyInference is
# published; embedding hosts may patch this exact git source so the host and
# TinyCortex share one `EmbeddingModel` trait identity without pulling in an
# agent runtime.
tinyinference = { git = "https://github.com/tinyhumansai/tinyinference", rev = "cc8aca484bb995fbab3b7358f0d72ab5056b587c" }
# The stable contract crate (value types, error enum, `Memory` trait). Declared
# as a path dependency, not a registry requirement, so embedding hosts resolve
# it through this checkout without needing their own `[patch.crates-io]` entry.
tinycortex-api = { path = "api", version = "0.1.1" }
toml = "1.1"
uuid = { version = "1", features = ["serde", "v4"] }
walkdir = "2"
# ── Optional, feature-gated dependencies ────────────────────────────────────
# Native-linking deps are pinned to OpenHuman's versions so the host and the
# crate link one bundled SQLite and one libgit2. Keep in lockstep with the host
# root Cargo.toml when either side bumps.
# git2 links libgit2 (heavy native build) — only for the `git-diff` feature.
git2 = { version = "0.21", default-features = false, features = [
"vendored-libgit2",
], optional = true }
# reqwest pulls a large async HTTP stack — only for live synchronization.
reqwest = { version = "0.12", default-features = false, features = [
"json",
"rustls-tls",
# `Response::bytes_stream()` — lets the network readers cap body size while
# streaming instead of after buffering the whole response.
"stream",
], optional = true }
tracing = { version = "0.1", optional = true }
# Per-OS config/home dir probing for the Obsidian vault registry (`obsidian`).
dirs = { version = "6", optional = true }
# Hex-encodes summary read-pointer ids into git tag names (`wiki-git`).
hex = { version = "0.4", optional = true }
# tokio powers the optional background worker loops (`tokio` feature). It is
# also listed under dev-dependencies so the async test suite always compiles.
tokio = { version = "1", features = [
"rt",
"rt-multi-thread",
"macros",
"time",
"sync",
# `process` powers the GitHub source reader's `gh` / `git` subprocess calls
# (`memory::sources::readers::github`, behind the `sync` feature).
"process",
# `net` powers the web-page reader's DNS-resolution SSRF guard
# (`tokio::net::lookup_host`, behind the `sync` feature).
"net",
], optional = true }
# macOS system address book, read by `memory::people::address_book` behind the
# `contacts` feature. Declared under a `cfg(target_os = "macos")` target table
# so these never enter a Linux or Windows dependency graph at all — the feature
# is a no-op there and the module falls back to its empty-contacts stub.
[target.'cfg(target_os = "macos")'.dependencies]
objc2 = { version = "0.6", optional = true }
objc2-foundation = { version = "0.3", features = [
"NSArray",
"NSError",
"NSObject",
"NSString",
"NSPredicate",
], optional = true }
objc2-contacts = { version = "0.3.2", features = [
"CNContact",
"CNContactFetchRequest",
"CNContactStore",
"CNLabeledValue",
"CNPhoneNumber",
], optional = true }
block2 = { version = "0.6", optional = true }
[dev-dependencies]
dotenvy = "0.15"
tempfile = "3"
tokio = { version = "1", features = ["macros", "rt-multi-thread", "sync", "time"] }
wiremock = "0.6"
[[test]]
name = "composio_sync_mock"
required-features = ["sync"]
[[test]]
name = "composio_sync_live"
required-features = ["sync"]
# Persona pipeline end-to-end over fixtures against a wiremock OpenRouter.
[[test]]
name = "persona_e2e"
required-features = ["persona", "providers-http", "git-diff"]
# Runnable persona distillation harness (doc 06).
# `OPENROUTER_API_KEY=... cargo run --example persona_harness --features persona,providers-http,git-diff -- backfill`
[[example]]
name = "persona_harness"
required-features = ["persona", "providers-http", "git-diff"]
# Persona decision assistant: algorithmic BM25 retrieval + a TinyInference LLM pass
# over the distilled persona memory layer (doc 06 follow-on).
# `OPENROUTER_API_KEY=... cargo run --example persona_agent --features persona -- "<question>"`
[[example]]
name = "persona_agent"
required-features = ["persona"]
# Runnable connection + memory-sync harness for a live Composio API key.
# `COMPOSIO_API_KEY=... cargo run --example composio_harness --features sync`
[[example]]
name = "composio_harness"
required-features = ["sync"]
# Seed a workspace with sample synced memory for the viewer (no API key needed).
# `TINYCORTEX_WORKSPACE=/tmp/demo cargo run --example seed_memory --features sync`
[[example]]
name = "seed_memory"
required-features = ["sync"]