sources

package
v0.16.521 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: AGPL-3.0 Imports: 21 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 sources is what a whole conversation refers to, read from its transcript the way the previous runtime's conversation sources route did: the links of the agent's answers (documents, merge requests, tracker issues and the rest of the web) and the filesystem paths it worked with.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {
	Links *Links
	// contains filtered or unexported fields
}

Collector gathers the links of entries fed in order, so a transcript can be indexed a stretch at a time.

func (*Collector) Add

func (c *Collector) Add(entries []*jsvalue.Object)

Add takes in the links of the assistant answers among entries.

func (*Collector) List

func (c *Collector) List() []Link

List is the links, newest first.

type Link struct {
	URL       string
	Label     *string
	Timestamp float64
	Count     int
	Kind      string
}

Link is one link of the conversation, as the previous runtime listed it.

func (Link) Group

func (l Link) Group() string

Group is the link's place in the panel.

func (Link) Value

func (l Link) Value() *jsvalue.Object

Value is the link as the route writes it.

type Links struct {
	// TrackerURL is the issue tracker's origin (https://tracker.example.com): a bare issue key becomes
	// <TrackerURL>/issue/<key>. TrackerHosts are the hosts its issue links use, IssueKeys its project keys.
	TrackerURL   string
	TrackerHosts []string
	IssueKeys    []string
	// GitLabHosts are the GitLabs whose merge requests are recognised.
	GitLabHosts []string
	// DocsHost serves published documents (/a/<slug>) and boards (/b/<slug>); ReaderHost and ReaderPath are where the
	// platform reads a document (<ReaderPath><slug>).
	DocsHost, ReaderHost, ReaderPath string
}

Links names the services whose links are told apart.

type MRMention added in v0.15.40

type MRMention struct {
	// URL is https://<host>/<project>/-/merge_requests/<iid>, without what follows the number.
	URL       string
	Host      string
	Project   string
	IID       string
	Timestamp float64
}

MRMention is a merge request link somebody wrote in the conversation: the agent in its answer or the person in a message. What a tool printed (a grep through test fixtures, a log) is not a mention, and neither is a link to a server that is not one of the deployment's GitLabs.

type Made added in v0.16.42

type Made struct {
	Links *Links
	// contains filtered or unexported fields
}

Made collects what a conversation made or touched: what package outputs tells of its calls (a published page, a page shown with `harnessly open`, a write into a design) and every page of the catalogue named by the link list of a successful tool result (a board made by a script, a page read back). A link only the agent's text or the person mentions is not one: it is quoted, not touched.

func (*Made) Add added in v0.16.42

func (m *Made) Add(entries []*jsvalue.Object)

Add takes in the calls and results among entries.

func (*Made) List added in v0.16.42

func (m *Made) List() []MadeLink

List is the things, newest first; of the tasks only the newest madeTasksMax.

type MadeLink struct {
	Kind  wire.MadeKind
	Ref   string
	Title string
	Op    wire.OutputOp
	At    wire.Ms
}

MadeLink is a document, a board, a design or a tracker task the conversation made, opened or changed. Ref is the page's address (a board keeps its ?k= key, which opens it), the design's id or the task's address.

type Mentions added in v0.15.40

type Mentions struct {
	Links *Links
	// contains filtered or unexported fields
}

Mentions gathers the merge request links of the texts of a conversation, in the order entries are fed.

func (*Mentions) Add added in v0.15.40

func (m *Mentions) Add(entries []*jsvalue.Object)

Add takes in the links of the agent's answers and of the person's messages among entries.

func (*Mentions) List added in v0.15.40

func (m *Mentions) List() []MRMention

List is the mentions, the oldest first (the latest mention of a merge request dates it).

type Paths

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

Paths are the filesystem locations a conversation worked with, in the order first seen: a Set of the previous runtime, values as they came (a patch file without a path counts as one too).

func (*Paths) Add

func (p *Paths) Add(entries []*jsvalue.Object)

Add takes in the locations of entries: tool targets, paths in shell commands, patched files, command folders.

func (*Paths) List

func (p *Paths) List(cwd string) []any

List is the locations newest first, without system and scratch task paths; cwd, when given, is the oldest.

type Result

type Result struct {
	Links []Link
	// MRs are the merge requests the agent and the person wrote down, oldest first; they are not in Value().
	MRs       []MRMention
	WorkPaths []any
	Size      int64
	// Made are the documents, boards and designs the conversation made or touched, newest first.
	Made []MadeLink
}

Result is what the route answers for a transcript.

func (Result) Value

func (r Result) Value() *jsvalue.Object

Value is the answer as the previous runtime wrote it.

type Route

type Route struct {
	Links *Links
	// Home holds the transcripts the route may read (.claude/projects and .codex/sessions under it).
	Home string
	// Codex are the options Codex transcripts are read with.
	Codex transcript.CodexOptions
	// Authorized is the old API's own check (a page session or the cli-token), SessionOK the page session the handler
	// asks for besides.
	Authorized, SessionOK func(*http.Request) bool
	// contains filtered or unexported fields
}

Route answers GET <platform API>/sources?jsonlPath=&cwd=: the links and work paths of a whole conversation. The index of a transcript is kept and grows with the file: a request reads only the whole lines appended since the previous one, in the stretches the previous runtime read, so both see the same entries.

func (*Route) Answer

func (rt *Route) Answer(r *http.Request) (int, any, http.Header)

Answer is the whole answer, refusals included.

func (*Route) Read

func (rt *Route) Read(path, cwd string) (res Result, found, failed bool)

Read is the sources of a transcript: found is false for a path that is not an allowed transcript file, failed true where the previous runtime's parser threw (it answered 500).

func (*Route) ReadBudget added in v0.16.42

func (rt *Route) ReadBudget(path, cwd string, budget int64) (res Result, found, failed, complete bool)

ReadBudget is Read for a page that cannot wait for a long transcript: a growth of at most budget bytes is read now and the answer is complete; a larger one is read behind (one reader a transcript, in the background) and the answer is what has been read so far, not complete. Ask again for the rest.

Jump to

Keyboard shortcuts

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