integrations

package
v0.16.397 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0 modules, 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.

Documentation

Overview

Package integrations connects the runtime to the sibling services people and agents share with it: a boards server (whiteboards) and an artifacts catalog (documents). Agents get the services' addresses and tokens in their environment; the page embeds the services and asks the runtime for what needs a server-side token (a board sign-in hand-off, the documents of a conversation). Tokens never reach the browser.

Index

Constants

View Source
const BoardsMax = 200

BoardsMax is how many boards the list gives the page, the newest first as the server orders them.

Variables

View Source
var ErrBadPath = errors.New("the target must be a boards path (/b/…)")

ErrBadPath: a hand-off target that is not a boards path.

View Source
var ErrNoThread = errors.New("no such thread")

ErrNoThread: the thread is not on that document.

View Source
var ErrNotConfigured = errors.New("not configured")

ErrNotConfigured: the service the call needs has no address.

Functions

func BoardPath

func BoardPath(next string) (string, error)

BoardPath checks a hand-off target: a path under /b/ on the boards server, with its query.

Types

type Board added in v0.15.40

type Board struct {
	Slug string `json:"slug"`
	// ExternalID is a documents adapter's own id of the board, when it is not the slug.
	ExternalID string `json:"externalId,omitempty"`
	Title      string `json:"title"`
	URL        string `json:"url"`
	UpdatedAt  string `json:"updatedAt"`
}

Board is one whiteboard of the boards server as the page lists it.

type Config

type Config struct {
	// BoardsURL is the boards server's origin (boards lives under /b on it).
	BoardsURL string
	// BoardsToken is the runtime's API token: it mints sign-in hand-offs. BoardsAgentToken goes to agents; empty, they
	// get BoardsToken.
	BoardsToken, BoardsAgentToken string
	// ArtifactsURL is the catalog's origin.
	ArtifactsURL string
	// ArtifactsToken is the editor token agents publish with; ArtifactsReadToken the runtime's viewer token for listing a
	// conversation's documents (ArtifactsToken when empty).
	ArtifactsToken, ArtifactsReadToken string
	// ArtifactsShareToken opens and closes a document's public link from the reader (ArtifactsToken when empty).
	ArtifactsShareToken string
	// Author is who agents publish as (ARTIFACTS_AUTHOR): RUNTIME_ARTIFACTS_AUTHOR, else "<RUNTIME_OWNER_NAME> (agent)";
	// empty leaves it to the CLI.
	Author string
	// Client calls the services; nil is a client with a 10 s timeout.
	Client *http.Client
}

Config is the deployment's view of the services; an empty URL leaves that service out.

func FromEnv

func FromEnv(getenv func(string) string) Config

FromEnv reads the RUNTIME_BOARDS_* and RUNTIME_ARTIFACTS_* variables.

func (Config) AgentEnv

func (c Config) AgentEnv(conversation string) []string

AgentEnv is what an agent tab's shell gets, as KEY=VALUE: the services' addresses and tokens, and the conversation its documents belong to (the tab's id; "" leaves ARTIFACTS_SESSION out).

func (Config) BoardSignIn

func (c Config) BoardSignIn(ctx context.Context, who User, next string) (string, error)

BoardSignIn is the address the page loads in the board pane for next: a one-time hand-off that signs the person in to boards and lands on next, or next itself when the runtime holds no boards token (boards then signs people in its own way: a shared identity provider or proxy, or no auth at all).

func (Config) Doc

func (c Config) Doc(ctx context.Context, slug string) (DocSummary, error)

Doc is one document's summary.

func (Config) DocAccessOf

func (c Config) DocAccessOf(ctx context.Context, slug string, open *bool) (DocAccess, error)

DocAccessOf is the document's public link state; open (when not nil) opens or closes the link first.

func (Config) DocDiff

func (c Config) DocDiff(ctx context.Context, slug, from, to string) (DocDiff, error)

DocDiff compares two versions (numbers or ids) of a document.

func (c Config) DocReadLink(ctx context.Context, slug string) (string, time.Time, error)

DocReadLink is a short-lived read-only address of the document, for the reader's frame.

func (Config) DocVersions

func (c Config) DocVersions(ctx context.Context, slug string) ([]DocVersion, error)

DocVersions lists a document's versions, newest first, with version ids as `sha`.

func (Config) Documents

func (c Config) Documents(ctx context.Context, conversation string) ([]Document, error)

Documents lists what a conversation published to the catalog, newest first.

func (Config) Enabled

func (c Config) Enabled() bool

Enabled says whether any service is configured.

func (Config) ListBoards added in v0.15.40

func (c Config) ListBoards(ctx context.Context) ([]Board, error)

ListBoards is the boards of the server (GET /b/api/boards with the runtime's token).

func (Config) ListDocs

func (c Config) ListDocs(ctx context.Context, limit int) ([]DocSummary, error)

ListDocs is the catalog's newest documents, up to limit.

func (Config) Public

func (c Config) Public() Public

Public is what the page may know.

type DocAccess

type DocAccess struct {
	Public    bool    `json:"public"`
	PublicURL *string `json:"publicUrl"`
}

DocAccess is a document's public link state.

type DocAnchor

type DocAnchor struct {
	Quote       string   `json:"quote"`
	Prefix      string   `json:"prefix"`
	Suffix      string   `json:"suffix"`
	HeadingID   string   `json:"headingId,omitempty"`
	HeadingText string   `json:"headingText,omitempty"`
	ElementID   string   `json:"elementId,omitempty"`
	X           *float64 `json:"x,omitempty"`
	Y           *float64 `json:"y,omitempty"`
}

DocAnchor is where a thread hangs: the quoted words, their context and the nearest heading.

type DocAuthor

type DocAuthor struct {
	Kind  string `json:"kind"`
	Email string `json:"email"`
	Name  string `json:"name"`
}

DocAuthor is who wrote a comment or owns a document.

type DocComment

type DocComment struct {
	ID            string    `json:"id"`
	ThreadID      string    `json:"threadId"`
	Author        DocAuthor `json:"author"`
	Body          string    `json:"body"`
	CreatedAt     string    `json:"createdAt"`
	DeliveredAt   *string   `json:"deliveredAt"`
	DeliveryError *string   `json:"deliveryError"`
}

DocComment is one message of a thread.

type DocDiff

type DocDiff struct {
	From   string         `json:"from"`
	To     string         `json:"to"`
	Blocks []DocDiffBlock `json:"blocks"`
	Stats  struct {
		Added   int `json:"added"`
		Removed int `json:"removed"`
	} `json:"stats"`
}

DocDiff compares two versions block by block.

type DocDiffBlock

type DocDiffBlock struct {
	Kind string `json:"kind"`
	Text string `json:"text"`
}

DocDiffBlock is a run of lines that stayed, appeared or went.

type DocSummary

type DocSummary struct {
	Slug  string `json:"slug"`
	Kind  string `json:"kind"`
	Title string `json:"title"`
	// URL is where people read it: the catalog's viewUrl (which may point back to this page's reader).
	URL         string     `json:"url"`
	Bound       bool       `json:"bound"`
	Owner       *DocAuthor `json:"owner"`
	MachineID   *string    `json:"machineId"`
	SourcePath  *string    `json:"sourcePath"`
	OpenThreads int        `json:"openThreads"`
	Unread      int        `json:"unread"`
	// LastActivityAt is the latest of the document's update and its threads' activity (ISO time).
	LastActivityAt string `json:"lastActivityAt"`
	// Session is the conversation that published it, when the catalog knows one.
	Session string `json:"-"`
	// ExternalID is a documents adapter's own id of the document, when it is not the slug (docprovider.Alias).
	ExternalID string `json:"externalId,omitempty"`
	// ProviderEmbed: the document, a board too, is framed through the runtime's content route (the provider's Embed),
	// not through URL, which is the provider's viewer for people.
	ProviderEmbed bool `json:"providerEmbed,omitempty"`
}

DocSummary is one document as the page lists it.

type DocThread

type DocThread struct {
	ID         string       `json:"id"`
	ExternalID *string      `json:"externalId"`
	Slug       string       `json:"slug"`
	Anchor     DocAnchor    `json:"anchor"`
	Status     string       `json:"status"`
	CreatedBy  DocAuthor    `json:"createdBy"`
	CreatedAt  string       `json:"createdAt"`
	ResolvedAt *string      `json:"resolvedAt"`
	Comments   []DocComment `json:"comments"`
}

DocThread is a discussion on one place of a document.

type DocVersion

type DocVersion struct {
	N         int     `json:"n"`
	SHA       string  `json:"sha"`
	CreatedAt string  `json:"createdAt"`
	Author    *string `json:"author"`
	Note      *string `json:"note"`
	Current   bool    `json:"current"`
}

DocVersion is one published version, newest first in lists.

type Document

type Document struct {
	// ID is the runtime's id of the binding, for a document of a documents adapter (docprovider.Bindings).
	ID   string `json:"id,omitempty"`
	Slug string `json:"slug"`
	// ExternalID is the adapter's own id of the document, when it is not the slug.
	ExternalID string `json:"externalId,omitempty"`
	// Provider is the documents adapter that keeps it ("" is the built-in catalog).
	Provider  string `json:"provider,omitempty"`
	Title     string `json:"title"`
	UpdatedAt string `json:"updatedAt"`
	Version   int    `json:"version"`
	ViewURL   string `json:"viewUrl"`
	EmbedURL  string `json:"embedUrl"`
}

Document is one entry of a conversation's documents.

type Public

type Public struct {
	Boards    *Service `json:"boards"`
	Artifacts *Service `json:"artifacts"`
}

Public is the page's view: the services' origins, nil for one that is not configured. No tokens.

type Service

type Service struct {
	URL string `json:"url"`
}

Service is what the page learns about one service: where it is.

type Threads

type Threads struct {
	Path string
	Now  func() time.Time
	// contains filtered or unexported fields
}

Threads is the file-backed thread store.

func (*Threads) Counts

func (t *Threads) Counts(person string) (open, unread map[string]int, last map[string]string, err error)

Counts is open threads and comments newer than the person's last read, per document.

func (*Threads) Create

func (t *Threads) Create(slug string, anchor DocAnchor, body string, by DocAuthor) (DocThread, error)

Create starts a thread with its first comment.

func (*Threads) MarkRead

func (t *Threads) MarkRead(person, slug string) error

MarkRead records that a person read a document now.

func (*Threads) Of

func (t *Threads) Of(slug string) ([]DocThread, error)

Of is a document's threads, oldest first.

func (*Threads) Reply

func (t *Threads) Reply(slug, id, body string, by DocAuthor) (DocThread, error)

Reply adds a comment to a thread and reopens it.

func (*Threads) SetStatus

func (t *Threads) SetStatus(slug, id, status string) (DocThread, error)

SetStatus resolves or reopens a thread.

type UpstreamError

type UpstreamError struct {
	Status int
	Text   string
}

UpstreamError is a service's refusal, its status and its error text.

func (*UpstreamError) Error

func (e *UpstreamError) Error() string

type User

type User struct {
	ID    string `json:"id"`
	Name  string `json:"name,omitempty"`
	Email string `json:"email,omitempty"`
}

User is the person a board hand-off signs in.

Directories

Path Synopsis
Package github reads issues and pull requests from GitHub (or GitHub Enterprise) for the page: an issue as a task card and tab, an issue or a pull request link as a chip.
Package github reads issues and pull requests from GitHub (or GitHub Enterprise) for the page: an issue as a task card and tab, an issue or a pull request link as a chip.

Jump to

Keyboard shortcuts

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