shares

package
v0.0.38 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 4 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 shares lays one capability's sources into shares for recovery (design 02 §2.4), when they are more than one session holds. It lays the sources, in the order reading gives them, into shares that each read their sources whole, and joins them again. It never splits, cuts or skips a source (init-no-cut): a source larger than one share is an error naming it, and the capability is not recovered.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinCapability added in v0.0.6

func JoinCapability(parts []reading.Input, whole reading.Input) reading.Input

JoinCapability is the sources of parts, laid by LayCapability, together again in order, the docs every capability reads once, under whole's Report; with no parts it is whole.

func LayCapability added in v0.0.6

func LayCapability(in reading.Input, room int, message func(reading.Input) string) ([]reading.Input, error)

LayCapability lays one capability's sources in for recovery (design 02 §2.4): as LayFor does, into shares whose messages, as message writes them, each take at most room estimated tokens, except the docs every capability reads (reading.Always), which recovery's sessions read in their system prompt: they are not laid, and every share keeps them. A source too large for one share is an error naming it.

func LayFor added in v0.0.6

func LayFor(in reading.Input, room int, prompt func(reading.Input) string) ([]reading.Input, error)

LayFor lays in's sources into shares whose prompts, as prompt writes them, each take at most room estimated tokens. Sources keep reading.Of's order (docs, PRs each with all its review comments, changes), and a share ends when the next source does not fit beside it. When the docs take at most half of room, every share reads all of them and only the other sources are divided; the docs are divided too when they take more, or when a source fits an empty share but not beside them. Every source reaches exactly one share whole, the docs every share when they are not divided. A source that does not fit even an empty share is a *TooLarge, and LayFor returns no shares. Each share's Report counts only what it reads. The same input and room always give the same shares. Recovery lays a capability's own sources with it (LayCapability).

Types

type TooLarge

type TooLarge struct {
	// Source names the source as a person reads it: "doc <path>", "PR #N"
	// or "change <short id>".
	Source string
	// Tokens is the source's estimated tokens, as the prompt writes it.
	Tokens int
	// Room is the most estimated tokens one share's prompt may take.
	Room int
	// Leave says how to leave the source out of the gather.
	Leave string
}

TooLarge is returned by LayFor when one source, with the prompt around it alone, is more than one share holds. Nothing is cut.

func (*TooLarge) Error

func (e *TooLarge) Error() string

Jump to

Keyboard shortcuts

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