agent-core-briefs 0.9.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.
- agent_core_briefs-0.9.0/.gitignore +248 -0
- agent_core_briefs-0.9.0/CHANGELOG.md +32 -0
- agent_core_briefs-0.9.0/PKG-INFO +12 -0
- agent_core_briefs-0.9.0/VERSION +1 -0
- agent_core_briefs-0.9.0/pyproject.toml +33 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/__init__.py +21 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/audit.py +91 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/cli.py +388 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/config.py +63 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/destinations/__init__.py +6 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/destinations/discord_embed.py +196 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/destinations/markdown_file.py +191 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/engine.py +126 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/fetchers/__init__.py +0 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/fetchers/cli.py +91 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/fetchers/filesystem_read.py +58 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/fetchers/now.py +95 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/loader.py +105 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/mcp.py +363 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/orchestrator.py +673 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/playbook.py +360 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/plugin.py +164 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/protocol.py +132 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/session.py +210 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/skills/briefs-author/SKILL.md +237 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/submit.py +362 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/tools.py +367 -0
- agent_core_briefs-0.9.0/src/agent_core_briefs/validators.py +210 -0
- agent_core_briefs-0.9.0/tests/fixtures/fake_calendar.py +47 -0
- agent_core_briefs-0.9.0/tests/fixtures/gather/morning-test.yaml +12 -0
- agent_core_briefs-0.9.0/tests/fixtures/playbooks/morning-orchestrator.md +83 -0
- agent_core_briefs-0.9.0/tests/fixtures/playbooks/morning-test.md +84 -0
- agent_core_briefs-0.9.0/tests/test_audit.py +137 -0
- agent_core_briefs-0.9.0/tests/test_briefs_cli.py +481 -0
- agent_core_briefs-0.9.0/tests/test_config.py +108 -0
- agent_core_briefs-0.9.0/tests/test_destination_discord.py +342 -0
- agent_core_briefs-0.9.0/tests/test_destination_markdown_file.py +402 -0
- agent_core_briefs-0.9.0/tests/test_e2e_morning_brief.py +553 -0
- agent_core_briefs-0.9.0/tests/test_examples_morning_brief.py +235 -0
- agent_core_briefs-0.9.0/tests/test_fetcher_cli.py +132 -0
- agent_core_briefs-0.9.0/tests/test_fetcher_filesystem_read.py +109 -0
- agent_core_briefs-0.9.0/tests/test_fetcher_now.py +137 -0
- agent_core_briefs-0.9.0/tests/test_gather.py +154 -0
- agent_core_briefs-0.9.0/tests/test_loader.py +96 -0
- agent_core_briefs-0.9.0/tests/test_mcp.py +520 -0
- agent_core_briefs-0.9.0/tests/test_mcp_wiring.py +252 -0
- agent_core_briefs-0.9.0/tests/test_orchestrator.py +826 -0
- agent_core_briefs-0.9.0/tests/test_playbook.py +153 -0
- agent_core_briefs-0.9.0/tests/test_protocols.py +153 -0
- agent_core_briefs-0.9.0/tests/test_session.py +212 -0
- agent_core_briefs-0.9.0/tests/test_submit.py +605 -0
- agent_core_briefs-0.9.0/tests/test_tools.py +631 -0
- agent_core_briefs-0.9.0/tests/test_validators.py +290 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# Memory compiler runtime state
|
|
2
|
+
memory-compiler/daily/
|
|
3
|
+
memory-compiler/reports/
|
|
4
|
+
memory-compiler/scripts/state.json
|
|
5
|
+
memory-compiler/scripts/last-flush.json
|
|
6
|
+
memory-compiler/scripts/flush.log
|
|
7
|
+
memory-compiler/scripts/compile.log
|
|
8
|
+
memory-compiler/scripts/session-flush-*.md
|
|
9
|
+
memory-compiler/scripts/flush-context-*.md
|
|
10
|
+
|
|
11
|
+
# Handoff writer state (placed alongside handoff files)
|
|
12
|
+
**/handoff-state.json
|
|
13
|
+
|
|
14
|
+
# Git worktrees (superpowers / parallel feature work)
|
|
15
|
+
.worktrees/
|
|
16
|
+
# Native (harness) worktrees
|
|
17
|
+
.claude/worktrees/
|
|
18
|
+
|
|
19
|
+
# Superpowers brainstorm mockups / scratch
|
|
20
|
+
.superpowers/
|
|
21
|
+
|
|
22
|
+
# Agent-core runtime state (handoffs, bus.sqlite, transcripts, etc.)
|
|
23
|
+
.agent-core/
|
|
24
|
+
|
|
25
|
+
# Local scratch / smoke-test artifacts
|
|
26
|
+
.tmp/
|
|
27
|
+
|
|
28
|
+
# Claude Code per-machine local overrides
|
|
29
|
+
.claude/settings.local.json
|
|
30
|
+
.claude/*.lock
|
|
31
|
+
|
|
32
|
+
# Byte-compiled / optimized / DLL files
|
|
33
|
+
__pycache__/
|
|
34
|
+
*.py[codz]
|
|
35
|
+
*$py.class
|
|
36
|
+
|
|
37
|
+
# C extensions
|
|
38
|
+
*.so
|
|
39
|
+
|
|
40
|
+
# Distribution / packaging
|
|
41
|
+
.Python
|
|
42
|
+
build/
|
|
43
|
+
develop-eggs/
|
|
44
|
+
dist/
|
|
45
|
+
downloads/
|
|
46
|
+
eggs/
|
|
47
|
+
.eggs/
|
|
48
|
+
lib/
|
|
49
|
+
lib64/
|
|
50
|
+
parts/
|
|
51
|
+
sdist/
|
|
52
|
+
var/
|
|
53
|
+
wheels/
|
|
54
|
+
share/python-wheels/
|
|
55
|
+
*.egg-info/
|
|
56
|
+
.installed.cfg
|
|
57
|
+
*.egg
|
|
58
|
+
MANIFEST
|
|
59
|
+
|
|
60
|
+
# PyInstaller
|
|
61
|
+
# Usually these files are written by a python script from a template
|
|
62
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
63
|
+
*.manifest
|
|
64
|
+
*.spec
|
|
65
|
+
|
|
66
|
+
# Installer logs
|
|
67
|
+
pip-log.txt
|
|
68
|
+
pip-delete-this-directory.txt
|
|
69
|
+
|
|
70
|
+
# Unit test / coverage reports
|
|
71
|
+
htmlcov/
|
|
72
|
+
.tox/
|
|
73
|
+
.nox/
|
|
74
|
+
.coverage
|
|
75
|
+
.coverage.*
|
|
76
|
+
.cache
|
|
77
|
+
nosetests.xml
|
|
78
|
+
coverage.xml
|
|
79
|
+
*.cover
|
|
80
|
+
*.py.cover
|
|
81
|
+
.hypothesis/
|
|
82
|
+
.pytest_cache/
|
|
83
|
+
cover/
|
|
84
|
+
|
|
85
|
+
# Translations
|
|
86
|
+
*.mo
|
|
87
|
+
*.pot
|
|
88
|
+
|
|
89
|
+
# Django stuff:
|
|
90
|
+
*.log
|
|
91
|
+
local_settings.py
|
|
92
|
+
db.sqlite3
|
|
93
|
+
db.sqlite3-journal
|
|
94
|
+
|
|
95
|
+
# Flask stuff:
|
|
96
|
+
instance/
|
|
97
|
+
.webassets-cache
|
|
98
|
+
|
|
99
|
+
# Scrapy stuff:
|
|
100
|
+
.scrapy
|
|
101
|
+
|
|
102
|
+
# Sphinx documentation
|
|
103
|
+
docs/_build/
|
|
104
|
+
|
|
105
|
+
# PyBuilder
|
|
106
|
+
.pybuilder/
|
|
107
|
+
target/
|
|
108
|
+
|
|
109
|
+
# Jupyter Notebook
|
|
110
|
+
.ipynb_checkpoints
|
|
111
|
+
|
|
112
|
+
# IPython
|
|
113
|
+
profile_default/
|
|
114
|
+
ipython_config.py
|
|
115
|
+
|
|
116
|
+
# pyenv
|
|
117
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
118
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
119
|
+
# .python-version
|
|
120
|
+
|
|
121
|
+
# pipenv
|
|
122
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
123
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
124
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
125
|
+
# install all needed dependencies.
|
|
126
|
+
#Pipfile.lock
|
|
127
|
+
|
|
128
|
+
# UV
|
|
129
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
130
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
131
|
+
# commonly ignored for libraries.
|
|
132
|
+
#uv.lock
|
|
133
|
+
|
|
134
|
+
# poetry
|
|
135
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
136
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
137
|
+
# commonly ignored for libraries.
|
|
138
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
139
|
+
#poetry.lock
|
|
140
|
+
#poetry.toml
|
|
141
|
+
|
|
142
|
+
# pdm
|
|
143
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
144
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
145
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
146
|
+
#pdm.lock
|
|
147
|
+
#pdm.toml
|
|
148
|
+
.pdm-python
|
|
149
|
+
.pdm-build/
|
|
150
|
+
|
|
151
|
+
# pixi
|
|
152
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
153
|
+
#pixi.lock
|
|
154
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
155
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
156
|
+
.pixi
|
|
157
|
+
|
|
158
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
159
|
+
__pypackages__/
|
|
160
|
+
|
|
161
|
+
# Celery stuff
|
|
162
|
+
celerybeat-schedule
|
|
163
|
+
celerybeat.pid
|
|
164
|
+
|
|
165
|
+
# SageMath parsed files
|
|
166
|
+
*.sage.py
|
|
167
|
+
|
|
168
|
+
# Environments
|
|
169
|
+
.env
|
|
170
|
+
.envrc
|
|
171
|
+
.venv
|
|
172
|
+
env/
|
|
173
|
+
venv/
|
|
174
|
+
ENV/
|
|
175
|
+
env.bak/
|
|
176
|
+
venv.bak/
|
|
177
|
+
# ...but agent_core.venv is a SOURCE package, not a virtualenv — don't ignore it.
|
|
178
|
+
!packages/core/src/agent_core/venv/
|
|
179
|
+
!packages/core/src/agent_core/venv/**
|
|
180
|
+
|
|
181
|
+
# Spyder project settings
|
|
182
|
+
.spyderproject
|
|
183
|
+
.spyproject
|
|
184
|
+
|
|
185
|
+
# Rope project settings
|
|
186
|
+
.ropeproject
|
|
187
|
+
|
|
188
|
+
# mkdocs documentation
|
|
189
|
+
/site
|
|
190
|
+
|
|
191
|
+
# mypy
|
|
192
|
+
.mypy_cache/
|
|
193
|
+
.dmypy.json
|
|
194
|
+
dmypy.json
|
|
195
|
+
|
|
196
|
+
# Pyre type checker
|
|
197
|
+
.pyre/
|
|
198
|
+
|
|
199
|
+
# pytype static type analyzer
|
|
200
|
+
.pytype/
|
|
201
|
+
|
|
202
|
+
# Cython debug symbols
|
|
203
|
+
cython_debug/
|
|
204
|
+
|
|
205
|
+
# PyCharm
|
|
206
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
207
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
208
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
209
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
210
|
+
#.idea/
|
|
211
|
+
|
|
212
|
+
# Abstra
|
|
213
|
+
# Abstra is an AI-powered process automation framework.
|
|
214
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
215
|
+
# Learn more at https://abstra.io/docs
|
|
216
|
+
.abstra/
|
|
217
|
+
|
|
218
|
+
# Visual Studio Code
|
|
219
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
220
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
221
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
222
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
223
|
+
# .vscode/
|
|
224
|
+
|
|
225
|
+
# Ruff stuff:
|
|
226
|
+
.ruff_cache/
|
|
227
|
+
|
|
228
|
+
# PyPI configuration file
|
|
229
|
+
.pypirc
|
|
230
|
+
|
|
231
|
+
# Cursor
|
|
232
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
233
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
234
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
235
|
+
.cursorignore
|
|
236
|
+
.cursorindexingignore
|
|
237
|
+
|
|
238
|
+
# Marimo
|
|
239
|
+
marimo/_static/
|
|
240
|
+
marimo/_lsp/
|
|
241
|
+
__marimo__/
|
|
242
|
+
.gstack/
|
|
243
|
+
|
|
244
|
+
# macOS Finder metadata (occasionally sneaks in via vendored sources)
|
|
245
|
+
.DS_Store
|
|
246
|
+
|
|
247
|
+
# Operational docs that must not live in source control
|
|
248
|
+
pepper-vault-plan.txt
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.9.0](https://github.com/jeffrichley/agent_core/compare/v0.8.2...agent-core-briefs-v0.9.0) (2026-08-03)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **mypy:** enable --strict for briefs, busproxy, inbound, voice, webcam, qa ([#532](https://github.com/jeffrichley/agent_core/issues/532)) ([9663d87](https://github.com/jeffrichley/agent_core/commit/9663d8783176116a7ae352b2ba07933bf056fbe7))
|
|
9
|
+
|
|
10
|
+
## [0.8.2](https://github.com/jeffrichley/agent_core/compare/v0.8.1...agent-core-briefs-v0.8.2) (2026-07-22)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* republish package family to complete rate-limited first publish ([#477](https://github.com/jeffrichley/agent_core/issues/477)) ([32977ac](https://github.com/jeffrichley/agent_core/commit/32977ac78da4a15553329bb4e1fdaa9e894834ad))
|
|
16
|
+
|
|
17
|
+
## [0.8.1](https://github.com/jeffrichley/agent_core/compare/v0.8.0...agent-core-briefs-v0.8.1) (2026-07-22)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* rename flagship dist to agent-core-bus + bump inter-package pins to 0.8.x ([#474](https://github.com/jeffrichley/agent_core/issues/474)) ([48426e7](https://github.com/jeffrichley/agent_core/commit/48426e7ff753d8f35d4a4626308546e9d0f331f7))
|
|
23
|
+
|
|
24
|
+
## [0.8.0](https://github.com/jeffrichley/agent_core/compare/v0.7.0...agent-core-briefs-v0.8.0) (2026-07-21)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* **core:** hoist JsonlAuditLog base into core, subclass in briefs/voice/webcam ([#465](https://github.com/jeffrichley/agent_core/issues/465)) ([2c7843a](https://github.com/jeffrichley/agent_core/commit/2c7843afd278ed5732388ebb6a3b8350f4f14810))
|
|
30
|
+
* **deps:** version-pin sibling deps and remove qwen-tts from voice ([#430](https://github.com/jeffrichley/agent_core/issues/430)) ([3b173ee](https://github.com/jeffrichley/agent_core/commit/3b173eebd24fb8eab995785a9e154a0dda870f19))
|
|
31
|
+
* **hatchery:** ungendered templates + .mcp.json generation ([#81](https://github.com/jeffrichley/agent_core/issues/81)/[#82](https://github.com/jeffrichley/agent_core/issues/82)) ([#357](https://github.com/jeffrichley/agent_core/issues/357)) ([f48762d](https://github.com/jeffrichley/agent_core/commit/f48762df78eb12cfa9524e9b5a277741534ea8a7)), closes [#311](https://github.com/jeffrichley/agent_core/issues/311)
|
|
32
|
+
* **release:** configure release-please for 12-package synchronized version train ([#428](https://github.com/jeffrichley/agent_core/issues/428)) ([c1b4097](https://github.com/jeffrichley/agent_core/commit/c1b409765c61d09a6657b0e8b5e43a27cb235b3e))
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-core-briefs
|
|
3
|
+
Version: 0.9.0
|
|
4
|
+
Summary: Brief framework — structured-composition pattern for agent_core
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Requires-Python: >=3.12
|
|
7
|
+
Requires-Dist: agent-core-bus<0.9,>=0.8
|
|
8
|
+
Requires-Dist: pluggy>=1.6
|
|
9
|
+
Requires-Dist: pydantic>=2.7
|
|
10
|
+
Requires-Dist: pyyaml>=6.0
|
|
11
|
+
Requires-Dist: simpleeval>=1.0
|
|
12
|
+
Requires-Dist: typer>=0.12
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.9.0
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "agent-core-briefs"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
description = "Brief framework — structured-composition pattern for agent_core"
|
|
5
|
+
license = "MIT"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"agent-core-bus>=0.8,<0.9",
|
|
9
|
+
"pluggy>=1.6",
|
|
10
|
+
"pydantic>=2.7",
|
|
11
|
+
"pyyaml>=6.0",
|
|
12
|
+
"simpleeval>=1.0",
|
|
13
|
+
"typer>=0.12",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[project.entry-points."agent_core"]
|
|
17
|
+
briefs_aliases = "agent_core_briefs.plugin"
|
|
18
|
+
|
|
19
|
+
[build-system]
|
|
20
|
+
requires = ["hatchling", "uv-dynamic-versioning"]
|
|
21
|
+
build-backend = "hatchling.build"
|
|
22
|
+
|
|
23
|
+
[tool.hatch.build.targets.wheel]
|
|
24
|
+
packages = ["src/agent_core_briefs"]
|
|
25
|
+
|
|
26
|
+
[tool.hatch.version]
|
|
27
|
+
source = "uv-dynamic-versioning"
|
|
28
|
+
|
|
29
|
+
[tool.uv-dynamic-versioning]
|
|
30
|
+
fallback-version = "0.0.0"
|
|
31
|
+
|
|
32
|
+
[tool.uv]
|
|
33
|
+
cache-keys = [{ file = "pyproject.toml" }, { git = { commit = true, tags = true } }]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Brief framework — structured composition for agent_core."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from agent_core_briefs.protocol import (
|
|
6
|
+
DeliveryResult,
|
|
7
|
+
Destination,
|
|
8
|
+
Fetcher,
|
|
9
|
+
FieldSpec,
|
|
10
|
+
PlaybookRef,
|
|
11
|
+
SectionSpec,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"DeliveryResult",
|
|
16
|
+
"Destination",
|
|
17
|
+
"Fetcher",
|
|
18
|
+
"FieldSpec",
|
|
19
|
+
"PlaybookRef",
|
|
20
|
+
"SectionSpec",
|
|
21
|
+
]
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"""Append-only JSONL audit log for brief submissions.
|
|
2
|
+
|
|
3
|
+
The submit handler (T13) writes one or more events per ``submit_brief``
|
|
4
|
+
call:
|
|
5
|
+
|
|
6
|
+
- ``submit.validate.fail`` — validation rejected the submission. The
|
|
7
|
+
``data`` payload carries the issue list; no delivery was attempted
|
|
8
|
+
and the session token is NOT consumed (the agent can retry).
|
|
9
|
+
- ``submit.deliver`` — one destination's delivery outcome (success or
|
|
10
|
+
failure). Carries ``destination_type``, ``success``, ``ref``,
|
|
11
|
+
``error``.
|
|
12
|
+
- ``submit.complete`` — end-of-flow summary. Carries totals and an
|
|
13
|
+
``overall_success`` flag (true iff at least one destination
|
|
14
|
+
succeeded).
|
|
15
|
+
|
|
16
|
+
Format
|
|
17
|
+
------
|
|
18
|
+
Each event is one JSON line. ``timestamp`` is serialized as an ISO
|
|
19
|
+
8601 string. ``session_token`` is truncated to 8 chars (``first8``)
|
|
20
|
+
for both privacy and readability — the full 32-char token is the
|
|
21
|
+
agent's secret to hold and shouldn't show up in shared log files.
|
|
22
|
+
|
|
23
|
+
Default location is ``~/.agent-core/briefs/audit.jsonl``; parent
|
|
24
|
+
directories are created if missing on first write.
|
|
25
|
+
|
|
26
|
+
Async I/O
|
|
27
|
+
---------
|
|
28
|
+
Writes go through :func:`asyncio.to_thread` to honor T4's cancellation
|
|
29
|
+
contract — same pattern as
|
|
30
|
+
:class:`agent_core_briefs.destinations.markdown_file.MarkdownFileDestination`.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
from __future__ import annotations
|
|
34
|
+
|
|
35
|
+
import json
|
|
36
|
+
from dataclasses import dataclass
|
|
37
|
+
from datetime import datetime
|
|
38
|
+
from pathlib import Path
|
|
39
|
+
from typing import Any
|
|
40
|
+
|
|
41
|
+
from agent_core.audit import JsonlAuditLog
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass(frozen=True)
|
|
45
|
+
class AuditEvent:
|
|
46
|
+
"""One line in the briefs audit log.
|
|
47
|
+
|
|
48
|
+
``session_token`` should already be truncated to 8 chars by the
|
|
49
|
+
submit handler before construction — :meth:`AuditLog.write` does
|
|
50
|
+
NOT re-truncate, so a caller that passes the full token would
|
|
51
|
+
leak it into the log.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
timestamp: datetime
|
|
55
|
+
event_type: str
|
|
56
|
+
session_token: str
|
|
57
|
+
brief_type: str
|
|
58
|
+
target_agent: str
|
|
59
|
+
data: dict[str, Any]
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class AuditLog(JsonlAuditLog[AuditEvent]):
|
|
63
|
+
"""Append-only JSONL audit log.
|
|
64
|
+
|
|
65
|
+
Construction takes a path; :meth:`write` appends one JSON line per
|
|
66
|
+
event. Failures (disk full, permission denied) are logged to
|
|
67
|
+
stderr via the module logger and swallowed — the audit log is
|
|
68
|
+
observability, not the critical path of brief delivery.
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
def __init__(self, path: Path) -> None:
|
|
72
|
+
super().__init__(path)
|
|
73
|
+
|
|
74
|
+
@staticmethod
|
|
75
|
+
def default_path() -> Path:
|
|
76
|
+
"""Returns ``~/.agent-core/briefs/audit.jsonl``."""
|
|
77
|
+
return Path.home() / ".agent-core" / "briefs" / "audit.jsonl"
|
|
78
|
+
|
|
79
|
+
def _serialize(self, event: AuditEvent) -> str:
|
|
80
|
+
payload = {
|
|
81
|
+
"timestamp": event.timestamp.isoformat(),
|
|
82
|
+
"event_type": event.event_type,
|
|
83
|
+
"session_token": event.session_token,
|
|
84
|
+
"brief_type": event.brief_type,
|
|
85
|
+
"target_agent": event.target_agent,
|
|
86
|
+
"data": event.data,
|
|
87
|
+
}
|
|
88
|
+
return json.dumps(payload, default=str, ensure_ascii=False)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
__all__ = ["AuditEvent", "AuditLog"]
|