zot/examples/extensions/clock
patriceckhart fa7d8d8be5 refactor: split source into packages/{provider,core,tui,agent}
Single Go module, four top-level packages under packages/. Import
paths become github.com/patriceckhart/zot/packages/<name>; downstream
consumers can depend on individual packages without pulling the rest.

Layout:
  packages/provider/     LLM clients + catalog
  packages/provider/auth/ credential store + OAuth + login server
  packages/core/         agent loop, sessions, cost
  packages/tui/          terminal toolkit + chat view
  packages/agent/        CLI wiring, system prompt
    extensions/ extproto/ modes/ tools/ skills/ swarm/
    sdk/  (was pkg/zotcore, package renamed zotcore -> sdk)
    ext/  (was pkg/zotext, package renamed zotext -> ext)

internal/ and pkg/ removed. The internal/assets logo moved into
packages/provider/auth/assets.

Public Go SDK identifiers renamed:
  pkg/zotcore (package zotcore) -> packages/agent/sdk (package sdk)
  pkg/zotext  (package zotext)  -> packages/agent/ext (package ext)

This breaks Go-based extensions and embedders; the JSON wire protocol
for extensions and RPC is unchanged, so non-Go extensions, already-
built extension binaries, and zot rpc consumers are unaffected.

Docs, examples, and the built-in write-zot-extension skill updated
for the new paths and identifiers. Shadow-bug fixes in code samples
(ext := ext.New -> e := ext.New).
2026-05-27 09:07:15 +02:00
..
extension.json docs(ext): refresh examples and help text 2026-04-22 20:50:55 +02:00
index.js
README.md refactor: split source into packages/{provider,core,tui,agent} 2026-05-27 09:07:15 +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": "npx",
  "args": ["-y", "tsx", "./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 packages/agent/ext SDK
  • docs/extensions.md — full protocol reference