Instructions to use Wellz1000/hermes-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- HERMES
How to use Wellz1000/hermes-2 with HERMES:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Download apps/desktop/src/plugins/example/plugin.tsx from Wellz1000/hermes-2: direct link, hf CLI and curl.
- Browser
- Download file 4.26 kB
-
https://huggingface.co/Wellz1000/hermes-2/resolve/main/apps/desktop/src/plugins/example/plugin.tsx
- Command line
-
hf download hf://Wellz1000/hermes-2/apps/desktop/src/plugins/example/plugin.tsx
-
curl -L -o plugin.tsx https://huggingface.co/Wellz1000/hermes-2/resolve/main/apps/desktop/src/plugins/example/plugin.tsx
4.26 kB
| /** | |
| * Example plugin β the authoring + publishing reference. A folder under | |
| * `src/plugins/` with a `plugin.tsx` that default-exports a `HermesPlugin` is | |
| * all it takes; `discoverBundledPlugins()` finds and registers it (no import, | |
| * no registry edit). Delete this folder and everything below is gone. | |
| * | |
| * The ONLY import surface is `@hermes/plugin-sdk` (lint-enforced) β the | |
| * vscode-module model. This one plugin dogfoods the whole authoring kit: | |
| * - `render()` contribution β full stateful React in a statusbar slot; | |
| * - `ctx.storage` β the count survives reloads (namespaced persistence); | |
| * - `host.onEvent('*')` β live gateway stream, counted in the tooltip; | |
| * - PALETTE + KEYBINDS contracts β "Example: Reset click counter" in βK | |
| * and as a rebindable (default-unbound) action in the keybind panel; | |
| * - plugin-local `atom` + `useValue` β module state, leaf subscription; | |
| * - `haptic` / `host.notify` / `Tip` / `cn` β the design language. | |
| * | |
| * Ships OFF by default (`defaultEnabled: false`): it inventories in | |
| * Settings βΈ Plugins and registers nothing until the user flips the switch. | |
| */ | |
| import { | |
| atom, | |
| cn, | |
| haptic, | |
| type HermesPlugin, | |
| host, | |
| type KeybindContribution, | |
| KEYBINDS_AREA, | |
| PALETTE_AREA, | |
| type PaletteContribution, | |
| STATUSBAR_AREAS, | |
| Tip, | |
| useValue | |
| } from '@hermes/plugin-sdk' | |
| const $clicks = atom(0) | |
| const $events = atom(0) | |
| function ClickCounter() { | |
| const count = useValue($clicks) | |
| const events = useValue($events) | |
| const gateway = useValue(host.state.gateway) | |
| return ( | |
| <Tip label={`Example plugin β gateway ${gateway}, ${events} events heard`}> | |
| <button | |
| className={cn( | |
| 'inline-flex h-full items-center gap-1 rounded-none px-1.5 text-[0.6875rem] tabular-nums transition-colors', | |
| 'text-(--ui-text-tertiary) hover:bg-(--chrome-action-hover) hover:text-foreground', | |
| count > 0 && 'text-foreground' | |
| )} | |
| onClick={() => { | |
| haptic('tap') | |
| // Imperative read in the handler ($atom.get()), reactive read in the | |
| // render (useValue) β never a stale closure. | |
| const next = $clicks.get() + 1 | |
| $clicks.set(next) | |
| if (next % 10 === 0) { | |
| host.notify({ kind: 'success', message: `Example plugin: ${next} clicks!` }) | |
| } | |
| }} | |
| type="button" | |
| > | |
| <span aria-hidden>β</span> | |
| <span>{count === 0 ? 'click me' : `clicked ${count}Γ`}</span> | |
| </button> | |
| </Tip> | |
| ) | |
| } | |
| const plugin: HermesPlugin = { | |
| id: 'example', | |
| name: 'Example Plugin', | |
| defaultEnabled: false, | |
| register(ctx) { | |
| // Persisted count: hydrate once, write through on every change. | |
| $clicks.set(ctx.storage.get('clicks', 0)) | |
| $clicks.listen(clicks => ctx.storage.set('clicks', clicks)) | |
| // Hear the live gateway stream (deltas, lifecycle, tools β everything). | |
| host.onEvent('*', () => $events.set($events.get() + 1)) | |
| const reset = () => { | |
| $clicks.set(0) | |
| host.notify({ kind: 'info', message: 'Example plugin: counter reset' }) | |
| } | |
| // Provenance (source: 'plugin:example') and the namespaced registry ids | |
| // (example:counter, β¦) are stamped by ctx β authors write plain | |
| // contributions. The shared `example.reset` ACTION id links the palette | |
| // row's hotkey hint to the keybind panel's live binding. | |
| ctx.registerMany([ | |
| { | |
| id: 'counter', | |
| area: STATUSBAR_AREAS.right, | |
| order: 100, | |
| render: () => <ClickCounter /> | |
| }, | |
| { | |
| id: 'reset', | |
| area: PALETTE_AREA, | |
| data: { | |
| id: 'example.reset', | |
| action: 'example.reset', | |
| label: 'Example: Reset click counter', | |
| keywords: ['example', 'plugin', 'counter'], | |
| run: reset | |
| } satisfies PaletteContribution | |
| }, | |
| { | |
| id: 'reset', | |
| area: KEYBINDS_AREA, | |
| data: { | |
| id: 'example.reset', | |
| label: 'Example: Reset click counter', | |
| defaults: [], | |
| run: reset | |
| } satisfies KeybindContribution | |
| } | |
| ]) | |
| } | |
| } | |
| export default plugin | |