httphandler

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Heartbeat API

Heartbeat Operations

A heartbeat is a prompt for a session, which fires once, at a time, with its offset, such as 2026-11-06T15:00:00+01:00, or again and again, on a schedule, which is a cron expression of five fields, minute, hour, day, month and weekday, such as 0 8 * * 1-5 for eight in the morning on weekdays. A schedule is in its timezone, by its IANA name, such as Europe/Berlin, or, without one, in the person's, which is the memory's, so it follows them, as it changes, or in UTC, when it isn't known.

Each heartbeat has a title, which says what it's for, a prompt, which is the instruction a model is given when it fires, and the session it's for. It has when it last fired, and when it fires next, unless it won't, as it fired once. When the clocks go forward, a time which they skip happens once, after they change, and when they go back, a time which is repeated happens once, the first time. Heartbeats are looked at every ten seconds, from the start of each minute, so a schedule fires at the start of its minute, and a time within ten seconds of it. A heartbeat which was due when the server wasn't running fires once, when the server starts. A heartbeat which won't fire again, such as a one-off which fired, is deleted a week after it last fired, or was changed.

When a heartbeat changes, an event is published, whose schema is heartbeat, whose table is heartbeat, and whose row is its identifier: it's created, updated, including when it fires, or deleted, including when its session is deleted. When it fires, it's run, once, on the server which fires it, in a session of its own, whose identifier is the heartbeat's, which has the model of the session it's for.

GET /heartbeat

List the heartbeats, those which fire soonest first, and those which won't fire again last, with how many there are. With session, only those for the session are listed. Up to 100 are listed at a time, from the offset, and at most the limit.

POST /heartbeat

Create a heartbeat, with its title, prompt and session, and either a schedule, and a timezone, when it has one, or a time, at. Returns the heartbeat, with when it fires next. Returns 400 if it has no title, or prompt, or session, or its session doesn't exist, has neither a schedule nor a time, or both, its schedule isn't valid, its time zone isn't known, or its time has passed.

GET /heartbeat/{id}

Get the heartbeat with the identifier. Returns 404 if there's none.

PATCH /heartbeat/{id}

Change the heartbeat with the identifier: its title, prompt, schedule, which replaces its time, at, which replaces its schedule, and fires again, or timezone, which is empty to follow the person's. Returns the heartbeat. Returns 400 if it isn't valid, or a new time has passed, or 404 if there's none.

DELETE /heartbeat/{id}

Delete the heartbeat with the identifier. Returns the heartbeat, as it was. Returns 404 if there's none.

Documentation

Overview

Package httphandler has the heartbeats' HTTP API, which lists, creates, gets, changes and deletes them

Index

Constants

View Source
const Tag = "Heartbeats"

Tag is the tag of the heartbeats' API, in the "LLM" group

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(h *heartbeat.Heartbeats, router *httprouter.Router) error

RegisterHandlers registers the heartbeats' API with the router, at heartbeat, with the "Heartbeats" tag, in the "LLM" group

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL