brain-framework 34.0.0__tar.gz → 34.0.1__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.
- {brain_framework-34.0.0 → brain_framework-34.0.1}/PKG-INFO +1 -1
- {brain_framework-34.0.0 → brain_framework-34.0.1}/pyproject.toml +1 -1
- {brain_framework-34.0.0 → brain_framework-34.0.1}/pyproject.toml.orig +1 -1
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/__init__.py +1 -1
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/engine.py +2 -2
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/query.py +1 -1
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/refs.py +19 -6
- {brain_framework-34.0.0 → brain_framework-34.0.1}/LICENSE +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/README.md +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/THIRD_PARTY_NOTICES.md +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/__main__.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/cli.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/config.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/cron.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/index.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/loops.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/markdown.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/models.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/proc.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/py.typed +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/records.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/render.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/schemas.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/starter/AGENTS.md +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/starter/concepts/welcome.md +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/starter/evals/smoke.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/starter/gitignore +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/state.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/status.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/storage.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/watch.py +0 -0
- {brain_framework-34.0.0 → brain_framework-34.0.1}/src/bf/yaml_io.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: brain-framework
|
|
3
|
-
Version: 34.0.
|
|
3
|
+
Version: 34.0.1
|
|
4
4
|
Summary: Brain Framework is a local-first brain for you and your AI agents. It compiles YAML-frontmatter Markdown notes into JSONL records, validates with optional JSON Schemas, orchestrates least-privilege loops, and searches offline via a disposable SQLite FTS5 index.
|
|
5
5
|
Keywords: ai,ai-agents,agent-memory,agent-skills,agents-md,context-engineering,json,json-schema,knowledge-graph,knowledge-management,local-first,personal-knowledge-management,python,second-brain
|
|
6
6
|
Author: Médéric Hurier
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "brain-framework"
|
|
3
|
-
version = "34.0.
|
|
3
|
+
version = "34.0.1"
|
|
4
4
|
description = "Brain Framework is a local-first brain for you and your AI agents. It compiles YAML-frontmatter Markdown notes into JSONL records, validates with optional JSON Schemas, orchestrates least-privilege loops, and searches offline via a disposable SQLite FTS5 index."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# https://packaging.python.org/en/latest/specifications/pyproject-toml/
|
|
2
2
|
[project]
|
|
3
3
|
name = "brain-framework"
|
|
4
|
-
version = "34.0.
|
|
4
|
+
version = "34.0.1"
|
|
5
5
|
description = "Brain Framework is a local-first brain for you and your AI agents. It compiles YAML-frontmatter Markdown notes into JSONL records, validates with optional JSON Schemas, orchestrates least-privilege loops, and searches offline via a disposable SQLite FTS5 index."
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
requires-python = ">=3.12"
|
|
@@ -664,8 +664,8 @@ def validate(
|
|
|
664
664
|
)
|
|
665
665
|
else:
|
|
666
666
|
add(errors, "link", f"{origin}: broken link to {to}")
|
|
667
|
-
elif not refs.
|
|
668
|
-
add(errors, "link", f"{origin}: link target {to} must be
|
|
667
|
+
elif not refs.is_allowed_link_path(to, cfg.notes):
|
|
668
|
+
add(errors, "link", f"{origin}: link target {to} must be a non-private brain file without dotfiles")
|
|
669
669
|
elif not exists_cache.setdefault(to, to in exists_cache or store.exists(to)):
|
|
670
670
|
add(errors, "link", f"{origin}: broken link to {to}")
|
|
671
671
|
elif anc:
|
|
@@ -698,7 +698,7 @@ def _read_note_file(
|
|
|
698
698
|
) -> dict[str, Any] | str:
|
|
699
699
|
if not store.exists(to) and not to.endswith(".md"):
|
|
700
700
|
for cand in (f"{to}.md", f"{to}/index.md"):
|
|
701
|
-
if store.exists(cand):
|
|
701
|
+
if refs.is_allowed_note_path(cand, cfg.notes) and store.exists(cand):
|
|
702
702
|
to = cand
|
|
703
703
|
break
|
|
704
704
|
if not store.exists(to):
|
|
@@ -15,6 +15,7 @@ META_KEY_RE = re.compile(r"^[A-Za-z_][A-Za-z0-9_.-]*\Z")
|
|
|
15
15
|
_SCHEME = re.compile(r"^([A-Za-z][A-Za-z0-9+.-]*):(.*)\Z")
|
|
16
16
|
URL_SCHEMES = frozenset({"https", "http", "mailto", "urn"})
|
|
17
17
|
_FORBIDDEN = frozenset({"javascript", "data", "file", "vbscript", "tel"})
|
|
18
|
+
_PRIVATE_LINK_ROOTS = frozenset({"logs", "memories", "usages"})
|
|
18
19
|
_CONTROL_OR_SPACE = re.compile(r"[\x00-\x1f\x7f-\x9f\s]")
|
|
19
20
|
_DEFAULT_RESERVED = RESERVED_SOURCES | frozenset(DEFAULT_NOTES)
|
|
20
21
|
|
|
@@ -75,10 +76,19 @@ def is_record_ref(ref: str, reserved: frozenset[str] = _DEFAULT_RESERVED) -> boo
|
|
|
75
76
|
|
|
76
77
|
|
|
77
78
|
def is_allowed_note_path(path: str, note_dirs: Iterable[str] = DEFAULT_NOTES) -> bool:
|
|
78
|
-
"""Allowlist check: path must be normalized, dot-segment-free, and inside configured `note_dirs`."""
|
|
79
|
+
"""Allowlist check: path must be normalized, dot-segment-free, and strictly inside configured `note_dirs`."""
|
|
79
80
|
if not path or _bad_rel(path) or _has_dot_segment(path):
|
|
80
81
|
return False
|
|
81
|
-
|
|
82
|
+
head, sep, _ = path.partition("/")
|
|
83
|
+
return bool(sep) and head in frozenset(note_dirs)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def is_allowed_link_path(path: str, note_dirs: Iterable[str] = ()) -> bool:
|
|
87
|
+
"""Allowlist check for same-brain file links: normalized, dot-segment-free, outside private/runtime roots."""
|
|
88
|
+
if not path or _bad_rel(path) or _has_dot_segment(path):
|
|
89
|
+
return False
|
|
90
|
+
head = path.split("/", 1)[0]
|
|
91
|
+
return head in frozenset(note_dirs) or head.lower() not in _PRIVATE_LINK_ROOTS
|
|
82
92
|
|
|
83
93
|
|
|
84
94
|
def _normalize_note_path(src: str, raw_path: str, note_dirs: frozenset[str], *, relative_base: bool) -> str:
|
|
@@ -98,8 +108,8 @@ def _normalize_note_path(src: str, raw_path: str, note_dirs: frozenset[str], *,
|
|
|
98
108
|
if resolved == ".." or resolved.startswith("../"):
|
|
99
109
|
raise Error(f"{src}: link leaves the brain")
|
|
100
110
|
out = resolved
|
|
101
|
-
if not
|
|
102
|
-
raise Error(f"{src}: link target must be
|
|
111
|
+
if not is_allowed_link_path(out, note_dirs):
|
|
112
|
+
raise Error(f"{src}: link target must be a non-private brain file without dotfiles")
|
|
103
113
|
return out
|
|
104
114
|
|
|
105
115
|
|
|
@@ -159,12 +169,14 @@ def record_link_problem(
|
|
|
159
169
|
if kind == "brain":
|
|
160
170
|
bad_brain = bad_ch or not target.startswith("bf://") or not models.NAME_RE.fullmatch(sib_host) or not sib_path
|
|
161
171
|
sib_rec = is_record_ref(sib_path, RESERVED_SOURCES)
|
|
172
|
+
sib_head = sib_path.split("/", 1)[0]
|
|
162
173
|
sib_note = (
|
|
163
174
|
":" not in sib_path
|
|
164
175
|
and "?" not in sib_path
|
|
165
176
|
and not _bad_rel(sib_path)
|
|
166
177
|
and not _has_dot_segment(sib_path)
|
|
167
|
-
and
|
|
178
|
+
and sib_head not in RESERVED_SOURCES
|
|
179
|
+
and sib_head.lower() not in _PRIVATE_LINK_ROOTS
|
|
168
180
|
)
|
|
169
181
|
if bad_brain or not (sib_rec or sib_note):
|
|
170
182
|
return f"cross-brain link {target!r} must use bf://<brain>/<ref>"
|
|
@@ -252,7 +264,8 @@ def parse_link(
|
|
|
252
264
|
raise Error(f"{source_path}: expected bf:///path or bf://brain/path")
|
|
253
265
|
if _bad_rel(rest) or _has_dot_segment(rest):
|
|
254
266
|
raise Error(f"{source_path}: invalid path in bf:// URI")
|
|
255
|
-
|
|
267
|
+
sib_head = rest.split("/", 1)[0]
|
|
268
|
+
if not is_local and (sib_head in RESERVED_SOURCES or sib_head.lower() in _PRIVATE_LINK_ROOTS):
|
|
256
269
|
raise Error(f"{source_path}: private or runtime paths are not allowed in links")
|
|
257
270
|
canon = ""
|
|
258
271
|
if is_local:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|