remote

package
v0.6.1015 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package remote is the client of a registry's Writing Voice routes (the core's docs/voice.md): read the account's voice, put a new version for review, and set the account's always-attach flag, for the account a session token or a personal access token with voice:read and voice:write speaks for. The CLI and the desktop both use it.

The text travels in the clear over TLS and the registry seals it at rest: unlike a knowledge pack, a voice is read by the registry to be reviewed before it is live, so a client seal would protect nothing the registry does not open.

Index

Constants

View Source
const MaxScore = 3

MaxScore is the top of the scale AI Review scores a question on (0–3).

View Source
const VerdictIncomplete = "incomplete"

VerdictIncomplete is a review report whose stage or judge did not finish: the version stays in review and the registry asks again.

Variables

View Source
var (
	// ErrSignedOut is a registry with no credential, or one that refused
	// it: the knowledge store's own, so a caller tests one value for both.
	ErrSignedOut = store.ErrSignedOut
	// ErrNoAccountVoice is an account that keeps no Writing Voice (this
	// computer keeping none is voice.ErrNoVoice).
	ErrNoAccountVoice = errors.New("your account keeps no Writing Voice")
	// ErrUnconfigured is a registry that keeps no voices: no key to seal
	// them with, or no AI Review judge to review them.
	ErrUnconfigured = errors.New("this registry keeps no Writing Voices")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	AlwaysAttach bool     `json:"alwaysAttach"`
	Live         *Version `json:"live,omitempty"`
	Pending      *Version `json:"pending,omitempty"`
	Previous     *Version `json:"previous,omitempty"`
	QuestionSet  string   `json:"questionSet"`
}

Account is the account's voice: the always-attach flag, and the live, pending and previous versions, any of which may be missing.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is one registry, as one account.

func New

func New(regURL, token string, hc *http.Client) (*Client, error)

New is the client of the registry at regURL (no trailing slash) with token as its bearer credential. hc carries every request (nil: http.DefaultClient, which has no timeout; callers pass their own).

func (*Client) Get

func (c *Client) Get(ctx context.Context) (Account, error)

Get is the account's voice: GET /voice. ErrNoAccountVoice when it keeps none.

func (*Client) SetAlwaysAttach

func (c *Client) SetAlwaysAttach(ctx context.Context, on bool) (Account, error)

SetAlwaysAttach sets whether runs In Agentry attach the account's live voice by default: PUT /voice/settings.

func (*Client) URL

func (c *Client) URL() string

URL is the registry's base URL.

func (*Client) Upload

func (c *Client) Upload(ctx context.Context, text []byte) (Account, error)

Upload puts text as the account's pending version, source upload: PUT /voice. It goes live, replacing the live one, only once AI Review passes it; the answer is the account with the version in review.

type Finding

type Finding struct {
	Scanner  string `json:"scanner"`
	Severity string `json:"severity"`
	Title    string `json:"title"`
	Line     int    `json:"line,omitempty"`
	Question string `json:"question,omitempty"`
	Score    int    `json:"score,omitempty"`
	Flags    bool   `json:"flags"`
}

Finding is one thing AI Review found in a version: a rule stage's finding at a line, or a question of the voice set and its score. Flags says whether it is what keeps the version from going live.

type Review

type Review string

Review is where a version is in its review.

const (
	Reviewing Review = "reviewing"
	Flagged   Review = "flagged"
	Passed    Review = "passed"
)

The review states (the core's VoiceVersion.review).

func (Review) Phrase

func (r Review) Phrase() string

Phrase is the review state in a sentence.

type Version

type Version struct {
	ID          string     `json:"id"`
	Review      Review     `json:"review"`
	Source      string     `json:"source"`
	Digest      string     `json:"digest"`
	Bytes       int        `json:"bytes"`
	Text        string     `json:"-"`
	Verdict     string     `json:"verdict,omitempty"`
	Findings    []Finding  `json:"findings,omitempty"`
	Failure     string     `json:"failure,omitempty"`
	QuestionSet string     `json:"questionSet,omitempty"`
	CreatedAt   time.Time  `json:"createdAt"`
	ReviewedAt  *time.Time `json:"reviewedAt,omitempty"`
}

Version is one version of the account's voice. Source is the registry's word (build, ai-edit, edit, upload, restore), not this computer's voice.Source.

Jump to

Keyboard shortcuts

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