zot/examples/extensions/clock
patriceckhart 1c7488285b fix(extensions): route through manager from runSlash default branch
extension commands appeared in the autocomplete popup but invoking
them produced "unknown command: /summon". The submit-handler path
already tried the extension manager before erroring, but the popup-
enter path (suggest.Selection -> runSlash) bypassed that check and
fell straight into runSlash's switch, where the default case bailed
with the generic error.

Fix: runSlash's default branch now also consults
cfg.Extensions.HasCommand and dispatches via invokeExtensionCommand
when matched. Both UI paths (typed-and-enter, popup-enter) now route
identically. Built-in cases above default still always win on
conflict.

Also adds examples/extensions/clock — a node extension demonstrating
the wire protocol from a non-Go runtime. Pure stdlib (readline +
process), no npm install. Registers /now (display) and /uptime
(prompt). Documented in its README; the protocol works the same
from any language.
2026-04-19 14:20:22 +02:00
..
extension.json fix(extensions): route through manager from runSlash default branch 2026-04-19 14:20:22 +02:00
index.js fix(extensions): route through manager from runSlash default branch 2026-04-19 14:20:22 +02:00
README.md fix(extensions): route through manager from runSlash default branch 2026-04-19 14:20:22 +02:00

clock — example zot extension (Node, no dependencies)

A minimal TypeScript-style extension showing the wire protocol from the Node side without any SDK. Pure stdlib (readline, process).

Requirements

Node 18 or newer (uses ESM). No npm install step.

Install

From this directory:

zot ext install .

This copies the manifest + script into $ZOT_HOME/extensions/clock/. zot picks it up the next time you launch the TUI.

Use

In zot:

  • /now — extension pushes a styled note showing local and ISO time (no model call)
  • /uptime — extension asks the agent to comment on how long the clock extension has been running
  • /uptime caching — same, but the agent's comment is steered by the trailing args

Why JavaScript and not TypeScript

The file uses JSDoc types (@typedef, @param) so it type-checks under tsc --checkJs without a build step. Authentic TypeScript authoring works too — rename index.jsindex.ts, install tsx, and update extension.json:

{
  "exec": "tsx",
  "args": ["index.ts"]
}

zot doesn't care which one you use; it just spawns whatever exec points at and reads/writes JSON lines on its stdio.

See also

  • examples/extensions/hello — Go version using the pkg/zotext SDK
  • docs/extensions.md — full protocol reference