All plugins

offline-docsets

Lets the agent look up API documentation in docsets on this machine without internet access: the offline format Dash and Zeal use, with an index of every function, class and guide plus the HTML pages (Kapeli's public feeds list about 180, among them Python, Node.js, Bash, SQLite and Vim). docset_list lists the docsets configured under plugins.entries.offline-docsets.settings.paths, docset_search looks entries up by name in Dash's searchIndex or Apple's Core Data index, and docset_read returns a page as plain text starting at the entry's own section, in parts, with in-docset links listed. Standard library only. Not affiliated with Kapeli or Zeal. Disclosure — reads only the docsets you configure, and only pages inside each docset's Documents folder (paths through .., encoded .., absolute paths or symlinks that leave it are refused); opens the SQLite index with mode=ro&immutable=1 so nothing is written, a WAL-mode index's -wal and -shm files included; makes no network calls, needs no credentials and runs no commands. Page text is returned to the model as the documentation's authors wrote it, with scripts and styles stripped.

nftpoetristToolsv0.1.0Updated 5 days ago

About

Lets the agent look up API documentation in docsets on this machine without internet access: the offline format Dash and Zeal use, with an index of every function, class and guide plus the HTML pages (Kapeli's public feeds list about 180, among them Python, Node.js, Bash, SQLite and Vim). docset_list lists the docsets configured under plugins.entries.offline-docsets.settings.paths, docset_search looks entries up by name in Dash's searchIndex or Apple's Core Data index, and docset_read returns a page as plain text starting at the entry's own section, in parts, with in-docset links listed. Standard library only. Not affiliated with Kapeli or Zeal. Disclosure — reads only the docsets you configure, and only pages inside each docset's Documents folder (paths through .., encoded .., absolute paths or symlinks that leave it are refused); opens the SQLite index with mode=ro&immutable=1 so nothing is written, a WAL-mode index's -wal and -shm files included; makes no network calls, needs no credentials and runs no commands. Page text is returned to the model as the documentation's authors wrote it, with scripts and styles stripped.

hermes-offline-docsets

A Hermes Agent plugin that lets the agent look up
API documentation in docsets on your own machine, without internet access. A docset is the
offline documentation format used by Dash and
Zeal: a Name.docset folder holding a SQLite index of every function,
class, method and guide, plus the documentation's HTML pages. Kapeli's public feeds alone list
about 180 of them, among them Python, Node.js, Bash, SQLite, Vim, Go, Ruby and PostgreSQL.

Useful when the agent runs somewhere with no or poor connectivity, when you want answers from the
exact documentation version you have installed, or when you would rather not send every lookup to
a web search provider.

This plugin is not affiliated with Kapeli (Dash) or the Zeal project. It reads the docset format
with Python's standard library only. Both index layouts docsets use are read: Dash's searchIndex
table and Apple's Core Data token tables (which Kapeli's Python docset uses, for example).

Tools

ToolWhat it does
docset_listLists the configured docsets: id, title, family keyword, number of index entries, the most common entry types (Function, Class, Guide, ...) and the start page.
docset_searchSearches the index of one docset or all of them by entry name. Every word of the query must appear in the name. Names that start with the query come first, then shorter names, so the exact name leads. Can be limited to one entry type.
docset_readReads a page as plain text, with headings marked # and list items -. Given a path from docset_search (for example nodejs/api/fs.html#fsreadfilepath-options), the text starts at that entry's section rather than at the top of the page. Long pages come back in parts (next_offset). The first part also lists the page's links to other pages of the same docset.

The tools are offered to the model only while at least one path is configured.

Install

hermes plugins install offline-docsets --enable

No dependencies: the plugin uses only the Python standard library (sqlite3, plistlib,
html.parser).

Get some docsets

If you already use Dash or Zeal, point paths at the folder where it keeps its docsets. Docsets
whose pages are not in an unpacked Contents/Resources/Documents folder are reported as
unavailable (see Limits).

You can also download one yourself. Kapeli publishes a feed per docset at
https://kapeli.com/feeds/<Name>.xml, for example
Bash.xml, listing mirror URLs of a .tgz archive:

mkdir -p ~/docsets && cd ~/docsets
curl -LO http://sanfrancisco.kapeli.com/feeds/Bash.tgz   # a URL from Bash.xml
tar -xzf Bash.tgz                                        # creates Bash.docset/

Configure

plugins:
  entries:
    offline-docsets:
      settings:
        paths:                 # .docset folders and/or folders holding them
          - ~/docsets
          - /data/docs/NodeJS.docset
        max_chars: 12000       # optional; characters per docset_read call (1000-100000)

A folder that is not itself a docset is scanned one level deep for *.docset folders. Each docset's
id is its folder name without .docset, for example NodeJS. If two folders hold docsets with the
same name, the first one wins and the second is reported under unavailable. Missing paths and
unreadable docsets are reported the same way and do not hide the others.

What it does on your machine (disclosure)

  • Reads only the docsets you configure. For each one it opens Contents/Info.plist, the
    Contents/Resources/docSet.dsidx index and pages inside Contents/Resources/Documents. A page
    path that resolves outside Documents (through .., an encoded %2e%2e, an absolute path or a
    symlink) is refused. Folders are listed only to find *.docset folders.
  • No network. Search and reading are local. The test suite checks this by refusing to open any
    socket while all three tools run. Links to outside sites are left out of the link list.
  • Writes nothing. The index is opened for each call with SQLite's mode=ro&immutable=1 and
    closed again; nothing is kept between calls. immutable=1 matters: some docsets ship their
    index in WAL mode, and plain mode=ro then writes the -shm file, or creates -wal and -shm
    files when they are missing. The tests check that every connection is opened this way and
    closed, and that no file of a WAL-mode index changes.
  • No credentials, no shell commands, no background work.
  • Content is third-party text. Page text is returned to the model as the documentation's
    authors wrote it. Scripts and styles are stripped and HTML is reduced to plain text, but the words
    are not filtered. Use docsets from sources you trust.

Limits

  • A docset with no unpacked Documents folder (for example one whose pages are kept in a
    compressed archive) is reported as unavailable, and so is an index that has neither a
    searchIndex table nor the Core Data tables ZTOKEN, ZTOKENTYPE, ZTOKENMETAINFORMATION and
    ZFILEPATH.
  • An index whose docSet.dsidx-wal or docSet.dsidx-journal file is not empty has changes another
    program has not finished writing. It is reported as unavailable rather than read incompletely;
    it can be read once that program closes it.
  • Search matches entry names, not the full text of pages.
  • Text only: images and other files inside a docset are not returned.
  • Pages larger than 20 MB are refused. Up to 50 in-docset links are listed per page.

Development

python -m pip install pytest
python -m pytest -c tests/pytest.ini tests
OFFLINE_DOCSETS_REAL=~/docsets python -m pytest -c tests/pytest.ini tests -k real_world -s
hermes plugins validate .

The tests build docsets in the real layout (an Info.plist, a docSet.dsidx SQLite index and
HTML pages) in both index layouts, the Core Data one in WAL mode with <dash_entry_...> path
prefixes as Kapeli's Python docset has it. They also build layouts the plugin must refuse: Core
Data tables with some missing, no Documents folder, an index that is not SQLite, an index with
changes waiting in its -wal file, and an index entry and a symlink pointing outside the docset.

OFFLINE_DOCSETS_REAL (one or more paths, separated like PATH) adds a test against downloaded
docsets. It samples up to 200 entries per docset and checks that searching for each entry's exact
name returns it first, that reading it starts at its anchor, and that no file of the index
changes.

License

MIT

README from the reviewed commit 85e217a; it updates when the author re-pins.

More by nftpoetrist

6 plugins by nftpoetrist in the catalog.

nftpoetristcalibre-libraryLets the agent search your calibre e-book libraries and read their EPUB and TXT books, from the metadata.db and book folders calibre leaves on disk; calibre need not be installed or running. calibre_search matches titles, authors, series, tags, publishers and identifiers (ISBN, ASIN, ...) ignoring case and accents, with author, series, tag, format and language filters; calibre_book shows everything calibre records about a book and its files; calibre_read returns an EPUB in reading order with chapter offsets, or a TXT decoded as UTF-8 or Windows-1252, in parts. Standard library only. Not affiliated with calibre. Disclosure — reads only the library folders you configure: metadata.db, opened read-only per call (mode=ro, or immutable=1 for a WAL-mode database, which is refused while its -wal holds changes), and the one book file asked for, which must lie inside the library folder. EPUBs are read in place, never extracted; a package declaring a DTD or entities, a document over 32 MB unpacked or a book over 128 MB is refused. Writes nothing, makes no network calls, needs no credentials and runs no commands. Book text and descriptions are returned to the model as they are, with scripts and styles stripped.Communitytools1nftpoetristoffline-mailLets the agent search and read mail archives on this machine without signing in to any mail account: mbox files (Thunderbird's folders, a Google Takeout export of Gmail, mailing-list archives) and Maildir folders (mutt, mbsync, OfflineIMAP, Dovecot). mail_folders lists the folders found under plugins.entries.offline-mail.settings.paths, mail_search finds messages by the words of their subject, names, addresses or text (case and accents ignored) with folder, sender, recipient, date and Message-ID filters, newest first, and mail_read returns a message's headers, text (the plain-text part, or the HTML part as text) and attachment list, in parts. Standard library only. Disclosure — reads only the mail files under the paths you configure, and what the agent reads goes to your model provider like the rest of the conversation; opens files read-only and never sends, moves, deletes or marks mail (a Maildir message is not renamed to seen); makes no network calls, needs no credentials and runs no commands. Message text is returned as its senders wrote it, with HTML scripts and styles removed.Communitytoolsnftpoetristoffline-zimLets the agent search and read ZIM files on this machine without internet access: the open archive format behind Kiwix's offline Wikipedia, Wiktionary, Stack Exchange, Project Gutenberg and other libraries. zim_list_books lists the ZIM files configured under plugins.entries.offline-zim.settings.paths, zim_search uses each archive's full-text index (or its titles when it has none), and zim_read returns an article as plain text in parts, with redirects followed and in-book links listed. Not affiliated with Kiwix or openZIM; reads archives with python-libzim. Disclosure — reads only the ZIM files and folders you configure (folders are listed to find *.zim), makes no network calls, writes nothing, needs no credentials and runs no commands. Article text is returned to the model as the archive's maker wrote it, with scripts and styles stripped. The libzim dependency is GPL-3.0-or-later.Communitytoolsnftpoetristorg-filesLets the agent search and read your Org mode (.org) files and answer from their agenda, without Emacs running. org_files lists the files under plugins.entries.org-files.settings.paths, org_search finds headings by words, TODO keyword (each file's #+TODO, or your own org-todo-keywords), tags (inherited and #+FILETAGS included) and priority, org_agenda returns the entries for a span of days by org-agenda-list's default rules (SCHEDULED, overdue items on today, DEADLINE warnings, appointments, +1w/++1m/.+1d repeaters with Org's month arithmetic, date ranges; blocks, COMMENT and ARCHIVE subtrees skipped), checked against Org's own agenda tests, and org_read returns an entry or a file as Org text with its properties and subheadings. Standard library only. Not affiliated with the Org mode project or GNU Emacs. Disclosure — reads only the .org files under the paths you configure (hidden folders, symlinks and Emacs lock and auto-save files skipped), and what the agent reads goes to your model provider like the rest of the conversation; opens files read-only and writes nothing; makes no network calls, needs no credentials and runs no commands, Emacs included.Communitytools

Developer Mode

Explore built-in Hermes toolsets and actions.

HermesAgent

Developer?

Create a Hermes extension for Desktop or agent workflows.

Developer Section