Documentation
¶
Index ¶
- Constants
- Variables
- func Created(name, title string) string
- func ID(name string) string
- func ListLine(w Info) string
- func ManifestJSON(m *apps.Manifest) ([]byte, error)
- func NameOf(id string) string
- func Package(s Spec, now time.Time) (*apps.Manifest, map[string]string, error)
- type Content
- type Info
- type Installer
- type Patch
- type Service
- type Spec
- type Tools
Constants ¶
const ( ScopeChat = "chat" ScopeGlobal = "global" )
Scopes of a widget.
const ( ToolCreate = "widget_create" ToolUpdate = "widget_update" ToolList = "widget_list" ToolRemove = "widget_remove" )
The MCP tools of the widgets under the chat's right column: the same acts as `harnessly widget create|update|list| remove`, on the same Service.
const HostVersion = "0.16.342"
HostVersion is the host that draws side widgets.
const Instruction = "Widgets of the right column: on a computer the person keeps small cards under the chat's right column " +
"(«Лимиты», «Машина», «Подчаты», «Выкат», «Заметка», «Часы» they add themselves from «+ Виджет»). When the person asks for " +
"a widget that shows something («сделай виджет, который показывает…», «добавь виджет …», \"make a widget that shows …\"), " +
"make it with widget_create (or `harnessly widget create`): a name, a title, and what it shows — `sources` (limits, machine, " +
"subagents: the host's data it is given), `smart` (a request a model answers over those data every `every` minutes, at least 5, " +
"and at once on the card's button) and/or your own `html`/`css`/`js` (a sandboxed page: hl.context.data has {sources, smart}, " +
"hl.on('context', fn) brings new data; no network, no secrets, no chats). It appears in the person's stack by itself. Change it " +
"with widget_update, list with widget_list, remove with widget_remove. A widget is made for the chat you are in (scope chat, the default): " +
"the person pins it to other chats or to all of them; scope global is for what is theirs in every chat. A built-in widget is not made: tell the person to add it " +
"from «+ Виджет» under the right column. When the person waits for something long (a render, a build, a deploy, a download), " +
"offer a progress widget yourself, as the workspace prompt says: read the memory note side-widget-offers.md first, ask once with notice_ask."
Instruction is what an agent is told of the widgets, here and in the workspace's prompt.
const Publisher = "local"
Publisher is the publisher of the widgets an agent makes: they are the person's own, on their machine.
const View = "side"
View is the view id of such a widget.
Variables ¶
var ( // ErrExists: create of a name that is a widget already (update it). ErrExists = errors.New("sidewidget: a widget of that name exists: update it") // ErrNotFound: update or remove of a name that is no widget. ErrNotFound = errors.New("sidewidget: no widget of that name") )
var ErrBadName = errors.New("sidewidget: a widget's name is lower case latin letters, digits and '-', up to 33")
ErrBadName is a widget's name that is not one: it never reaches a path.
Functions ¶
func ManifestJSON ¶
ManifestJSON is the manifest as the package's harnessly/app.json.
Types ¶
type Content ¶
Content is what the page hands a live frame to change what the card shows without starting it anew.
type Info ¶
type Info struct {
Name string `json:"name"`
ID string `json:"id"`
Title string `json:"title"`
Smart string `json:"smart,omitempty"`
Every int `json:"every,omitempty"`
Sources []string `json:"sources,omitempty"`
Size string `json:"size,omitempty"`
// Scope is chat or global; Chat the conversation of a chat widget.
Scope string `json:"scope,omitempty"`
Chat string `json:"chat,omitempty"`
}
Info is a widget as list shows it.
type Installer ¶
type Installer interface {
Install(dir string, opt apps.InstallOptions) (apps.Installed, apps.Problems, error)
Uninstall(id string, purge bool, safe *secrets.Store) error
List() ([]apps.Installed, error)
}
Installer is what the service needs of the registry.
type Patch ¶
type Patch struct {
Title *string `json:"title,omitempty"`
Icon *string `json:"icon,omitempty"`
HTML *string `json:"html,omitempty"`
CSS *string `json:"css,omitempty"`
JS *string `json:"js,omitempty"`
Size *string `json:"size,omitempty"`
Refresh *int `json:"refresh,omitempty"`
Sources *[]string `json:"sources,omitempty"`
Smart *string `json:"smart,omitempty"`
Every *int `json:"every,omitempty"`
// Scope and Chat change where the widget shows; Chat is the caller's chat when the scope becomes chat.
Scope *string `json:"scope,omitempty"`
Chat *string `json:"chat,omitempty"`
}
Patch is an update: only the fields given change.
func PlacePatch ¶
PlacePatch is an update's change of scope with the caller's chat: «chat» means the caller's chat.
type Service ¶
type Service struct {
Reg Installer
Root string // <data>/side-widgets
Host string // the runtime's version, for the install's check
Now func() time.Time
}
Service makes, changes, lists and removes the widgets an agent makes.
func (*Service) Content ¶
Content is what the card of a widget made by an agent shows now, by the widget's app id: the page hands it to the live frame, and keeps the last one to draw the card at once when a chat opens.
type Spec ¶
type Spec struct {
Name string `json:"name"`
Title string `json:"title"`
Icon string `json:"icon,omitempty"`
HTML string `json:"html,omitempty"`
CSS string `json:"css,omitempty"`
JS string `json:"js,omitempty"`
Size string `json:"size,omitempty"`
Refresh int `json:"refresh,omitempty"`
Sources []string `json:"sources,omitempty"`
Smart string `json:"smart,omitempty"`
Every int `json:"every,omitempty"`
// Scope is "chat" (shown in the chat it was made for, and where the person pins it) or "global" (every chat);
// empty is chat when Chat is known. Chat is that conversation, put by the one who makes it.
Scope string `json:"scope,omitempty"`
Chat string `json:"chat,omitempty"`
}
Spec is what `harnessly widget create` is told.