-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathCargo.toml
More file actions
99 lines (96 loc) · 5.21 KB
/
Copy pathCargo.toml
File metadata and controls
99 lines (96 loc) · 5.21 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
[workspace]
resolver = "2"
# Every crate in this repository lives under `crates/`, one directory per
# package, each directory named for the package it holds. There is no
# root package: the facade a host depends on is `crates/tinymemory`, the same
# as any other member. Keeping the root virtual is what makes that uniform —
# a root package would make one crate structurally different from the rest for
# no reason other than history.
members = ["crates/*"]
# `crates/tinymemory-testing-ui` is deliberately left out of `default-members`:
# it is a manual testing harness, not part of the crate's build/release
# surface, so the four contract commands (which omit `-p`/`--workspace`) never
# touch it. Build or run it explicitly with `-p tinymemory-testing-ui`. Unlike
# `crates/tinymemory-module` it is a normal member here, not its own workspace
# root: it needs the root's `[patch.crates-io]` table to resolve `tinycortex`,
# and it carries none of the tinybus-inheritance problem documented below.
#
# Spelled out rather than globbed, because that is the whole point: `members`
# is a glob so a new crate joins the workspace by existing, and this list is
# the one place a crate is deliberately held out of the default build.
default-members = [
"crates/tinymemory",
"crates/tinymemory-api",
"crates/tinymemory-bus",
"crates/tinymemory-conformance",
"crates/tinymemory-core",
"crates/tinymemory-remote",
"crates/tinymemory-sources",
"crates/tinymemory-sync",
"crates/tinymemory-tinycortex",
]
# `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`.
#
# `worktrees/` holds `git worktree` checkouts of this same repository. Each one
# contains a full copy of this manifest and every crate under it, so without
# this entry cargo walks into them and reports duplicate packages.
exclude = ["vendor", "crates/tinymemory-module", "worktrees"]
# 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 = "crates/tinymemory-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"