bbapi

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultBaseURL

func DefaultBaseURL() string

Types

type Client

type Client struct {
	BaseURL string
	HTTP    *http.Client
}

func New

func New(baseURL string) *Client

func (*Client) AnswerQuestion

func (c *Client) AnswerQuestion(threadID, interactionID string, answers map[string][]string) error

AnswerQuestion answers a user_question. Answers map question id to the option values chosen for it.

func (*Client) Archive

func (c *Client) Archive(threadID string) error

func (*Client) Delete

func (c *Client) Delete(threadID string) error

func (*Client) ExecutionOptions

func (c *Client) ExecutionOptions(threadID string) (ExecutionOptions, error)

func (*Client) Files

func (c *Client) Files(projectID, query string, limit int) ([]ProjectFile, error)

Files searches the project's tree for "@" mentions. The query is applied by the server, so a repo with a hundred thousand files costs one request.

func (*Client) Health

func (c *Client) Health() error

func (*Client) Interactions

func (c *Client) Interactions(threadID string) ([]Interaction, error)

func (*Client) ListProjects

func (c *Client) ListProjects() ([]Project, error)

func (*Client) ListThreads

func (c *Client) ListThreads() ([]Thread, error)

func (*Client) Options

func (c *Client) Options(providerID string) (ProviderOptions, error)

Options reports what a provider will accept for the next message: its model catalogue and its permission modes. Both are per-provider, so the picker offers exactly what the app would.

func (*Client) PermissionModes

func (c *Client) PermissionModes(providerID string) ([]string, error)

PermissionModes reports what the provider will accept, so the composer offers the same choices the app does rather than a guessed list.

func (*Client) Pin

func (c *Client) Pin(threadID string) error

func (*Client) ResolveApproval

func (c *Client) ResolveApproval(threadID, interactionID, decision string) error

ResolveApproval answers a tool approval. Decision is one of allow_once, allow_for_session, deny.

func (*Client) Retry

func (c *Client) Retry(threadID string) error

Retry re-submits the thread's most recent failed turn. A null turnRequestId means that turn, which is the one whose failure put the thread in error.

func (*Client) Send

func (c *Client) Send(threadID, text string, attachments []LocalAttachment, model, permission string) error

Send posts a message to a thread. "auto" lets bb decide between starting a turn and steering one already in flight, which is what the app's composer does.

func (*Client) Skills

func (c *Client) Skills(projectID, environmentID string) ([]Skill, error)

Skills lists what "/" can insert. environmentID may be empty, which asks for the project's own skills without an environment's overlay.

func (*Client) Spawn

func (c *Client) Spawn(request SpawnRequest) (string, error)

Spawn creates a thread and dispatches its first message. The environment is left as the project default, which is what the app's new-thread composer does unless the user picks otherwise.

func (*Client) Stop

func (c *Client) Stop(threadID string) error

func (*Client) Timeline

func (c *Client) Timeline(threadID string, segmentLimit int) (*Timeline, error)

func (*Client) Unpin

func (c *Client) Unpin(threadID string) error

type ExecutionOptions

type ExecutionOptions struct {
	Model          string `json:"model"`
	PermissionMode string `json:"permissionMode"`
	ReasoningLevel string `json:"reasoningLevel"`
	ServiceTier    string `json:"serviceTier"`
}

type Interaction

type Interaction struct {
	ID        string             `json:"id"`
	ThreadID  string             `json:"threadId"`
	Status    string             `json:"status"`
	CreatedAt int64              `json:"createdAt"`
	Payload   InteractionPayload `json:"payload"`
}

func (Interaction) Summary

func (i Interaction) Summary() string

Summary is the one-line description shown in a picker.

type InteractionPayload

type InteractionPayload struct {
	Kind      string     `json:"kind"`
	Title     string     `json:"title"`
	Command   string     `json:"command"`
	Path      string     `json:"path"`
	ToolName  string     `json:"toolName"`
	Questions []Question `json:"questions"`
}

type LocalAttachment

type LocalAttachment struct {
	Path  string
	Image bool
}

LocalAttachment is a file on this machine to send with a message. bb reads it server-side, so only the path travels.

type Model

type Model struct {
	ID          string `json:"id"`
	DisplayName string `json:"displayName"`
	Description string `json:"description"`
	Reasoning   []struct {
		ReasoningEffort string `json:"reasoningEffort"`
		Description     string `json:"description"`
	} `json:"supportedReasoningEfforts"`
}

type Project

type Project struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Kind string `json:"kind"`
}

type ProjectFile

type ProjectFile struct {
	Path string `json:"path"`
	Name string `json:"name"`
}

type ProviderOptions

type ProviderOptions struct {
	Models          []Model
	PermissionModes []string
}

type Question

type Question struct {
	ID          string           `json:"id"`
	Prompt      string           `json:"prompt"`
	ShortLabel  string           `json:"shortLabel"`
	MultiSelect bool             `json:"multiSelect"`
	Options     []QuestionOption `json:"options"`
}

type QuestionOption

type QuestionOption struct {
	Value       string `json:"value"`
	Label       string `json:"label"`
	Description string `json:"description"`
}

type Runtime

type Runtime struct {
	DisplayStatus string `json:"displayStatus"`
}

type Skill

type Skill struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Scope       string `json:"scope"`
}

type SpawnRequest

type SpawnRequest struct {
	ProjectID      string
	Title          string
	Prompt         string
	ProviderID     string
	Model          string
	PermissionMode string
}

type SpawnResult

type SpawnResult struct {
	ID string `json:"id"`
}

type Thread

type Thread struct {
	ID                    string  `json:"id"`
	ProjectID             string  `json:"projectId"`
	Title                 *string `json:"title"`
	TitleFallback         *string `json:"titleFallback"`
	Status                string  `json:"status"`
	Runtime               Runtime `json:"runtime"`
	QueuedWork            string  `json:"queuedWork"`
	HasPendingInteraction bool    `json:"hasPendingInteraction"`
	PinnedAt              *int64  `json:"pinnedAt"`
	ArchivedAt            *int64  `json:"archivedAt"`
	CreatedAt             int64   `json:"createdAt"`
	UpdatedAt             int64   `json:"updatedAt"`
	EnvironmentBranchName *string `json:"environmentBranchName"`
	EnvironmentPath       *string `json:"environmentPath"`
	ProviderID            string  `json:"providerId"`
}

type Timeline

type Timeline struct {
	MaxSeq int64         `json:"maxSeq"`
	Rows   []TimelineRow `json:"rows"`
}

type TimelineRow

type TimelineRow struct {
	ID        string  `json:"id"`
	Kind      string  `json:"kind"`
	Role      string  `json:"role"`
	Text      string  `json:"text"`
	Title     string  `json:"title"`
	WorkKind  string  `json:"workKind"`
	Status    string  `json:"status"`
	Command   string  `json:"command"`
	Path      string  `json:"path"`
	Query     string  `json:"query"`
	ExitCode  *int    `json:"exitCode"`
	Question  string  `json:"question"`
	CreatedAt int64   `json:"createdAt"`
	StartedAt int64   `json:"startedAt"`
	Summary   *string `json:"summary"`
}

Jump to

Keyboard shortcuts

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