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
- Variables
- func BoardPath(next string) (string, error)
- type Board
- type Config
- func (c Config) AgentEnv(conversation string) []string
- func (c Config) BoardSignIn(ctx context.Context, who User, next string) (string, error)
- func (c Config) Doc(ctx context.Context, slug string) (DocSummary, error)
- func (c Config) DocAccessOf(ctx context.Context, slug string, open *bool) (DocAccess, error)
- func (c Config) DocDiff(ctx context.Context, slug, from, to string) (DocDiff, error)
- func (c Config) DocReadLink(ctx context.Context, slug string) (string, time.Time, error)
- func (c Config) DocVersions(ctx context.Context, slug string) ([]DocVersion, error)
- func (c Config) Documents(ctx context.Context, conversation string) ([]Document, error)
- func (c Config) Enabled() bool
- func (c Config) ListBoards(ctx context.Context) ([]Board, error)
- func (c Config) ListDocs(ctx context.Context, limit int) ([]DocSummary, error)
- func (c Config) Public() Public
- type DocAccess
- type DocAnchor
- type DocAuthor
- type DocComment
- type DocDiff
- type DocDiffBlock
- type DocSummary
- type DocThread
- type DocVersion
- type Document
- type Public
- type Service
- type Threads
- func (t *Threads) Counts(person string) (open, unread map[string]int, last map[string]string, err error)
- func (t *Threads) Create(slug string, anchor DocAnchor, body string, by DocAuthor) (DocThread, error)
- func (t *Threads) MarkRead(person, slug string) error
- func (t *Threads) Of(slug string) ([]DocThread, error)
- func (t *Threads) Reply(slug, id, body string, by DocAuthor) (DocThread, error)
- func (t *Threads) SetStatus(slug, id, status string) (DocThread, error)
- type UpstreamError
- type User
Constants ¶
const BoardsMax = 200
BoardsMax is how many boards the list gives the page, the newest first as the server orders them.
Variables ¶
var ErrBadPath = errors.New("the target must be a boards path (/b/…)")
ErrBadPath: a hand-off target that is not a boards path.
var ErrNoThread = errors.New("no such thread")
ErrNoThread: the thread is not on that document.
var ErrNotConfigured = errors.New("not configured")
ErrNotConfigured: the service the call needs has no address.
Functions ¶
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 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 (Config) AgentEnv ¶
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 ¶
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) DocAccessOf ¶
DocAccessOf is the document's public link state; open (when not nil) opens or closes the link first.
func (Config) DocReadLink ¶
DocReadLink is a short-lived read-only address of the document, for the reader's frame.
func (Config) DocVersions ¶
DocVersions lists a document's versions, newest first, with version ids as `sha`.
func (Config) Documents ¶
Documents lists what a conversation published to the catalog, newest first.
func (Config) ListBoards ¶ added in v0.15.40
ListBoards is the boards of the server (GET /b/api/boards with the runtime's token).
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 ¶
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 ¶
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 ¶
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.
type UpstreamError ¶
UpstreamError is a service's refusal, its status and its error text.
func (*UpstreamError) Error ¶
func (e *UpstreamError) Error() string
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. |