mirror of
https://github.com/patriceckhart/zot.git
synced 2026-06-27 13:56:33 +02:00
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).
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
// hello — a tiny zot extension that registers /hello and /summon.
|
|
//
|
|
// Build it:
|
|
//
|
|
// cd examples/extensions/hello
|
|
// go build -o hello .
|
|
//
|
|
// Then drop it next to its extension.json under
|
|
// $ZOT_HOME/extensions/hello/, or run `zot ext install ./hello`
|
|
// from this directory.
|
|
package main
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/patriceckhart/zot/packages/agent/ext"
|
|
)
|
|
|
|
func main() {
|
|
e := ext.New("hello", "1.0.0")
|
|
|
|
// /hello [name] — submits a friendly prompt to the agent.
|
|
e.Command("hello", "say hello (optional name)", func(args string) ext.Response {
|
|
who := strings.TrimSpace(args)
|
|
if who == "" {
|
|
return ext.Prompt("Greet me with a short, slightly absurd compliment.")
|
|
}
|
|
return ext.Prompt("Greet " + who + " with a short, slightly absurd compliment.")
|
|
})
|
|
|
|
// /summon — pushes a notice into the chat without involving the
|
|
// model. Useful for pretending we did something important.
|
|
e.Command("summon", "show a tongue-in-cheek summon notice", func(args string) ext.Response {
|
|
e.Notify("info", "the daemon stirs in its cage.")
|
|
return ext.Display("a wisp of incense curls past your terminal.")
|
|
})
|
|
|
|
if err := e.Run(); err != nil {
|
|
e.Logf("fatal: %v", err)
|
|
}
|
|
}
|