brain-framework 21.2.0__tar.gz → 21.4.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.
- brain_framework-21.2.0/README.md → brain_framework-21.4.0/PKG-INFO +75 -4
- brain_framework-21.2.0/PKG-INFO → brain_framework-21.4.0/README.md +41 -34
- {brain_framework-21.2.0 → brain_framework-21.4.0}/THIRD_PARTY_NOTICES.md +3 -3
- {brain_framework-21.2.0 → brain_framework-21.4.0}/pyproject.toml +11 -2
- {brain_framework-21.2.0 → brain_framework-21.4.0}/pyproject.toml.orig +11 -2
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/__init__.py +1 -1
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/assistants.py +88 -67
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/channels.py +14 -24
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/cli.py +51 -10
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/collect.py +185 -50
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/graph.py +2 -2
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/health.py +58 -16
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/history.py +6 -1
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/index.py +187 -23
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/mcp.py +2 -1
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/models.py +164 -39
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/pages.py +29 -14
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/records.py +12 -8
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/replies.py +267 -2
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/retrieve.py +121 -41
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/runtime.py +0 -12
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/schemas.py +5 -7
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/README.md +1 -1
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-maintain/SKILL.md +1 -1
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-maintain/references/integrations.md +5 -4
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-maintain/references/operations.md +5 -3
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/SKILL.md +4 -3
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/references/evidence.md +2 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/references/learn.md +1 -1
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/references/retrieval.md +3 -3
- brain_framework-21.4.0/src/bf/starter/AGENTS.md +23 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/starter/evals/retrieval.yaml +1 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/storage.py +8 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/update.py +18 -14
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/validate.py +12 -9
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/watch.py +31 -4
- brain_framework-21.2.0/src/bf/starter/AGENTS.md +0 -19
- {brain_framework-21.2.0 → brain_framework-21.4.0}/LICENSE +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/__main__.py +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/config.py +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/evaluate.py +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/install.py +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/links.py +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/markdown.py +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/messages.py +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/ontology.py +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/py.typed +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-action/SKILL.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-action/references/actions.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-action/references/context.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-action/references/handoff.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-action/scripts/check-handoff.py +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-action/scripts/new-action.py +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-action/templates/action.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-maintain/references/conflicts.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-setup/SKILL.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-setup/references/discovery.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-setup/references/import.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-setup/references/scan.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-setup/scripts/inventory.py +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/references/consolidate.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/references/decisions.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/references/links.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/references/review.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/references/share.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/scripts/evidence.py +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/scripts/guarded-write.py +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/templates/concept.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/skills/bf-use/templates/project.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/starter/concepts/index.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/starter/concepts/welcome.md +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/starter/gitignore +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/usage.py +0 -0
- {brain_framework-21.2.0 → brain_framework-21.4.0}/src/bf/watch_settings.py +0 -0
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: brain-framework
|
|
3
|
+
Version: 21.4.0
|
|
4
|
+
Summary: Brain Framework is a local-first brain for you and your AI agents. It gathers evidence from your tools into plain files you own, connects it through an ontology you declare, lets any agent harness search it offline and can wake that harness when a gate you review finds an event.
|
|
5
|
+
Keywords: ai,ai-agents,agent-memory,agent-skills,agents-md,context-engineering,knowledge-graph,knowledge-management,local-first,mcp,model-context-protocol,ontology,personal-knowledge-management,python,second-brain
|
|
6
|
+
Author: Médéric Hurier
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
License-File: THIRD_PARTY_NOTICES.md
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: MacOS
|
|
14
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Classifier: Topic :: Text Processing :: Indexing
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Dist: markdown-it-py>=4.2.0,<5
|
|
21
|
+
Requires-Dist: pydantic>=2.13.5,<3
|
|
22
|
+
Requires-Dist: pyyaml>=6.0.3,<7
|
|
23
|
+
Requires-Dist: rich>=15.0.0,<16
|
|
24
|
+
Requires-Dist: typer>=0.27.2,<1
|
|
25
|
+
Requires-Dist: mcp>=2.1.1,<3 ; extra == 'mcp'
|
|
26
|
+
Requires-Python: >=3.14
|
|
27
|
+
Project-URL: Changelog, https://fmind.github.io/brain-framework/changelog/
|
|
28
|
+
Project-URL: Documentation, https://fmind.github.io/brain-framework/
|
|
29
|
+
Project-URL: Issues, https://github.com/fmind/brain-framework/issues
|
|
30
|
+
Project-URL: Repository, https://github.com/fmind/brain-framework
|
|
31
|
+
Project-URL: Security, https://github.com/fmind/brain-framework/security/policy
|
|
32
|
+
Provides-Extra: mcp
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
1
35
|
<p align="center">
|
|
2
36
|
<img
|
|
3
37
|
src="https://raw.githubusercontent.com/fmind/brain-framework/main/docs/assets/brain-framework.svg"
|
|
@@ -11,11 +45,15 @@
|
|
|
11
45
|
|
|
12
46
|
**🧠 Brain Framework: from information to informed actions.**
|
|
13
47
|
|
|
14
|
-
|
|
48
|
+
Brain Framework is a local-first brain for you and your AI agents. It gathers evidence from your tools into plain files you own, connects it through an ontology you declare, lets any agent harness search it offline and can wake that harness when a gate you review finds an event.
|
|
49
|
+
|
|
50
|
+
- **Files you own, open to any agent.** A brain is a folder of Markdown and JSON. Agents reach it through the `bf` CLI, [MCP](https://fmind.github.io/brain-framework/docs/mcp/), [Agent Skills](https://agentskills.io/specification) and `AGENTS.md`.
|
|
51
|
+
- **Connections you declare.** Fields and links are explicit, and each claim keeps its source record. When that record changes, `newer_evidence` flags the conclusion. Nothing is inferred.
|
|
52
|
+
- **You decide when your agent runs.** [Gate programs](https://github.com/fmind/brain-framework#let-your-agent-come-to-you) you review can decide when your harness starts, and the harness's own permissions decide what it may do.
|
|
15
53
|
|
|
16
54
|
[](https://github.com/fmind/brain-framework/actions/workflows/ci.yml) [](https://pypi.org/project/brain-framework/) [](https://pypi.org/project/brain-framework/) [](https://github.com/fmind/brain-framework/blob/main/LICENSE)
|
|
17
55
|
|
|
18
|
-
[Try it](https://github.com/fmind/brain-framework#try-it) · [How it works](https://github.com/fmind/brain-framework#how-it-works) · [Agents](https://github.com/fmind/brain-framework#open-your-agent-in-your-brain) · [Your tools](https://github.com/fmind/brain-framework#bring-your-tools) · [Good to know](https://github.com/fmind/brain-framework#good-to-know) · [Documentation](https://fmind.github.io/brain-framework/)
|
|
56
|
+
[Try it](https://github.com/fmind/brain-framework#try-it) · [How it works](https://github.com/fmind/brain-framework#how-it-works) · [Agents](https://github.com/fmind/brain-framework#open-your-agent-in-your-brain) · [Your tools](https://github.com/fmind/brain-framework#bring-your-tools) · [Proactive agents](https://github.com/fmind/brain-framework#let-your-agent-come-to-you) · [Good to know](https://github.com/fmind/brain-framework#good-to-know) · [Documentation](https://fmind.github.io/brain-framework/)
|
|
19
57
|
|
|
20
58
|
<a href="https://raw.githubusercontent.com/fmind/brain-framework/main/docs/assets/brain-loop.svg">
|
|
21
59
|
<img
|
|
@@ -228,12 +266,45 @@ After reviewing your sensors, run `bf watch` to keep them refreshed and see fail
|
|
|
228
266
|
|
|
229
267
|
The dashboard shows the [offline watch demo](https://github.com/fmind/brain-framework/tree/main/examples/watch), which needs no provider account.
|
|
230
268
|
|
|
269
|
+
## Let your agent come to you
|
|
270
|
+
|
|
271
|
+
An [assistant](https://fmind.github.io/brain-framework/docs/prompts/) can watch what your sensors collect and speak first:
|
|
272
|
+
|
|
273
|
+
```yaml
|
|
274
|
+
assistants:
|
|
275
|
+
triage:
|
|
276
|
+
prompt: prompts/triage.md
|
|
277
|
+
# Claude Code may run only bf read and bf search, plus what its settings allow: swap in your harness.
|
|
278
|
+
command:
|
|
279
|
+
[
|
|
280
|
+
claude,
|
|
281
|
+
--print,
|
|
282
|
+
--output-format,
|
|
283
|
+
json,
|
|
284
|
+
--json-schema,
|
|
285
|
+
"{{schema}}",
|
|
286
|
+
--tools,
|
|
287
|
+
"Read,Grep,Glob,Bash",
|
|
288
|
+
--allowedTools,
|
|
289
|
+
"Bash(bf read *),Bash(bf search *)",
|
|
290
|
+
--permission-mode,
|
|
291
|
+
dontAsk,
|
|
292
|
+
]
|
|
293
|
+
reply: { path: /structured_output } # {say, wake}
|
|
294
|
+
post: desktop # a channel you declare
|
|
295
|
+
wake: { min: 600, max: 86400 }
|
|
296
|
+
schedules:
|
|
297
|
+
mail: { every: 600, gate: { command: [python3, routines/records-gate.py, mail] } }
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
While `bf watch` runs, a [gate](https://github.com/fmind/brain-framework/blob/main/examples/routines/records-gate.py) you review checks the collected records every 10 minutes. Each check starts your harness only when the gate finds events. The harness speaks or stays silent and may ask for one follow-up wake. BF posts its answer to your channel and records each run. Mail text reaches your harness, so [limit its tools](https://fmind.github.io/brain-framework/docs/prompts/#keep-prompts-safe), or let a read-only assistant [propose and another act](https://fmind.github.io/brain-framework/docs/prompts/#propose-then-act).
|
|
301
|
+
|
|
231
302
|
## Good to know
|
|
232
303
|
|
|
233
304
|
1. **Your data stays on your computer.** A brain is a folder on your disk. BF has no account, server or telemetry, and search and read work offline. Sensors collect while your machine is on.
|
|
234
305
|
1. **Your agent does the reasoning.** BF never runs a model: it collects, validates, searches and connects, and its [assistants](https://fmind.github.io/brain-framework/docs/prompts/) launch your agent harness. What your agent reads reaches that harness's provider; see [privacy and security](https://fmind.github.io/brain-framework/docs/privacy/) for a fully local setup.
|
|
235
306
|
1. **Git gives history and sharing.** Notes and programs are plain files: commit them for history, rollback and review. By default, collected records stay out of Git. A team brain is a private repository with one clone per teammate, and a personal brain can include it in its searches. See [team setup](https://fmind.github.io/brain-framework/docs/team/).
|
|
236
|
-
1. **It takes some setup.** Each source needs its access, such as `gh auth login` or `gcloud` authentication, then a sensor you review. Sensors, routines and the ontology are files you can read, edit or ask your agent to adapt.
|
|
307
|
+
1. **It takes some setup.** Each source needs its access, such as `gh auth login` or `gcloud` authentication, then a sensor you review. Sensors, routines and the ontology are files you can read, edit or ask your agent to adapt. A major release lists its manual upgrade steps; see [versioning and stability](https://fmind.github.io/brain-framework/docs/upgrades/#versioning-and-stability).
|
|
237
308
|
1. **It finds what was said and linked, not what was meant.** Search matches words and explicit identities, without embeddings, and incomplete results say so. Collect again when you need newer evidence. See [what BF does not do](https://fmind.github.io/brain-framework/docs/concepts/#what-bf-does-not-do).
|
|
238
309
|
|
|
239
|
-
[Browse the commands](https://fmind.github.io/brain-framework/docs/commands/) · [Report an issue](https://github.com/fmind/brain-framework/issues) · [Contribute](https://github.com/fmind/brain-framework/blob/main/CONTRIBUTING.md) · [MIT licensed](https://github.com/fmind/brain-framework/blob/main/LICENSE) · [Third-party notices](https://github.com/fmind/brain-framework/blob/main/THIRD_PARTY_NOTICES.md)
|
|
310
|
+
[Browse the commands](https://fmind.github.io/brain-framework/docs/commands/) · [Report an issue](https://github.com/fmind/brain-framework/issues) · [Contribute](https://github.com/fmind/brain-framework/blob/main/CONTRIBUTING.md) · [Governance](https://github.com/fmind/brain-framework/blob/main/GOVERNANCE.md) · [MIT licensed](https://github.com/fmind/brain-framework/blob/main/LICENSE) · [Third-party notices](https://github.com/fmind/brain-framework/blob/main/THIRD_PARTY_NOTICES.md)
|
|
@@ -1,33 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: brain-framework
|
|
3
|
-
Version: 21.2.0
|
|
4
|
-
Summary: 🧠 Brain Framework: from information to informed actions.
|
|
5
|
-
Keywords: ai,ai-agents,agent-memory,context-engineering,knowledge-management,local-first,mcp,model-context-protocol,python,second-brain
|
|
6
|
-
Author: Médéric Hurier
|
|
7
|
-
License-Expression: MIT
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
License-File: THIRD_PARTY_NOTICES.md
|
|
10
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
-
Classifier: Environment :: Console
|
|
12
|
-
Classifier: Operating System :: MacOS
|
|
13
|
-
Classifier: Operating System :: POSIX :: Linux
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
-
Classifier: Typing :: Typed
|
|
17
|
-
Requires-Dist: markdown-it-py>=4.2.0,<5
|
|
18
|
-
Requires-Dist: pydantic>=2.13.5,<3
|
|
19
|
-
Requires-Dist: pyyaml>=6.0.3,<7
|
|
20
|
-
Requires-Dist: rich>=15.0.0,<16
|
|
21
|
-
Requires-Dist: typer>=0.27.2,<1
|
|
22
|
-
Requires-Dist: mcp>=2.1.1,<3 ; extra == 'mcp'
|
|
23
|
-
Requires-Python: >=3.14
|
|
24
|
-
Project-URL: Changelog, https://fmind.github.io/brain-framework/changelog/
|
|
25
|
-
Project-URL: Documentation, https://fmind.github.io/brain-framework/
|
|
26
|
-
Project-URL: Issues, https://github.com/fmind/brain-framework/issues
|
|
27
|
-
Project-URL: Repository, https://github.com/fmind/brain-framework
|
|
28
|
-
Provides-Extra: mcp
|
|
29
|
-
Description-Content-Type: text/markdown
|
|
30
|
-
|
|
31
1
|
<p align="center">
|
|
32
2
|
<img
|
|
33
3
|
src="https://raw.githubusercontent.com/fmind/brain-framework/main/docs/assets/brain-framework.svg"
|
|
@@ -41,11 +11,15 @@ Description-Content-Type: text/markdown
|
|
|
41
11
|
|
|
42
12
|
**🧠 Brain Framework: from information to informed actions.**
|
|
43
13
|
|
|
44
|
-
|
|
14
|
+
Brain Framework is a local-first brain for you and your AI agents. It gathers evidence from your tools into plain files you own, connects it through an ontology you declare, lets any agent harness search it offline and can wake that harness when a gate you review finds an event.
|
|
15
|
+
|
|
16
|
+
- **Files you own, open to any agent.** A brain is a folder of Markdown and JSON. Agents reach it through the `bf` CLI, [MCP](https://fmind.github.io/brain-framework/docs/mcp/), [Agent Skills](https://agentskills.io/specification) and `AGENTS.md`.
|
|
17
|
+
- **Connections you declare.** Fields and links are explicit, and each claim keeps its source record. When that record changes, `newer_evidence` flags the conclusion. Nothing is inferred.
|
|
18
|
+
- **You decide when your agent runs.** [Gate programs](https://github.com/fmind/brain-framework#let-your-agent-come-to-you) you review can decide when your harness starts, and the harness's own permissions decide what it may do.
|
|
45
19
|
|
|
46
20
|
[](https://github.com/fmind/brain-framework/actions/workflows/ci.yml) [](https://pypi.org/project/brain-framework/) [](https://pypi.org/project/brain-framework/) [](https://github.com/fmind/brain-framework/blob/main/LICENSE)
|
|
47
21
|
|
|
48
|
-
[Try it](https://github.com/fmind/brain-framework#try-it) · [How it works](https://github.com/fmind/brain-framework#how-it-works) · [Agents](https://github.com/fmind/brain-framework#open-your-agent-in-your-brain) · [Your tools](https://github.com/fmind/brain-framework#bring-your-tools) · [Good to know](https://github.com/fmind/brain-framework#good-to-know) · [Documentation](https://fmind.github.io/brain-framework/)
|
|
22
|
+
[Try it](https://github.com/fmind/brain-framework#try-it) · [How it works](https://github.com/fmind/brain-framework#how-it-works) · [Agents](https://github.com/fmind/brain-framework#open-your-agent-in-your-brain) · [Your tools](https://github.com/fmind/brain-framework#bring-your-tools) · [Proactive agents](https://github.com/fmind/brain-framework#let-your-agent-come-to-you) · [Good to know](https://github.com/fmind/brain-framework#good-to-know) · [Documentation](https://fmind.github.io/brain-framework/)
|
|
49
23
|
|
|
50
24
|
<a href="https://raw.githubusercontent.com/fmind/brain-framework/main/docs/assets/brain-loop.svg">
|
|
51
25
|
<img
|
|
@@ -258,12 +232,45 @@ After reviewing your sensors, run `bf watch` to keep them refreshed and see fail
|
|
|
258
232
|
|
|
259
233
|
The dashboard shows the [offline watch demo](https://github.com/fmind/brain-framework/tree/main/examples/watch), which needs no provider account.
|
|
260
234
|
|
|
235
|
+
## Let your agent come to you
|
|
236
|
+
|
|
237
|
+
An [assistant](https://fmind.github.io/brain-framework/docs/prompts/) can watch what your sensors collect and speak first:
|
|
238
|
+
|
|
239
|
+
```yaml
|
|
240
|
+
assistants:
|
|
241
|
+
triage:
|
|
242
|
+
prompt: prompts/triage.md
|
|
243
|
+
# Claude Code may run only bf read and bf search, plus what its settings allow: swap in your harness.
|
|
244
|
+
command:
|
|
245
|
+
[
|
|
246
|
+
claude,
|
|
247
|
+
--print,
|
|
248
|
+
--output-format,
|
|
249
|
+
json,
|
|
250
|
+
--json-schema,
|
|
251
|
+
"{{schema}}",
|
|
252
|
+
--tools,
|
|
253
|
+
"Read,Grep,Glob,Bash",
|
|
254
|
+
--allowedTools,
|
|
255
|
+
"Bash(bf read *),Bash(bf search *)",
|
|
256
|
+
--permission-mode,
|
|
257
|
+
dontAsk,
|
|
258
|
+
]
|
|
259
|
+
reply: { path: /structured_output } # {say, wake}
|
|
260
|
+
post: desktop # a channel you declare
|
|
261
|
+
wake: { min: 600, max: 86400 }
|
|
262
|
+
schedules:
|
|
263
|
+
mail: { every: 600, gate: { command: [python3, routines/records-gate.py, mail] } }
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
While `bf watch` runs, a [gate](https://github.com/fmind/brain-framework/blob/main/examples/routines/records-gate.py) you review checks the collected records every 10 minutes. Each check starts your harness only when the gate finds events. The harness speaks or stays silent and may ask for one follow-up wake. BF posts its answer to your channel and records each run. Mail text reaches your harness, so [limit its tools](https://fmind.github.io/brain-framework/docs/prompts/#keep-prompts-safe), or let a read-only assistant [propose and another act](https://fmind.github.io/brain-framework/docs/prompts/#propose-then-act).
|
|
267
|
+
|
|
261
268
|
## Good to know
|
|
262
269
|
|
|
263
270
|
1. **Your data stays on your computer.** A brain is a folder on your disk. BF has no account, server or telemetry, and search and read work offline. Sensors collect while your machine is on.
|
|
264
271
|
1. **Your agent does the reasoning.** BF never runs a model: it collects, validates, searches and connects, and its [assistants](https://fmind.github.io/brain-framework/docs/prompts/) launch your agent harness. What your agent reads reaches that harness's provider; see [privacy and security](https://fmind.github.io/brain-framework/docs/privacy/) for a fully local setup.
|
|
265
272
|
1. **Git gives history and sharing.** Notes and programs are plain files: commit them for history, rollback and review. By default, collected records stay out of Git. A team brain is a private repository with one clone per teammate, and a personal brain can include it in its searches. See [team setup](https://fmind.github.io/brain-framework/docs/team/).
|
|
266
|
-
1. **It takes some setup.** Each source needs its access, such as `gh auth login` or `gcloud` authentication, then a sensor you review. Sensors, routines and the ontology are files you can read, edit or ask your agent to adapt.
|
|
273
|
+
1. **It takes some setup.** Each source needs its access, such as `gh auth login` or `gcloud` authentication, then a sensor you review. Sensors, routines and the ontology are files you can read, edit or ask your agent to adapt. A major release lists its manual upgrade steps; see [versioning and stability](https://fmind.github.io/brain-framework/docs/upgrades/#versioning-and-stability).
|
|
267
274
|
1. **It finds what was said and linked, not what was meant.** Search matches words and explicit identities, without embeddings, and incomplete results say so. Collect again when you need newer evidence. See [what BF does not do](https://fmind.github.io/brain-framework/docs/concepts/#what-bf-does-not-do).
|
|
268
275
|
|
|
269
|
-
[Browse the commands](https://fmind.github.io/brain-framework/docs/commands/) · [Report an issue](https://github.com/fmind/brain-framework/issues) · [Contribute](https://github.com/fmind/brain-framework/blob/main/CONTRIBUTING.md) · [MIT licensed](https://github.com/fmind/brain-framework/blob/main/LICENSE) · [Third-party notices](https://github.com/fmind/brain-framework/blob/main/THIRD_PARTY_NOTICES.md)
|
|
276
|
+
[Browse the commands](https://fmind.github.io/brain-framework/docs/commands/) · [Report an issue](https://github.com/fmind/brain-framework/issues) · [Contribute](https://github.com/fmind/brain-framework/blob/main/CONTRIBUTING.md) · [Governance](https://github.com/fmind/brain-framework/blob/main/GOVERNANCE.md) · [MIT licensed](https://github.com/fmind/brain-framework/blob/main/LICENSE) · [Third-party notices](https://github.com/fmind/brain-framework/blob/main/THIRD_PARTY_NOTICES.md)
|
|
@@ -1635,15 +1635,15 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
1635
1635
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
1636
1636
|
```
|
|
1637
1637
|
|
|
1638
|
-
## sse-starlette 3.
|
|
1638
|
+
## sse-starlette 3.7.0
|
|
1639
1639
|
|
|
1640
1640
|
Source: <https://github.com/sysid/sse-starlette>
|
|
1641
1641
|
|
|
1642
1642
|
License: `BSD-3-Clause`
|
|
1643
1643
|
|
|
1644
|
-
Evidence: `sse_starlette-3.
|
|
1644
|
+
Evidence: `sse_starlette-3.7.0.dist-info/licenses/LICENSE`
|
|
1645
1645
|
|
|
1646
|
-
### sse_starlette-3.
|
|
1646
|
+
### sse_starlette-3.7.0.dist-info/licenses/LICENSE
|
|
1647
1647
|
|
|
1648
1648
|
```text
|
|
1649
1649
|
Copyright © 2020, [sysid](https://sysid.github.io/).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "brain-framework"
|
|
3
|
-
version = "21.
|
|
4
|
-
description = "
|
|
3
|
+
version = "21.4.0"
|
|
4
|
+
description = "Brain Framework is a local-first brain for you and your AI agents. It gathers evidence from your tools into plain files you own, connects it through an ontology you declare, lets any agent harness search it offline and can wake that harness when a gate you review finds an event."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.14"
|
|
7
7
|
license = "MIT"
|
|
@@ -13,21 +13,29 @@ keywords = [
|
|
|
13
13
|
"ai",
|
|
14
14
|
"ai-agents",
|
|
15
15
|
"agent-memory",
|
|
16
|
+
"agent-skills",
|
|
17
|
+
"agents-md",
|
|
16
18
|
"context-engineering",
|
|
19
|
+
"knowledge-graph",
|
|
17
20
|
"knowledge-management",
|
|
18
21
|
"local-first",
|
|
19
22
|
"mcp",
|
|
20
23
|
"model-context-protocol",
|
|
24
|
+
"ontology",
|
|
25
|
+
"personal-knowledge-management",
|
|
21
26
|
"python",
|
|
22
27
|
"second-brain",
|
|
23
28
|
]
|
|
24
29
|
classifiers = [
|
|
25
30
|
"Development Status :: 5 - Production/Stable",
|
|
26
31
|
"Environment :: Console",
|
|
32
|
+
"Intended Audience :: Developers",
|
|
27
33
|
"Operating System :: MacOS",
|
|
28
34
|
"Operating System :: POSIX :: Linux",
|
|
29
35
|
"Programming Language :: Python :: 3",
|
|
30
36
|
"Programming Language :: Python :: 3.14",
|
|
37
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
38
|
+
"Topic :: Text Processing :: Indexing",
|
|
31
39
|
"Typing :: Typed",
|
|
32
40
|
]
|
|
33
41
|
dependencies = [
|
|
@@ -49,6 +57,7 @@ Changelog = "https://fmind.github.io/brain-framework/changelog/"
|
|
|
49
57
|
Documentation = "https://fmind.github.io/brain-framework/"
|
|
50
58
|
Issues = "https://github.com/fmind/brain-framework/issues"
|
|
51
59
|
Repository = "https://github.com/fmind/brain-framework"
|
|
60
|
+
Security = "https://github.com/fmind/brain-framework/security/policy"
|
|
52
61
|
|
|
53
62
|
[project.scripts]
|
|
54
63
|
bf = "bf:main"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# https://packaging.python.org/en/latest/specifications/pyproject-toml/
|
|
2
2
|
[project]
|
|
3
3
|
name = "brain-framework"
|
|
4
|
-
version = "21.
|
|
5
|
-
description = "
|
|
4
|
+
version = "21.4.0"
|
|
5
|
+
description = "Brain Framework is a local-first brain for you and your AI agents. It gathers evidence from your tools into plain files you own, connects it through an ontology you declare, lets any agent harness search it offline and can wake that harness when a gate you review finds an event."
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
requires-python = ">=3.14"
|
|
8
8
|
license = "MIT"
|
|
@@ -12,21 +12,29 @@ keywords = [
|
|
|
12
12
|
"ai",
|
|
13
13
|
"ai-agents",
|
|
14
14
|
"agent-memory",
|
|
15
|
+
"agent-skills",
|
|
16
|
+
"agents-md",
|
|
15
17
|
"context-engineering",
|
|
18
|
+
"knowledge-graph",
|
|
16
19
|
"knowledge-management",
|
|
17
20
|
"local-first",
|
|
18
21
|
"mcp",
|
|
19
22
|
"model-context-protocol",
|
|
23
|
+
"ontology",
|
|
24
|
+
"personal-knowledge-management",
|
|
20
25
|
"python",
|
|
21
26
|
"second-brain",
|
|
22
27
|
]
|
|
23
28
|
classifiers = [
|
|
24
29
|
"Development Status :: 5 - Production/Stable",
|
|
25
30
|
"Environment :: Console",
|
|
31
|
+
"Intended Audience :: Developers",
|
|
26
32
|
"Operating System :: MacOS",
|
|
27
33
|
"Operating System :: POSIX :: Linux",
|
|
28
34
|
"Programming Language :: Python :: 3",
|
|
29
35
|
"Programming Language :: Python :: 3.14",
|
|
36
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
37
|
+
"Topic :: Text Processing :: Indexing",
|
|
30
38
|
"Typing :: Typed",
|
|
31
39
|
]
|
|
32
40
|
dependencies = [
|
|
@@ -46,6 +54,7 @@ Changelog = "https://fmind.github.io/brain-framework/changelog/"
|
|
|
46
54
|
Documentation = "https://fmind.github.io/brain-framework/"
|
|
47
55
|
Issues = "https://github.com/fmind/brain-framework/issues"
|
|
48
56
|
Repository = "https://github.com/fmind/brain-framework"
|
|
57
|
+
Security = "https://github.com/fmind/brain-framework/security/policy"
|
|
49
58
|
|
|
50
59
|
[project.scripts]
|
|
51
60
|
bf = "bf:main"
|
|
@@ -48,6 +48,7 @@ from bf.models import (
|
|
|
48
48
|
decode,
|
|
49
49
|
digest,
|
|
50
50
|
encode,
|
|
51
|
+
reason,
|
|
51
52
|
retried,
|
|
52
53
|
timestamp,
|
|
53
54
|
)
|
|
@@ -84,10 +85,6 @@ class StreamStoppedError(Error):
|
|
|
84
85
|
"""A stream worker ended outside shutdown: its input would silently stop being accepted, so watch stops."""
|
|
85
86
|
|
|
86
87
|
|
|
87
|
-
def _reason(error: BaseException, fallback: str = "assistant files are inaccessible") -> str:
|
|
88
|
-
return str(error) if isinstance(error, Error) else fallback
|
|
89
|
-
|
|
90
|
-
|
|
91
88
|
def prepare(
|
|
92
89
|
store: Store,
|
|
93
90
|
name: str,
|
|
@@ -143,8 +140,8 @@ def prepare(
|
|
|
143
140
|
|
|
144
141
|
def read_failure(channel: str, error: BaseException) -> str:
|
|
145
142
|
"""A failed read poll, worded alike by bf update and watch, naming the channel's read log."""
|
|
146
|
-
|
|
147
|
-
return f"channel {channel}: read failed: {
|
|
143
|
+
cause = reason(error, "its files are inaccessible").removeprefix(f"channel {channel}: ")
|
|
144
|
+
return f"channel {channel}: read failed: {cause}; see {log_path(f'channel.{channel}.read')}"
|
|
148
145
|
|
|
149
146
|
|
|
150
147
|
def _oversized(store: Store, work: Work) -> str:
|
|
@@ -291,11 +288,62 @@ def _exposed(work: Work) -> AbstractContextManager[None]:
|
|
|
291
288
|
return exposing(BF_TRIGGER=work.kind, BF_SCHEDULE=_schedule(work), BF_START=work.start, BF_END=work.end)
|
|
292
289
|
|
|
293
290
|
|
|
291
|
+
def _recorded(
|
|
292
|
+
work: Work, reply: str, wake: Requested | None, metadata: dict[str, JsonValue]
|
|
293
|
+
) -> tuple[Record, list[Outgoing]]:
|
|
294
|
+
"""The record and deliveries an answer makes. The error never quotes the output."""
|
|
295
|
+
try:
|
|
296
|
+
record = Record(
|
|
297
|
+
id=datetime.fromisoformat(work.end).astimezone(UTC).strftime("%Y%m%dT%H%M%SZ") + "-" + work.id[-8:],
|
|
298
|
+
title=reply_title(work.assistant, reply),
|
|
299
|
+
text=reply,
|
|
300
|
+
time=work.end,
|
|
301
|
+
attributes={
|
|
302
|
+
"observed": work.end,
|
|
303
|
+
"trigger": work.kind,
|
|
304
|
+
"job": work.id,
|
|
305
|
+
"window": {"start": work.start, "end": work.end},
|
|
306
|
+
**({"input": work.text} if work.text else {}),
|
|
307
|
+
**({"output": metadata} if metadata else {}),
|
|
308
|
+
**({"wake": wake.model_dump()} if wake else {}),
|
|
309
|
+
**(
|
|
310
|
+
{
|
|
311
|
+
"channel": work.origin.channel,
|
|
312
|
+
"sender": work.origin.message.sender,
|
|
313
|
+
"conversation": work.origin.message.conversation,
|
|
314
|
+
}
|
|
315
|
+
if work.origin
|
|
316
|
+
else {}
|
|
317
|
+
),
|
|
318
|
+
},
|
|
319
|
+
)
|
|
320
|
+
replies = (
|
|
321
|
+
[
|
|
322
|
+
Outgoing(
|
|
323
|
+
id=digest(f"{work.id}:{route.channel}:{route.conversation}".encode())[:32],
|
|
324
|
+
text=reply,
|
|
325
|
+
conversation=route.conversation,
|
|
326
|
+
reply_to=route.reply_to,
|
|
327
|
+
)
|
|
328
|
+
for route in work.routes
|
|
329
|
+
]
|
|
330
|
+
if reply.strip()
|
|
331
|
+
else []
|
|
332
|
+
)
|
|
333
|
+
except ValidationError:
|
|
334
|
+
# Pydantic's message quotes the invalid input: report the cause, never the content.
|
|
335
|
+
raise Error(
|
|
336
|
+
"assistant output cannot become a record: it holds invalid Unicode or more than 2 MiB outside its "
|
|
337
|
+
f"message; see {log_path(work.assistant)}"
|
|
338
|
+
) from None
|
|
339
|
+
return record, replies
|
|
340
|
+
|
|
341
|
+
|
|
294
342
|
def _attempt(store: Store, work: Work, runner: Runner, argv: list[str], stdin: bytes) -> bytes:
|
|
295
|
-
"""Run the harness once, telling it why it runs; an answer that
|
|
343
|
+
"""Run the harness once, telling it why it runs; an answer that cannot be parsed or recorded fails the attempt."""
|
|
296
344
|
with _exposed(work):
|
|
297
345
|
raw = runner(argv, work.settings, store, work.assistant, stdin)
|
|
298
|
-
_answer(raw, work)
|
|
346
|
+
_recorded(work, *_answer(raw, work))
|
|
299
347
|
return raw
|
|
300
348
|
|
|
301
349
|
|
|
@@ -318,8 +366,8 @@ def _gate(store: Store, work: Work, runner: Runner) -> list[JsonValue] | None:
|
|
|
318
366
|
f"see {log_path(name)}"
|
|
319
367
|
) from None
|
|
320
368
|
except (Error, OSError, UnicodeError) as error:
|
|
321
|
-
|
|
322
|
-
raise GateError(
|
|
369
|
+
cause = reason(error, f"gate of schedule {schedule} failed; see {log_path(name)}")
|
|
370
|
+
raise GateError(cause) from error
|
|
323
371
|
events: list[JsonValue] = [event.model_dump(exclude_defaults=True) for event in reply.events]
|
|
324
372
|
if len(encode(events)) > GATE_EVENT_BYTES:
|
|
325
373
|
# Saved events are reused on every retry: an oversized set would fail each prompt the same way.
|
|
@@ -401,7 +449,6 @@ def _execute(store: Store, key: str, runner: Runner) -> dict[str, object]:
|
|
|
401
449
|
argv, stdin = expanded(store, work, queue)
|
|
402
450
|
if not queue.claim(key):
|
|
403
451
|
raise Error("assistant job is no longer pending; inspect bf queue")
|
|
404
|
-
queue.lifecycle("assistant.started", work.assistant, {"job": key, "kind": work.kind})
|
|
405
452
|
queue.answer(key, _attempt(store, work, runner, argv, stdin))
|
|
406
453
|
row = queue.get(key)
|
|
407
454
|
if row["state"] == "answered":
|
|
@@ -410,43 +457,7 @@ def _execute(store: Store, key: str, runner: Runner) -> dict[str, object]:
|
|
|
410
457
|
raise Error("assistant returned no response to an incoming message; inspect the saved answer")
|
|
411
458
|
if work.kind in {"schedule", "wake"} and not reply and not metadata:
|
|
412
459
|
return _quiet(store, queue, work, key, wake)
|
|
413
|
-
record =
|
|
414
|
-
id=datetime.fromisoformat(work.end).astimezone(UTC).strftime("%Y%m%dT%H%M%SZ") + "-" + work.id[-8:],
|
|
415
|
-
title=reply_title(work.assistant, reply),
|
|
416
|
-
text=reply,
|
|
417
|
-
time=work.end,
|
|
418
|
-
attributes={
|
|
419
|
-
"observed": work.end,
|
|
420
|
-
"trigger": work.kind,
|
|
421
|
-
"job": key,
|
|
422
|
-
"window": {"start": work.start, "end": work.end},
|
|
423
|
-
**({"input": work.text} if work.text else {}),
|
|
424
|
-
**({"output": metadata} if metadata else {}),
|
|
425
|
-
**({"wake": wake.model_dump()} if wake else {}),
|
|
426
|
-
**(
|
|
427
|
-
{
|
|
428
|
-
"channel": work.origin.channel,
|
|
429
|
-
"sender": work.origin.message.sender,
|
|
430
|
-
"conversation": work.origin.message.conversation,
|
|
431
|
-
}
|
|
432
|
-
if work.origin
|
|
433
|
-
else {}
|
|
434
|
-
),
|
|
435
|
-
},
|
|
436
|
-
)
|
|
437
|
-
replies = (
|
|
438
|
-
[
|
|
439
|
-
Outgoing(
|
|
440
|
-
id=digest(f"{key}:{route.channel}:{route.conversation}".encode())[:32],
|
|
441
|
-
text=reply,
|
|
442
|
-
conversation=route.conversation,
|
|
443
|
-
reply_to=route.reply_to,
|
|
444
|
-
)
|
|
445
|
-
for route in work.routes
|
|
446
|
-
]
|
|
447
|
-
if reply.strip()
|
|
448
|
-
else []
|
|
449
|
-
)
|
|
460
|
+
record, replies = _recorded(work, reply, wake, metadata)
|
|
450
461
|
queue.prepare(work, record, replies, wake)
|
|
451
462
|
row = queue.get(key)
|
|
452
463
|
saved = Prepared.model_validate_json(str(row["prepared"]))
|
|
@@ -553,16 +564,18 @@ def deliver(
|
|
|
553
564
|
receipt = channels.send(store, name, command, message, runner=runner)
|
|
554
565
|
queue.delivered(key, name, message, receipt)
|
|
555
566
|
except (Error, OSError, UnicodeError) as error:
|
|
556
|
-
|
|
567
|
+
cause = reason(error, "channel send failed; inspect its local log")
|
|
557
568
|
attempts = int(str(delivery["attempts"])) + 1
|
|
558
|
-
# A send command that never started sent nothing, so it retries like an idempotent one.
|
|
559
|
-
|
|
560
|
-
|
|
569
|
+
# A send command that never started sent nothing, so it retries like an idempotent one. A misrouted
|
|
570
|
+
# send may have posted elsewhere: it waits for inspection even on an idempotent channel.
|
|
571
|
+
outcome, cause, due = retry_policy(
|
|
572
|
+
(command.idempotent and not isinstance(error, channels.MisroutedError))
|
|
573
|
+
or isinstance(error, NotStartedError),
|
|
561
574
|
delivery["job"] is not None,
|
|
562
575
|
attempts,
|
|
563
|
-
|
|
576
|
+
cause,
|
|
564
577
|
)
|
|
565
|
-
queue.delivery_failed(key,
|
|
578
|
+
queue.delivery_failed(key, cause, outcome=outcome, due=due)
|
|
566
579
|
except BaseException:
|
|
567
580
|
# Ctrl-C or SIGTERM ends this process: record the send now, not at the next recovery pass.
|
|
568
581
|
with suppress(Error, OSError):
|
|
@@ -636,9 +649,7 @@ def manual(
|
|
|
636
649
|
raise Error("answer saved but delivery is unresolved; inspect bf queue before retrying")
|
|
637
650
|
result["status"] = "ran"
|
|
638
651
|
except (Error, OSError, UnicodeError) as error:
|
|
639
|
-
result.update(
|
|
640
|
-
status="failed", error=str(error) if isinstance(error, Error) else "assistant files are inaccessible"
|
|
641
|
-
)
|
|
652
|
+
result.update(status="failed", error=reason(error, "assistant files are inaccessible"))
|
|
642
653
|
return {"ok": result["status"] == "ran", "dry_run": dry_run, "assistants": [result]}
|
|
643
654
|
|
|
644
655
|
|
|
@@ -707,7 +718,7 @@ def schedule(
|
|
|
707
718
|
"assistant": name,
|
|
708
719
|
"schedule": slot.removeprefix("schedule:"),
|
|
709
720
|
"status": "failed",
|
|
710
|
-
"error":
|
|
721
|
+
"error": reason(error, "assistant files are inaccessible"),
|
|
711
722
|
}
|
|
712
723
|
)
|
|
713
724
|
return keys, failures
|
|
@@ -828,7 +839,12 @@ def _cycle(store: Store, names: set[str], at: datetime, runner: Runner) -> list[
|
|
|
828
839
|
)
|
|
829
840
|
except (Error, OSError, UnicodeError, ValueError) as error:
|
|
830
841
|
results.append(
|
|
831
|
-
{
|
|
842
|
+
{
|
|
843
|
+
"assistant": queue.get(key)["assistant"],
|
|
844
|
+
"job": key,
|
|
845
|
+
"status": "failed",
|
|
846
|
+
"error": reason(error, "assistant files are inaccessible"),
|
|
847
|
+
}
|
|
832
848
|
)
|
|
833
849
|
failed: set[str] = set()
|
|
834
850
|
while (delivery := queue.delivery(names=names, skip=tried)) is not None:
|
|
@@ -841,7 +857,12 @@ def _cycle(store: Store, names: set[str], at: datetime, runner: Runner) -> list[
|
|
|
841
857
|
except (Error, OSError, UnicodeError, ValueError) as error:
|
|
842
858
|
failed.add(key)
|
|
843
859
|
results.append(
|
|
844
|
-
{
|
|
860
|
+
{
|
|
861
|
+
"assistant": delivery["assistant"],
|
|
862
|
+
"delivery": key,
|
|
863
|
+
"status": "failed",
|
|
864
|
+
"error": reason(error, "assistant files are inaccessible"),
|
|
865
|
+
}
|
|
845
866
|
)
|
|
846
867
|
results.extend(
|
|
847
868
|
{
|
|
@@ -893,8 +914,8 @@ def cycle(
|
|
|
893
914
|
]
|
|
894
915
|
return _cycle(store, names, at, runner)
|
|
895
916
|
except (Error, OSError, UnicodeError, ValueError) as error:
|
|
896
|
-
|
|
897
|
-
return [{"assistant": name, "status": "failed", "error":
|
|
917
|
+
cause = reason(error, "the assistant queue or brain files are inaccessible")
|
|
918
|
+
return [{"assistant": name, "status": "failed", "error": cause} for name in sorted(names)]
|
|
898
919
|
|
|
899
920
|
|
|
900
921
|
class Dispatcher:
|
|
@@ -1028,9 +1049,9 @@ class Dispatcher:
|
|
|
1028
1049
|
connected=connected,
|
|
1029
1050
|
)
|
|
1030
1051
|
except (Error, OSError, UnicodeError) as error:
|
|
1031
|
-
|
|
1052
|
+
cause = reason(error, "stream transport failed; inspect its local log")
|
|
1032
1053
|
with suppress(Error, OSError):
|
|
1033
|
-
self.queue.set_progress(f"health:channel:{channel}", {"error":
|
|
1054
|
+
self.queue.set_progress(f"health:channel:{channel}", {"error": cause, "at": now()})
|
|
1034
1055
|
if self.stopped.wait(delay):
|
|
1035
1056
|
break
|
|
1036
1057
|
delay = min(delay * 2, 60)
|
|
@@ -1061,7 +1082,7 @@ class Dispatcher:
|
|
|
1061
1082
|
config = load(self.store)
|
|
1062
1083
|
except (Error, OSError, UnicodeError) as error:
|
|
1063
1084
|
# Running work continues; nothing new starts until bf.yaml loads again.
|
|
1064
|
-
self._record("dispatcher",
|
|
1085
|
+
self._record("dispatcher", reason(error, "bf.yaml is inaccessible"))
|
|
1065
1086
|
return
|
|
1066
1087
|
errors = []
|
|
1067
1088
|
# Each section fails on its own: a full queue refusing a schedule never keeps queued work from draining.
|
|
@@ -1069,7 +1090,7 @@ class Dispatcher:
|
|
|
1069
1090
|
try:
|
|
1070
1091
|
section()
|
|
1071
1092
|
except (Error, OSError, UnicodeError, ValueError) as error:
|
|
1072
|
-
errors.append(
|
|
1093
|
+
errors.append(reason(error, "assistant queue inaccessible"))
|
|
1073
1094
|
self._record("dispatcher", "; ".join(errors))
|
|
1074
1095
|
|
|
1075
1096
|
def _harvest(self) -> None:
|
|
@@ -1094,7 +1115,7 @@ class Dispatcher:
|
|
|
1094
1115
|
# Worded as bf update words it, so bf status reads the same whichever ran the poll.
|
|
1095
1116
|
self._record(name, read_failure(name.split(":")[2], error))
|
|
1096
1117
|
else:
|
|
1097
|
-
self._record(name,
|
|
1118
|
+
self._record(name, reason(error, "runtime worker failed"))
|
|
1098
1119
|
|
|
1099
1120
|
def _jobs(self) -> None:
|
|
1100
1121
|
waiting = self._waiting()
|