eddieland-canopy-artifacts 0.14.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.
- eddieland_canopy_artifacts-0.14.0/.gitignore +243 -0
- eddieland_canopy_artifacts-0.14.0/PKG-INFO +141 -0
- eddieland_canopy_artifacts-0.14.0/README.md +116 -0
- eddieland_canopy_artifacts-0.14.0/pyproject.toml +61 -0
- eddieland_canopy_artifacts-0.14.0/src/canopy_artifacts/__init__.py +8 -0
- eddieland_canopy_artifacts-0.14.0/src/canopy_artifacts/cli.py +238 -0
- eddieland_canopy_artifacts-0.14.0/src/canopy_artifacts/results.py +188 -0
- eddieland_canopy_artifacts-0.14.0/src/canopy_artifacts/server.py +110 -0
- eddieland_canopy_artifacts-0.14.0/src/canopy_artifacts/store.py +798 -0
- eddieland_canopy_artifacts-0.14.0/src/canopy_artifacts/text.py +188 -0
- eddieland_canopy_artifacts-0.14.0/src/canopy_artifacts/tools.py +281 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
# The web UI's own lib/ is source, not a build directory.
|
|
20
|
+
!ui/src/lib/
|
|
21
|
+
parts/
|
|
22
|
+
sdist/
|
|
23
|
+
var/
|
|
24
|
+
wheels/
|
|
25
|
+
share/python-wheels/
|
|
26
|
+
*.egg-info/
|
|
27
|
+
.installed.cfg
|
|
28
|
+
*.egg
|
|
29
|
+
MANIFEST
|
|
30
|
+
|
|
31
|
+
# PyInstaller
|
|
32
|
+
# Usually these files are written by a python script from a template
|
|
33
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
34
|
+
*.manifest
|
|
35
|
+
*.spec
|
|
36
|
+
|
|
37
|
+
# Installer logs
|
|
38
|
+
pip-log.txt
|
|
39
|
+
pip-delete-this-directory.txt
|
|
40
|
+
|
|
41
|
+
# Unit test / coverage reports
|
|
42
|
+
htmlcov/
|
|
43
|
+
.tox/
|
|
44
|
+
.nox/
|
|
45
|
+
.coverage
|
|
46
|
+
.coverage.*
|
|
47
|
+
.cache
|
|
48
|
+
nosetests.xml
|
|
49
|
+
coverage.xml
|
|
50
|
+
*.cover
|
|
51
|
+
*.py.cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
.pytest_cache/
|
|
54
|
+
cover/
|
|
55
|
+
|
|
56
|
+
# Translations
|
|
57
|
+
*.mo
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
# Django stuff:
|
|
61
|
+
*.log
|
|
62
|
+
local_settings.py
|
|
63
|
+
db.sqlite3
|
|
64
|
+
db.sqlite3-journal
|
|
65
|
+
|
|
66
|
+
# Flask stuff:
|
|
67
|
+
instance/
|
|
68
|
+
.webassets-cache
|
|
69
|
+
|
|
70
|
+
# Scrapy stuff:
|
|
71
|
+
.scrapy
|
|
72
|
+
|
|
73
|
+
# Sphinx documentation
|
|
74
|
+
docs/_build/
|
|
75
|
+
|
|
76
|
+
# PyBuilder
|
|
77
|
+
.pybuilder/
|
|
78
|
+
target/
|
|
79
|
+
|
|
80
|
+
# Jupyter Notebook
|
|
81
|
+
.ipynb_checkpoints
|
|
82
|
+
|
|
83
|
+
# IPython
|
|
84
|
+
profile_default/
|
|
85
|
+
ipython_config.py
|
|
86
|
+
|
|
87
|
+
# pyenv
|
|
88
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
89
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
90
|
+
# .python-version
|
|
91
|
+
|
|
92
|
+
# pipenv
|
|
93
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
94
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
95
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
96
|
+
# install all needed dependencies.
|
|
97
|
+
# Pipfile.lock
|
|
98
|
+
|
|
99
|
+
# UV
|
|
100
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
101
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
102
|
+
# commonly ignored for libraries.
|
|
103
|
+
# uv.lock
|
|
104
|
+
|
|
105
|
+
# poetry
|
|
106
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
107
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
108
|
+
# commonly ignored for libraries.
|
|
109
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
110
|
+
# poetry.lock
|
|
111
|
+
# poetry.toml
|
|
112
|
+
|
|
113
|
+
# pdm
|
|
114
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
115
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
116
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
117
|
+
# pdm.lock
|
|
118
|
+
# pdm.toml
|
|
119
|
+
.pdm-python
|
|
120
|
+
.pdm-build/
|
|
121
|
+
|
|
122
|
+
# pixi
|
|
123
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
124
|
+
# pixi.lock
|
|
125
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
126
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
127
|
+
.pixi
|
|
128
|
+
|
|
129
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
130
|
+
__pypackages__/
|
|
131
|
+
|
|
132
|
+
# Celery stuff
|
|
133
|
+
celerybeat-schedule
|
|
134
|
+
celerybeat.pid
|
|
135
|
+
|
|
136
|
+
# Redis
|
|
137
|
+
*.rdb
|
|
138
|
+
*.aof
|
|
139
|
+
*.pid
|
|
140
|
+
|
|
141
|
+
# RabbitMQ
|
|
142
|
+
mnesia/
|
|
143
|
+
rabbitmq/
|
|
144
|
+
rabbitmq-data/
|
|
145
|
+
|
|
146
|
+
# ActiveMQ
|
|
147
|
+
activemq-data/
|
|
148
|
+
|
|
149
|
+
# SageMath parsed files
|
|
150
|
+
*.sage.py
|
|
151
|
+
|
|
152
|
+
# Environments
|
|
153
|
+
.env
|
|
154
|
+
.envrc
|
|
155
|
+
.venv
|
|
156
|
+
env/
|
|
157
|
+
venv/
|
|
158
|
+
ENV/
|
|
159
|
+
env.bak/
|
|
160
|
+
venv.bak/
|
|
161
|
+
|
|
162
|
+
# Spyder project settings
|
|
163
|
+
.spyderproject
|
|
164
|
+
.spyproject
|
|
165
|
+
|
|
166
|
+
# Rope project settings
|
|
167
|
+
.ropeproject
|
|
168
|
+
|
|
169
|
+
# mkdocs documentation
|
|
170
|
+
/site
|
|
171
|
+
|
|
172
|
+
# mypy
|
|
173
|
+
.mypy_cache/
|
|
174
|
+
.dmypy.json
|
|
175
|
+
dmypy.json
|
|
176
|
+
|
|
177
|
+
# Pyre type checker
|
|
178
|
+
.pyre/
|
|
179
|
+
|
|
180
|
+
# pytype static type analyzer
|
|
181
|
+
.pytype/
|
|
182
|
+
|
|
183
|
+
# Cython debug symbols
|
|
184
|
+
cython_debug/
|
|
185
|
+
|
|
186
|
+
# PyCharm
|
|
187
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
188
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
189
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
190
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
191
|
+
# .idea/
|
|
192
|
+
|
|
193
|
+
# Abstra
|
|
194
|
+
# Abstra is an AI-powered process automation framework.
|
|
195
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
196
|
+
# Learn more at https://abstra.io/docs
|
|
197
|
+
.abstra/
|
|
198
|
+
|
|
199
|
+
# Visual Studio Code
|
|
200
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
201
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
202
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
203
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
204
|
+
# .vscode/
|
|
205
|
+
# Temporary file for partial code execution
|
|
206
|
+
tempCodeRunnerFile.py
|
|
207
|
+
|
|
208
|
+
# Ruff stuff:
|
|
209
|
+
.ruff_cache/
|
|
210
|
+
|
|
211
|
+
# PyPI configuration file
|
|
212
|
+
.pypirc
|
|
213
|
+
|
|
214
|
+
# Marimo
|
|
215
|
+
marimo/_static/
|
|
216
|
+
marimo/_lsp/
|
|
217
|
+
__marimo__/
|
|
218
|
+
|
|
219
|
+
# Streamlit
|
|
220
|
+
.streamlit/secrets.toml
|
|
221
|
+
|
|
222
|
+
# Impeccable (.claude/skills/impeccable): its runtime state and per-developer files. Shared artifacts stay tracked:
|
|
223
|
+
# config.json, live/config.json, design.json, surfaces/*.md, critique/*.md. The engine binary downloads to
|
|
224
|
+
# ~/.impeccable/bin, or sits beside the launcher in scripts/bin.
|
|
225
|
+
.claude/skills/impeccable/scripts/bin/
|
|
226
|
+
**/.impeccable/config.local.json
|
|
227
|
+
**/.impeccable/hook.cache.json
|
|
228
|
+
**/.impeccable/hook.pending.json
|
|
229
|
+
**/.impeccable/*.png
|
|
230
|
+
**/.impeccable/review/
|
|
231
|
+
**/.impeccable/questions/
|
|
232
|
+
**/.impeccable/history/
|
|
233
|
+
**/.impeccable/live/server.json
|
|
234
|
+
**/.impeccable/live/sessions/
|
|
235
|
+
**/.impeccable/live/previews/
|
|
236
|
+
**/.impeccable/live/annotations/
|
|
237
|
+
**/.impeccable/live/cache/
|
|
238
|
+
**/.impeccable/live/manual-edit-apply-transaction.json
|
|
239
|
+
**/.impeccable/live/manual-edit-events.jsonl
|
|
240
|
+
**/.impeccable/live/manual-edit-evidence/
|
|
241
|
+
**/.impeccable/live/pending-manual-edits.json
|
|
242
|
+
**/.impeccable/live/deferred-svelte-component-accepts.json
|
|
243
|
+
**/.impeccable/live/*.png
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: eddieland-canopy-artifacts
|
|
3
|
+
Version: 0.14.0
|
|
4
|
+
Summary: canopy's local artifact store: pages workers publish and the comments on them, served over MCP on stdio.
|
|
5
|
+
Project-URL: Homepage, https://github.com/eddieland/canopy
|
|
6
|
+
Project-URL: Repository, https://github.com/eddieland/canopy/tree/main/packages/canopy-artifacts
|
|
7
|
+
Project-URL: Issues, https://github.com/eddieland/canopy/issues
|
|
8
|
+
Author: eddieland
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Keywords: artifacts,canopy,comments,mcp
|
|
11
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: MacOS
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Requires-Dist: click>=8.5.1
|
|
22
|
+
Requires-Dist: eddieland-canopy-mcp==0.14.0
|
|
23
|
+
Requires-Dist: pydantic>=2.14.4
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# canopy-artifacts
|
|
27
|
+
|
|
28
|
+
canopy's local artifact store (DESIGN §38): pages workers publish for people to read, and the comments people leave on
|
|
29
|
+
them, served as MCP tools over stdio. Louvre, the hosted store, serves the same tools over MCP's streamable HTTP behind
|
|
30
|
+
its token, so a skill written for one works against the other. This file is the contract both serve.
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
canopy-artifacts serve --store DIR [--namespace NS] [--agent NAME] [--origin KEY=VALUE ...] [--read-only]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The agent runtime's MCP config starts it, and it serves until stdin closes. It opens no socket. `--store` is a
|
|
37
|
+
directory of the operator's that nobody else can read, made if it is not there: canopy's state directory in use, never
|
|
38
|
+
the journal. A symlink, another owner's directory, or one open to group or others is refused (D053), with exit 2.
|
|
39
|
+
|
|
40
|
+
The options are the scope a Louvre token carries, set by whoever writes the MCP config, never by a tool's caller:
|
|
41
|
+
|
|
42
|
+
- `--namespace` (default `local`): where artifacts are made, and the only namespace a call reads or writes.
|
|
43
|
+
- `--agent` (default `agent`): every comment and resolution written here is the author `agent:NAME`, `kind: agent`,
|
|
44
|
+
on behalf of `operator`. The local store's tools never write as a person: a comment through them is an agent's, as
|
|
45
|
+
one written with a Louvre token is, so it is never authority (§38, D069).
|
|
46
|
+
- `--origin KEY=VALUE`, repeated: pairs set on every artifact made here, over the caller's and the run's.
|
|
47
|
+
- `--read-only`: every write is refused with `read_only`, as a `read` token's are.
|
|
48
|
+
|
|
49
|
+
canopy gives each run whose agent may publish its origin in `CANOPY_ARTIFACT_ORIGIN`, a JSON object of strings:
|
|
50
|
+
`canopy.workspace`, `canopy.ticket`, and `canopy.run`. The server inherits it from the agent before any tool is called,
|
|
51
|
+
and sets its pairs over the caller's, so canopy, not the worker, names the ticket an artifact is for. A value that is not
|
|
52
|
+
such an object is refused with exit 2. A hosted store takes the same pairs as its MCP config passes them on; one that
|
|
53
|
+
does not leaves the ticket the worker's word.
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
canopy-artifacts feed --store DIR [--namespace NS] [--origin KEY=VALUE ...] [--most N]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
canopy's `artifacts` source (DESIGN §30), configured as `[connect.sources.<name>]` with `kind = "artifacts"`. Given
|
|
60
|
+
`{"since": SEQ}` on stdin, it prints the comment feed's changes after SEQ, a JSON object to a line, paging the feed
|
|
61
|
+
until a page is not full or `--most` (default 1,000) are printed, then the last page's `end` line, which names where
|
|
62
|
+
the next run reads from. `--origin` reads only the artifacts whose origin holds the pair. It never writes, as a
|
|
63
|
+
`read` token cannot. A request it cannot read, or a store it cannot open, prints nothing and exits 2.
|
|
64
|
+
|
|
65
|
+
## Records
|
|
66
|
+
|
|
67
|
+
| Record | Fields |
|
|
68
|
+
|---|---|
|
|
69
|
+
| Artifact | `id`, `title`, `namespace`, `origin` (at most 16 string pairs; canopy sets `canopy.workspace`, `canopy.ticket`, `canopy.run`), `latest_version`, `created_at` |
|
|
70
|
+
| Version | `artifact_id`, `n`, `content_type` (`text/html`, `text/markdown`), `sha256`, `text` (the rendered page's visible text, what anchors resolve against), `created_at`; immutable |
|
|
71
|
+
| Thread | `id`, `artifact_id`, `anchor` (null for the whole artifact), `anchored_version`, `state` (`open`, `resolved`) |
|
|
72
|
+
| Comment | `id`, `thread_id`, `seq`, `author`, `body` (at most 4,000 characters), `created_at`, `edited_at`, `deleted_at`, `via` (`web`, `mcp`) |
|
|
73
|
+
| Author | `id` (stable, from the store's sign-in), `display_name`, `kind` (`person`, `agent`), `on_behalf_of` |
|
|
74
|
+
|
|
75
|
+
An artifact's origin is set when it is made, and a new version keeps it; its title is its latest version's. A
|
|
76
|
+
comment's `seq` is that of the latest change to it. Times are ISO 8601, in UTC.
|
|
77
|
+
|
|
78
|
+
## Anchors
|
|
79
|
+
|
|
80
|
+
An anchor is a W3C Web Annotation `TextQuoteSelector` over a version's `text`: `exact`, and `prefix` and `suffix` of at
|
|
81
|
+
most 32 characters, each with its whitespace collapsed, as a plan's comments are. HTML anchors are taken inside the
|
|
82
|
+
sandboxed frame and checked against `text`, never markup.
|
|
83
|
+
|
|
84
|
+
- A version's `text` is what a reader sees, each run of whitespace one space. For HTML it is read from the markup: tags
|
|
85
|
+
are no text, a block's tags part words, and `script`, `style`, `template`, and `title` show nothing. The local store
|
|
86
|
+
takes Markdown's `text` as its source until it renders Markdown.
|
|
87
|
+
- An anchor is found by its words. Where they are more than once, the copy whose `prefix` and `suffix` match best
|
|
88
|
+
wins, and the first of those that tie. Words found nowhere are `passage_gone`, and never move to other words.
|
|
89
|
+
- `comment_create` anchors on the latest version, and refuses words not in it with `anchor_not_found`.
|
|
90
|
+
|
|
91
|
+
## Tools
|
|
92
|
+
|
|
93
|
+
| Tool | Input | Returns | Writes |
|
|
94
|
+
|---|---|---|---|
|
|
95
|
+
| `artifact_publish` | `title`, `content_type`, `content`, `origin`, `artifact_id` (to add a version) | `artifact_id`, `version`, `url` | yes |
|
|
96
|
+
| `artifact_read` | `artifact_id`, `version` | `artifact`, `version`, `content`, `text` | no |
|
|
97
|
+
| `artifact_list` | an `origin` filter, `cursor` | `artifacts`, newest first, and `next_cursor` (null on the last page) | no |
|
|
98
|
+
| `thread_list` | `artifact_id`, `state`, `version` | `threads`, each with its `comments` and its `anchor_status` (`found`, `passage_gone`; null with no anchor) | no |
|
|
99
|
+
| `comment_feed` | an `origin` filter, `since`, `limit` (at most 200) | the changes after `since`, then an `end` line | no |
|
|
100
|
+
| `comment_reply` | `thread_id`, `body` | `comment_id`, `seq` | yes |
|
|
101
|
+
| `comment_create` | `artifact_id`, `anchor`, `body` | `thread_id`, `comment_id`, `seq` | yes |
|
|
102
|
+
| `thread_resolve` | `thread_id`, `resolved` | `state` | yes |
|
|
103
|
+
|
|
104
|
+
A tool's result is one JSON object, or for `comment_feed` one JSON object to a line. The local store also lists each
|
|
105
|
+
tool's result as its output schema, and returns it as structured content too, the same values, with `comment_feed`'s
|
|
106
|
+
as one object, `{"changes": [...], "through": SEQ}`; a client that reads text alone loses nothing. An origin filter
|
|
107
|
+
matches an artifact whose origin holds every pair of it. A version omitted is the latest. The local store's `url`
|
|
108
|
+
names a version, `canopy-artifacts:ID/N`, and opens nothing: it serves no page yet.
|
|
109
|
+
|
|
110
|
+
A refusal is a tool error whose text is `{"code": ..., "message": ...}`, with a code: `not_found`, `out_of_scope`
|
|
111
|
+
(outside the token's namespace), `too_long`, `anchor_not_found`, `read_only`, or `invalid` (arguments the tool cannot
|
|
112
|
+
take, such as a field it does not have, a blank body, or an origin given with `artifact_id`). No tool deletes an
|
|
113
|
+
artifact or shares one.
|
|
114
|
+
|
|
115
|
+
## The comment feed
|
|
116
|
+
|
|
117
|
+
- **The cursor.** `seq` is one sequence across the store, given in commit order to every change (a comment created,
|
|
118
|
+
edited, or deleted; a thread resolved or reopened), and only once the change is visible, so nothing appears below a
|
|
119
|
+
cursor a reader has passed. Resolving a thread already resolved, or reopening one open, is no change. A deleted
|
|
120
|
+
comment keeps its row with its body empty.
|
|
121
|
+
- **Each page** holds at most `limit` changes, oldest first, and ends `{"kind": "end", "through": <seq>}`; a page
|
|
122
|
+
without one is incomplete. `through` is the last change's `seq` when the page is full, and otherwise the store's
|
|
123
|
+
newest, past changes the filter or the namespace left out; the next page reads from it.
|
|
124
|
+
- **A change** carries its `kind`, `seq`, and `at`; the artifact's id and origin; the thread's id, anchor,
|
|
125
|
+
`anchored_version`, state, and `anchor_status` in the artifact's latest version, as `thread_list` gives it; the
|
|
126
|
+
comment's id, body, and times, null for a thread's change; and the `author` and `via` of the change. The comment and
|
|
127
|
+
thread are as they are when read, so a deleted comment's body is empty in every change to it, and a passage reworded
|
|
128
|
+
since reads `passage_gone` in each. Never the artifact's content.
|
|
129
|
+
|
|
130
|
+
## Louvre's tokens
|
|
131
|
+
|
|
132
|
+
The operator mints canopy's token in Louvre, bound to their account and one namespace, with scopes `read`, `publish`,
|
|
133
|
+
and `comment`; the comment source's is `read` only. It lives in an operator-only file the runtime's MCP config reads,
|
|
134
|
+
never in canopy's config, journal, or logs (TRUST_MODEL T2). A comment written with it is `kind: agent`, and canopy
|
|
135
|
+
adds its comment marks (D069) too.
|
|
136
|
+
|
|
137
|
+
## Not in the local store yet
|
|
138
|
+
|
|
139
|
+
The web channel: people's comments (`via: web`, `kind: person`), editing and deleting a comment, and rendering a
|
|
140
|
+
version's HTML, which the web UI will do from a second loopback origin in a sandboxed frame (TRUST_MODEL T8). The schema
|
|
141
|
+
and the feed already hold edits and deletions.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# canopy-artifacts
|
|
2
|
+
|
|
3
|
+
canopy's local artifact store (DESIGN §38): pages workers publish for people to read, and the comments people leave on
|
|
4
|
+
them, served as MCP tools over stdio. Louvre, the hosted store, serves the same tools over MCP's streamable HTTP behind
|
|
5
|
+
its token, so a skill written for one works against the other. This file is the contract both serve.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
canopy-artifacts serve --store DIR [--namespace NS] [--agent NAME] [--origin KEY=VALUE ...] [--read-only]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The agent runtime's MCP config starts it, and it serves until stdin closes. It opens no socket. `--store` is a
|
|
12
|
+
directory of the operator's that nobody else can read, made if it is not there: canopy's state directory in use, never
|
|
13
|
+
the journal. A symlink, another owner's directory, or one open to group or others is refused (D053), with exit 2.
|
|
14
|
+
|
|
15
|
+
The options are the scope a Louvre token carries, set by whoever writes the MCP config, never by a tool's caller:
|
|
16
|
+
|
|
17
|
+
- `--namespace` (default `local`): where artifacts are made, and the only namespace a call reads or writes.
|
|
18
|
+
- `--agent` (default `agent`): every comment and resolution written here is the author `agent:NAME`, `kind: agent`,
|
|
19
|
+
on behalf of `operator`. The local store's tools never write as a person: a comment through them is an agent's, as
|
|
20
|
+
one written with a Louvre token is, so it is never authority (§38, D069).
|
|
21
|
+
- `--origin KEY=VALUE`, repeated: pairs set on every artifact made here, over the caller's and the run's.
|
|
22
|
+
- `--read-only`: every write is refused with `read_only`, as a `read` token's are.
|
|
23
|
+
|
|
24
|
+
canopy gives each run whose agent may publish its origin in `CANOPY_ARTIFACT_ORIGIN`, a JSON object of strings:
|
|
25
|
+
`canopy.workspace`, `canopy.ticket`, and `canopy.run`. The server inherits it from the agent before any tool is called,
|
|
26
|
+
and sets its pairs over the caller's, so canopy, not the worker, names the ticket an artifact is for. A value that is not
|
|
27
|
+
such an object is refused with exit 2. A hosted store takes the same pairs as its MCP config passes them on; one that
|
|
28
|
+
does not leaves the ticket the worker's word.
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
canopy-artifacts feed --store DIR [--namespace NS] [--origin KEY=VALUE ...] [--most N]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
canopy's `artifacts` source (DESIGN §30), configured as `[connect.sources.<name>]` with `kind = "artifacts"`. Given
|
|
35
|
+
`{"since": SEQ}` on stdin, it prints the comment feed's changes after SEQ, a JSON object to a line, paging the feed
|
|
36
|
+
until a page is not full or `--most` (default 1,000) are printed, then the last page's `end` line, which names where
|
|
37
|
+
the next run reads from. `--origin` reads only the artifacts whose origin holds the pair. It never writes, as a
|
|
38
|
+
`read` token cannot. A request it cannot read, or a store it cannot open, prints nothing and exits 2.
|
|
39
|
+
|
|
40
|
+
## Records
|
|
41
|
+
|
|
42
|
+
| Record | Fields |
|
|
43
|
+
|---|---|
|
|
44
|
+
| Artifact | `id`, `title`, `namespace`, `origin` (at most 16 string pairs; canopy sets `canopy.workspace`, `canopy.ticket`, `canopy.run`), `latest_version`, `created_at` |
|
|
45
|
+
| Version | `artifact_id`, `n`, `content_type` (`text/html`, `text/markdown`), `sha256`, `text` (the rendered page's visible text, what anchors resolve against), `created_at`; immutable |
|
|
46
|
+
| Thread | `id`, `artifact_id`, `anchor` (null for the whole artifact), `anchored_version`, `state` (`open`, `resolved`) |
|
|
47
|
+
| Comment | `id`, `thread_id`, `seq`, `author`, `body` (at most 4,000 characters), `created_at`, `edited_at`, `deleted_at`, `via` (`web`, `mcp`) |
|
|
48
|
+
| Author | `id` (stable, from the store's sign-in), `display_name`, `kind` (`person`, `agent`), `on_behalf_of` |
|
|
49
|
+
|
|
50
|
+
An artifact's origin is set when it is made, and a new version keeps it; its title is its latest version's. A
|
|
51
|
+
comment's `seq` is that of the latest change to it. Times are ISO 8601, in UTC.
|
|
52
|
+
|
|
53
|
+
## Anchors
|
|
54
|
+
|
|
55
|
+
An anchor is a W3C Web Annotation `TextQuoteSelector` over a version's `text`: `exact`, and `prefix` and `suffix` of at
|
|
56
|
+
most 32 characters, each with its whitespace collapsed, as a plan's comments are. HTML anchors are taken inside the
|
|
57
|
+
sandboxed frame and checked against `text`, never markup.
|
|
58
|
+
|
|
59
|
+
- A version's `text` is what a reader sees, each run of whitespace one space. For HTML it is read from the markup: tags
|
|
60
|
+
are no text, a block's tags part words, and `script`, `style`, `template`, and `title` show nothing. The local store
|
|
61
|
+
takes Markdown's `text` as its source until it renders Markdown.
|
|
62
|
+
- An anchor is found by its words. Where they are more than once, the copy whose `prefix` and `suffix` match best
|
|
63
|
+
wins, and the first of those that tie. Words found nowhere are `passage_gone`, and never move to other words.
|
|
64
|
+
- `comment_create` anchors on the latest version, and refuses words not in it with `anchor_not_found`.
|
|
65
|
+
|
|
66
|
+
## Tools
|
|
67
|
+
|
|
68
|
+
| Tool | Input | Returns | Writes |
|
|
69
|
+
|---|---|---|---|
|
|
70
|
+
| `artifact_publish` | `title`, `content_type`, `content`, `origin`, `artifact_id` (to add a version) | `artifact_id`, `version`, `url` | yes |
|
|
71
|
+
| `artifact_read` | `artifact_id`, `version` | `artifact`, `version`, `content`, `text` | no |
|
|
72
|
+
| `artifact_list` | an `origin` filter, `cursor` | `artifacts`, newest first, and `next_cursor` (null on the last page) | no |
|
|
73
|
+
| `thread_list` | `artifact_id`, `state`, `version` | `threads`, each with its `comments` and its `anchor_status` (`found`, `passage_gone`; null with no anchor) | no |
|
|
74
|
+
| `comment_feed` | an `origin` filter, `since`, `limit` (at most 200) | the changes after `since`, then an `end` line | no |
|
|
75
|
+
| `comment_reply` | `thread_id`, `body` | `comment_id`, `seq` | yes |
|
|
76
|
+
| `comment_create` | `artifact_id`, `anchor`, `body` | `thread_id`, `comment_id`, `seq` | yes |
|
|
77
|
+
| `thread_resolve` | `thread_id`, `resolved` | `state` | yes |
|
|
78
|
+
|
|
79
|
+
A tool's result is one JSON object, or for `comment_feed` one JSON object to a line. The local store also lists each
|
|
80
|
+
tool's result as its output schema, and returns it as structured content too, the same values, with `comment_feed`'s
|
|
81
|
+
as one object, `{"changes": [...], "through": SEQ}`; a client that reads text alone loses nothing. An origin filter
|
|
82
|
+
matches an artifact whose origin holds every pair of it. A version omitted is the latest. The local store's `url`
|
|
83
|
+
names a version, `canopy-artifacts:ID/N`, and opens nothing: it serves no page yet.
|
|
84
|
+
|
|
85
|
+
A refusal is a tool error whose text is `{"code": ..., "message": ...}`, with a code: `not_found`, `out_of_scope`
|
|
86
|
+
(outside the token's namespace), `too_long`, `anchor_not_found`, `read_only`, or `invalid` (arguments the tool cannot
|
|
87
|
+
take, such as a field it does not have, a blank body, or an origin given with `artifact_id`). No tool deletes an
|
|
88
|
+
artifact or shares one.
|
|
89
|
+
|
|
90
|
+
## The comment feed
|
|
91
|
+
|
|
92
|
+
- **The cursor.** `seq` is one sequence across the store, given in commit order to every change (a comment created,
|
|
93
|
+
edited, or deleted; a thread resolved or reopened), and only once the change is visible, so nothing appears below a
|
|
94
|
+
cursor a reader has passed. Resolving a thread already resolved, or reopening one open, is no change. A deleted
|
|
95
|
+
comment keeps its row with its body empty.
|
|
96
|
+
- **Each page** holds at most `limit` changes, oldest first, and ends `{"kind": "end", "through": <seq>}`; a page
|
|
97
|
+
without one is incomplete. `through` is the last change's `seq` when the page is full, and otherwise the store's
|
|
98
|
+
newest, past changes the filter or the namespace left out; the next page reads from it.
|
|
99
|
+
- **A change** carries its `kind`, `seq`, and `at`; the artifact's id and origin; the thread's id, anchor,
|
|
100
|
+
`anchored_version`, state, and `anchor_status` in the artifact's latest version, as `thread_list` gives it; the
|
|
101
|
+
comment's id, body, and times, null for a thread's change; and the `author` and `via` of the change. The comment and
|
|
102
|
+
thread are as they are when read, so a deleted comment's body is empty in every change to it, and a passage reworded
|
|
103
|
+
since reads `passage_gone` in each. Never the artifact's content.
|
|
104
|
+
|
|
105
|
+
## Louvre's tokens
|
|
106
|
+
|
|
107
|
+
The operator mints canopy's token in Louvre, bound to their account and one namespace, with scopes `read`, `publish`,
|
|
108
|
+
and `comment`; the comment source's is `read` only. It lives in an operator-only file the runtime's MCP config reads,
|
|
109
|
+
never in canopy's config, journal, or logs (TRUST_MODEL T2). A comment written with it is `kind: agent`, and canopy
|
|
110
|
+
adds its comment marks (D069) too.
|
|
111
|
+
|
|
112
|
+
## Not in the local store yet
|
|
113
|
+
|
|
114
|
+
The web channel: people's comments (`via: web`, `kind: person`), editing and deleting a comment, and rendering a
|
|
115
|
+
version's HTML, which the web UI will do from a second loopback origin in a sandboxed frame (TRUST_MODEL T8). The schema
|
|
116
|
+
and the feed already hold edits and deletions.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
# Its name on PyPI, where every package canopy ships takes the same prefix (D046). Its programs and modules keep
|
|
3
|
+
# theirs.
|
|
4
|
+
name = "eddieland-canopy-artifacts"
|
|
5
|
+
# From the latest v* tag, as canopy's is (D085), so every package canopy ships carries its version. Its
|
|
6
|
+
# dependencies are dynamic too, set at the end of this file.
|
|
7
|
+
dynamic = ["version", "dependencies"]
|
|
8
|
+
description = "canopy's local artifact store: pages workers publish and the comments on them, served over MCP on stdio."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
authors = [{ name = "eddieland" }]
|
|
12
|
+
keywords = ["artifacts", "canopy", "comments", "mcp"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
15
|
+
"Environment :: Console",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Operating System :: MacOS",
|
|
18
|
+
"Operating System :: POSIX :: Linux",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Topic :: Software Development",
|
|
23
|
+
]
|
|
24
|
+
requires-python = ">=3.12"
|
|
25
|
+
|
|
26
|
+
[project.scripts]
|
|
27
|
+
canopy-artifacts = "canopy_artifacts.cli:main"
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://github.com/eddieland/canopy"
|
|
31
|
+
Repository = "https://github.com/eddieland/canopy/tree/main/packages/canopy-artifacts"
|
|
32
|
+
Issues = "https://github.com/eddieland/canopy/issues"
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["hatchling", "uv-dynamic-versioning==0.14.1"]
|
|
36
|
+
build-backend = "hatchling.build"
|
|
37
|
+
|
|
38
|
+
[tool.hatch.version]
|
|
39
|
+
source = "uv-dynamic-versioning"
|
|
40
|
+
|
|
41
|
+
# The same scheme as canopy's, in the root pyproject.toml.
|
|
42
|
+
[tool.uv-dynamic-versioning]
|
|
43
|
+
vcs = "git"
|
|
44
|
+
style = "pep440"
|
|
45
|
+
bump = true
|
|
46
|
+
fallback-version = "0.0.0"
|
|
47
|
+
|
|
48
|
+
# The version is built from git, so a new commit or tag rebuilds the metadata, not only a changed pyproject.toml.
|
|
49
|
+
[tool.uv]
|
|
50
|
+
cache-keys = [{ file = "pyproject.toml" }, { git = { commit = true, tags = true } }]
|
|
51
|
+
|
|
52
|
+
[tool.hatch.build.targets.wheel]
|
|
53
|
+
packages = ["src/canopy_artifacts"]
|
|
54
|
+
|
|
55
|
+
# click for its command line (D025), pydantic for its tools' arguments (D026), canopy-mcp for the protocol (D124), and
|
|
56
|
+
# nothing from canopy: canopy names it in its runtime's MCP config and never imports it, so what workers publish stays
|
|
57
|
+
# out of the journal (D041, §38).
|
|
58
|
+
# Set here, not in [project], so that each canopy package it requires is pinned to its own version: a release
|
|
59
|
+
# is built and published as one (D046).
|
|
60
|
+
[tool.hatch.metadata.hooks.uv-dynamic-versioning]
|
|
61
|
+
dependencies = ["eddieland-canopy-mcp=={{ version }}", "click>=8.5.1", "pydantic>=2.14.4"]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""canopy's local artifact store (DESIGN §38): pages workers publish for people to read, and the comments on them.
|
|
2
|
+
|
|
3
|
+
`canopy-artifacts serve` serves the artifacts contract's tools over MCP on stdio, as Louvre serves them over HTTP, so a
|
|
4
|
+
skill written for one works against the other. The contract is this package's README.
|
|
5
|
+
|
|
6
|
+
canopy runs it as a command its runtime's MCP config names, and never imports it (D041). Stdlib, click (D025), and
|
|
7
|
+
pydantic, which validates every tool's arguments (D026), and nothing from canopy.
|
|
8
|
+
"""
|