annals#
annals: an in-tray for AI agents. Publish documents and media to a private page; get a link.
Agents call annals.tools.publish() (or annals publish file.md from a shell) and hand
the printed URL to their human, who opens it on a phone. The documents are plain files in a
directory, local or on another machine over ssh; annals.api.mk_app() serves that
directory as a private page with search, sort, groups and a recycle bin.
Functions
|
Write the publisher config (where to publish, what link to print) and show it. |
|
Make a group (one URL for a set of documents) from existing document ids. |
|
List groups, newest first. |
|
Resolve settings: arguments, then env, then the config file, then local defaults. |
|
List documents (newest first), optionally filtered by words or showing the bin. |
|
|
|
Publish one document and print its link; several paths become several documents. |
|
Bring documents back from the recycle bin. |
|
A document's metadata and link. |
|
Move documents to the recycle bin (restorable). |
Classes
|
Publish, list, read, trash, restore and group documents on a |
|
A directory on this machine. |
|
Where to publish and what link to print. |
|
|
- class annals.DocStore(target)[source]#
Bases:
objectPublish, list, read, trash, restore and group documents on a
Target.- add_to_group(gid, doc_ids)[source]#
Append ids to an existing group, keeping order and skipping duplicates.
- Return type:
- list(*, trash=False)[source]#
Every document’s meta, newest first (ids sort by time;
createdbreaks ties).
- make_group(title, doc_ids, *, gid=None)[source]#
Create (or overwrite) a group: a titled, ordered list of document ids.
- Return type:
- meta(doc_id)[source]#
One document’s meta;
in_trashsays which side of the bin it is on.- Return type:
- publish(*sources, title=None, tags=(), source=None, text=None, filename='document.md', exclude=('.*', '__pycache__', '*.pyc', '*.pyo'))[source]#
Publish files (or a directory, or
text) as ONE document; return its meta.One markdown or html file is the common case. A directory is published whole, with
index.html(or the first renderable file) as the page shown.textpublishes a string asfilenameinstead of reading sources.excludelists glob patterns skipped inside a directory (hidden files and caches by default;()keeps all).- Return type:
- read_text(doc_id, rel=None)[source]#
A document’s main file (or one of its files) as text.
- Return type:
- class annals.Settings(target, base_url, configured=True)[source]#
Bases:
objectWhere to publish and what link to print. See the module docstring for precedence.
- class annals.SshTarget(host, root)[source]#
Bases:
objecthost:pathon another machine, via the system ssh and rsync in batch mode.
- annals.configure(*, target=None, base_url=None)[source]#
Write the publisher config (where to publish, what link to print) and show it.
- Return type:
Example
annals configure --target tw:/root/.local/share/annals --base-url https://apps.example.com/annals. With no arguments, shows the resolved settings without writing.
- annals.group(title, doc_ids, *, target=None, base_url=None)[source]#
Make a group (one URL for a set of documents) from existing document ids.
- Return type:
- annals.load_settings(*, target=None, base_url=None, config_path=None)[source]#
Resolve settings: arguments, then env, then the config file, then local defaults.
- Return type:
- annals.ls(q='', *, trash=False, limit=50, target=None, base_url=None)[source]#
List documents (newest first), optionally filtered by words or showing the bin.
- Return type:
- annals.parse_target(spec)[source]#
host:/pathbecomes anSshTarget; anything else aLocalTarget.- Return type:
- annals.publish(paths, *, title=None, tags='', group=None, add_to=None, session=None, all_files=False, target=None, base_url=None)[source]#
Publish one document and print its link; several paths become several documents.
paths: files of any kind (markdown, html, images, video, audio, pdf, text), a directory (one document: anindex.htmlor single page with its assets, else a gallery of everything in it), or-for stdin (markdown).tagsis comma separated.groupnames a group to create from the published documents; the reply then carriesgroup_urltoo.add_toappends them to an existing group instead (its id, as printed in a group link), so a second batch lands under the link the owner already has.sessionrecords who published (the source shown on the page). A directory skips hidden files and caches (.*,__pycache__,*.pyc) unlessall_files.- Return type:
- annals.restore(doc_ids, *, target=None)[source]#
Bring documents back from the recycle bin.
- Return type:
- annals.show(doc_id, *, target=None, base_url=None)[source]#
A document’s metadata and link.
- Return type:
- annals.trash(doc_ids, *, target=None)[source]#
Move documents to the recycle bin (restorable).
- Return type:
Modules
The auth seam: who may read the annals. |
|
Settings: where documents are published and what link to print. |
|
MCP surface: the same operations as the CLI, from |
|
The document store: a flat set of documents, tags, groups and a recycle bin, as plain files. |
|
The transport seam: a document tree lands in a directory, here or on another machine. |
|
The operations, as plain functions: JSON-able arguments in, JSON-able dicts out. |