clinesdk

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package clinesdk reads the sessions of the Cline SDK (@cline/core), which Cline's CLI, its JetBrains and SDK hosts, and the VS Code extension from 4.0 write under ~/.cline/data/sessions: one directory per session, holding its manifest (<id>.json), its canonical history (<id>.messages.json, a versioned JSON document), the compacted context of its latest compaction (<id>.compaction.json), and the histories of the sub-agents and team tasks it ran (<agentId>.messages.json, <agentId>__<teamTaskId>.messages.json). Classic Cline's task directories, which 4.0 still reads, are the cline package's.

Cline also indexes its sessions in SQLite, ~/.cline/data/db/sessions.db, which alone records which agent spawned a sub-agent; when SQLite could not be opened it kept the same rows in sessions/sessions.index.json. This package imports the standard library alone: it reads the JSON index itself (ReadFileIndex) and declares the Index the clinesdk/sqlite package implements over sessions.db.

The files are whole JSON documents, rewritten on every change, not logs. A messages array is read element by element: an element that is not an object is kept with its error and its neighbours still read, and an array cut short keeps the elements that end before the cut. Every object keeps the members it does not declare and writes them back, so an element read and written again is the same JSON value.

ReadSession reads a session directory; FindSessions lists the session directories under a data directory. The package also ports the rules a reader of the files needs from Cline's own: the compaction sidecar's source-prefix hash (SourcePrefixHash), which decides whether the sidecar still applies, the user-input normalisation it hashes (FormatDisplayUserInput), and the sub-session IDs (ParseSubSessionID). Rebuilding what each request sent, and converting to the Agent Session Format, are the convert subpackage's; docs/formats/clinesdk.md is the mapping.

Index

Constants

View Source
const (
	SuffixManifest   = ".json"
	SuffixMessages   = ".messages.json"
	SuffixCompaction = ".compaction.json"
)

File name suffixes in a session directory: <id>.json is the manifest, <id>.messages.json the history, <id>.compaction.json the sidecar; any other <stem>.messages.json is a sub-agent's or a team task's history.

View Source
const (
	DatabaseName  = "sessions.db"
	FileIndexName = "sessions.index.json"
)

Names of Cline's index files.

View Source
const (
	RoleUser      = "user"
	RoleAssistant = "assistant"
)

Roles of a message.

View Source
const (
	BlockText             = "text"
	BlockFile             = "file"
	BlockImage            = "image"
	BlockMedia            = "media"
	BlockToolUse          = "tool_use"
	BlockToolResult       = "tool_result"
	BlockThinking         = "thinking"
	BlockRedactedThinking = "redacted_thinking"
)

Content block types (@cline/shared's llms/messages.ts).

View Source
const (
	AgentLead     = "lead"
	AgentSubagent = "subagent"
	AgentTeammate = "teammate"
)

Agent kinds a messages file names.

View Source
const MaxBlocks = 1 << 16

MaxBlocks bounds the blocks of one message's content; content of more is read as content that is neither text nor blocks.

View Source
const MaxMessages = 1 << 20

MaxMessages bounds the elements of one messages array the reader reads: a decoded message costs a few hundred bytes whatever its size, so a file of a million tiny elements would cost a hundred times its size. The elements after it are reported as a fault, as a file cut short is. Real histories hold thousands.

View Source
const MaxSize = 1 << 30

MaxSize bounds a file the reader reads. A larger file is refused rather than read into memory, and reported as malformed.

Variables

View Source
var ErrLoneSurrogate = errors.New("user text holding a lone surrogate, which the hash here cannot reproduce")

ErrLoneSurrogate is returned for user text holding a lone surrogate, which Cline hashes and the user-input rules, written for Go strings here, cannot carry.

View Source
var ErrUnhashable = errors.New("a message Cline cannot hash")

ErrUnhashable is returned for a message Cline itself cannot hash: an element that is not an object, a role that is not a string, a part that is not an object. Cline throws on such a history, so no sidecar it wrote projects over it.

Functions

func BoundaryKey

func BoundaryKey(m *Message) (string, error)

BoundaryKey is the key Cline records of a sidecar's last source message: "id:<id>", else "ts:<role>:<ts>", else "content:<role>:<content as JSON>".

func FileStem

func FileStem(id string) string

FileStem is the stem of a child's messages file in its root's directory: the agent for a sub-agent, <agent>__<task> for a team task, the ID itself for a root session.

func FindSessions

func FindSessions(root string) ([]string, error)

FindSessions returns the session directories under root as the path of each one's main file, its history or else its manifest, sorted. root may be ~/.cline, its data directory, the sessions directory, a session directory, or a file in one, which names its directory. A directory that cannot be read is skipped, and a session directory is not walked into.

func Float

func Float(raw json.RawMessage) (float64, bool)

Float reads a number written as a number or a string of one.

func FormatDisplayUserInput

func FormatDisplayUserInput(input string) string

FormatDisplayUserInput is Cline's formatDisplayUserInput: the text a user typed as the chat view shows it, a slash command as "/<slash> <text>". The compaction hash reads a user's text so.

func ISOTime

func ISOTime(s string) (time.Time, bool)

ISOTime reads an ISO 8601 time as Cline writes it, Date's toISOString; false for anything else.

func IndexPaths

func IndexPaths(sessionDir string) (database, fileIndex string)

IndexPaths are where Cline's index of a session directory's sessions would be: sessions.db in the data directory's db directory, and sessions.index.json in the sessions directory, which Cline writes when it cannot open SQLite. Cline's CLINE_DB_DATA_DIR can move the database elsewhere, which a reader of the files cannot know.

func Int

func Int(raw json.RawMessage) (n int64, exact, ok bool)

Int reads an integer written as a number, possibly 12.0, or a string of one. exact is false when a fraction was dropped.

func IsNull

func IsNull(raw json.RawMessage) bool

IsNull reports whether raw is absent or null.

func IsSessionFile

func IsSessionFile(path string) bool

IsSessionFile reports whether path is a file of a session directory the reader reads: its manifest, its history or its sidecar, named by the directory, or another messages file beside them.

func MainFile

func MainFile(path string) string

MainFile returns the file the session directory path names, or the directory of the file it names, is found by: its history, or its manifest; "" when it is no session directory.

func MakeSubSessionID

func MakeSubSessionID(root, agent string) string

MakeSubSessionID is the session ID Cline gives agent's sub-agent session under root.

func Millis

func Millis(raw json.RawMessage) (time.Time, bool)

Millis reads a ms epoch timestamp written as a number; false for anything else, or one outside the years 1970 to 9999.

func NormalizeUserInput

func NormalizeUserInput(input string) string

NormalizeUserInput is Cline's normalizeUserInput: the text trimmed, and each <user_input> and <user_command> element replaced by its content, or, when the text has none, their opening tags removed. Each request sends a user's text so.

func ParseSubSessionID

func ParseSubSessionID(id string) (root, agent string, ok bool)

ParseSubSessionID reads a sub-agent's session ID, <root>__<agent>; false when id is not one, or is a team task's.

func SanitizeSessionToken

func SanitizeSessionToken(s string) string

SanitizeSessionToken is Cline's sanitizeSessionToken.

func SessionDir

func SessionDir(path string) (string, error)

SessionDir returns the session directory a path names: the path itself when it is a directory, else the directory holding it.

func SourcePrefixHash

func SourcePrefixHash(source []*Message, count int) (string, error)

SourcePrefixHash is the hash Cline records of the first count messages of a canonical source, "sha256:<hex>".

func StripModeNotices

func StripModeNotices(input string) string

StripModeNotices is Cline's stripModeNotices: every <mode_notice>...</mode_notice> element removed, and the text trimmed.

func Trim

func Trim(s string) string

Trim is JavaScript's String.prototype.trim: it removes white space and line terminators as ECMAScript defines them, which differ from Go's unicode.IsSpace (U+FEFF is one, U+0085 is not).

Types

type Block

type Block struct {
	Type string `json:"type"`

	// text; a thinking block's and a tool_use's Gemini thought
	// signature, a thinking block's Anthropic signature.
	Text      string `json:"text"`
	Signature string `json:"signature"`
	// file: content and path; tool_result: content, a string or an
	// array of text, image and file blocks or structured results.
	Content json.RawMessage `json:"content"`
	Path    string          `json:"path"`
	// image (base64 data and its media type); redacted_thinking's data.
	Data      string `json:"data"`
	MediaType string `json:"mediaType"`
	// media: model-generated media.
	Media json.RawMessage `json:"media"`
	// tool_use
	ID     string          `json:"id"`
	CallID string          `json:"call_id"`
	Name   string          `json:"name"`
	Input  json.RawMessage `json:"input"`
	// tool_result
	ToolUseID string `json:"tool_use_id"`
	IsError   bool   `json:"is_error"`
	// thinking
	Thinking string          `json:"thinking"`
	Details  json.RawMessage `json:"details"`
	Summary  json.RawMessage `json:"summary"`

	Members

	// Raw and Err are set for a block that is not an object, or whose
	// members do not decode as declared.
	Raw json.RawMessage `json:"-"`
	Err error           `json:"-"`
}

Block is one content block. Type says which members apply.

func (*Block) FileText

func (b *Block) FileText() (string, bool)

FileText is a file block's content; false when it is not a string.

func (Block) MarshalJSON

func (b Block) MarshalJSON() ([]byte, error)

MarshalJSON writes the block back as it was read.

func (*Block) UnmarshalJSON

func (b *Block) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes a block, keeping undeclared members and those of another JSON type. It never fails: a value that is not an object is kept in Raw with Err set.

type Compaction

type Compaction struct {
	Version              json.RawMessage `json:"version"`
	UpdatedAt            string          `json:"updated_at"`
	ConversationID       string          `json:"conversation_id"`
	SourceMessageCount   json.RawMessage `json:"source_message_count"`
	SourcePrefixHash     string          `json:"source_prefix_hash"`
	SourceLastMessageKey string          `json:"source_last_message_key"`
	SystemPrompt         *string         `json:"system_prompt"`

	Members

	// Name is the file's name.
	Name string `json:"-"`
	// Messages are the compacted context's messages.
	Messages    []*Message `json:"-"`
	HasMessages bool       `json:"-"`
	// Err is set when the file could not be read whole.
	Err error `json:"-"`
}

Compaction is a <id>.compaction.json: the working context Cline's latest compaction left, which replaces the first SourceMessageCount messages of the canonical history that are not display-only when SourcePrefixHash still matches them (SessionCompactionState, version 1). Earlier compactions are overwritten.

func ParseCompaction

func ParseCompaction(name string, data []byte) *Compaction

ParseCompaction reads a compaction sidecar from its bytes.

func (*Compaction) Count

func (c *Compaction) Count() (int, bool)

Count is source_message_count; false when it is not a non-negative integer.

func (Compaction) MarshalJSON

func (c Compaction) MarshalJSON() ([]byte, error)

MarshalJSON writes the sidecar and its messages back.

func (*Compaction) Project

func (c *Compaction) Project(history []*Message) Projection

Project decides whether Cline's projectSessionCompactionState applies the sidecar to a session's canonical history, its display-only messages included, which the source leaves out.

func (*Compaction) Valid

func (c *Compaction) Valid() error

Valid says why Cline would refuse the sidecar as it parses it (SessionCompactionStateSchema), nil when it would accept it. Cline ignores a sidecar it refuses.

type Content

type Content struct {
	Text   string
	IsText bool
	Blocks []*Block
	// Raw and Err are set for content that is neither: a number, an
	// object, null. Raw is written back.
	Raw json.RawMessage
	Err error
}

Content is a message's content: a string, or a list of blocks, each decoded on its own.

func (Content) IsZero

func (c Content) IsZero() bool

IsZero reports whether the content was absent, so it is not written back.

func (Content) MarshalJSON

func (c Content) MarshalJSON() ([]byte, error)

MarshalJSON writes the string, the blocks, or what was read.

func (*Content) UnmarshalJSON

func (c *Content) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts a string or an array of blocks; anything else is kept in Raw with Err set.

type FileIndex

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

FileIndex is sessions.index.json, the index Cline keeps in the sessions directory when it cannot open SQLite. It implements Index.

func ReadFileIndex

func ReadFileIndex(path string) (*FileIndex, error)

ReadFileIndex reads sessions.index.json. An entry that does not read is skipped.

func (*FileIndex) Close

func (ix *FileIndex) Close() error

Close does nothing; the index is read whole.

func (*FileIndex) Family

func (ix *FileIndex) Family(root string) ([]*Row, error)

Family returns the rows of root and its children, by session ID.

func (*FileIndex) Name

func (ix *FileIndex) Name() string

Name is the index's file name.

type Fork

type Fork struct {
	// From is forkedFromSessionId, At forkedAt (ISO), Source the
	// source session's source.
	From, At, Source string
	// Raw is the member as written.
	Raw json.RawMessage
}

Fork is a fork's metadata.fork.

func (*Fork) When

func (f *Fork) When() (time.Time, bool)

When is the time the fork was made.

type Index

type Index interface {
	// Name names the index in findings: its file name.
	Name() string
	// Family returns the rows of root and of every session whose
	// parent is root, or whose ID starts with root and "__".
	Family(root string) ([]*Row, error)
	// Close releases the index.
	Close() error
}

Index is Cline's index of its sessions, read for one root session and its children.

func OpenFileIndex

func OpenFileIndex(path string) (Index, error)

OpenFileIndex is ReadFileIndex as an Index, for a caller that takes an opener.

type Manifest

type Manifest struct {
	Version        json.RawMessage `json:"version"`
	SessionID      string          `json:"session_id"`
	Source         string          `json:"source"`
	PID            json.RawMessage `json:"pid"`
	StartedAt      string          `json:"started_at"`
	EndedAt        string          `json:"ended_at"`
	ExitCode       json.RawMessage `json:"exit_code"`
	Status         string          `json:"status"`
	Interactive    json.RawMessage `json:"interactive"`
	Provider       string          `json:"provider"`
	Model          string          `json:"model"`
	CWD            string          `json:"cwd"`
	WorkspaceRoot  string          `json:"workspace_root"`
	TeamName       string          `json:"team_name"`
	EnableTools    json.RawMessage `json:"enable_tools"`
	EnableSpawn    json.RawMessage `json:"enable_spawn"`
	EnableTeams    json.RawMessage `json:"enable_teams"`
	Prompt         string          `json:"prompt"`
	Metadata       json.RawMessage `json:"metadata"`
	MessagesPath   string          `json:"messages_path"`
	CompactionPath string          `json:"compaction_path"`

	Members
}

Manifest is a session's <id>.json: the session record Cline writes beside its history (SessionManifest, version 1). Cline keeps the same record, with the sub-agent parentage the manifest leaves out, as a row of its index.

func (*Manifest) Fork

func (m *Manifest) Fork() *Fork

Fork is metadata.fork: the session it was forked from, and when. nil when the session is no fork.

func (*Manifest) ImportedFrom

func (m *Manifest) ImportedFrom() json.RawMessage

ImportedFrom is metadata.importedFrom: the other agent's session Cline imported this one from, raw; nil when it was not imported. Cline reads it only when it has a tool and a source session ID.

func (*Manifest) LegacyTask

func (m *Manifest) LegacyTask() bool

LegacyTask reports whether the metadata marks the session as a classic task the VS Code extension carried on: legacyTask or migratedFromLegacyTask true.

func (Manifest) MarshalJSON

func (m Manifest) MarshalJSON() ([]byte, error)

MarshalJSON writes the manifest back as it was read.

func (*Manifest) Meta

func (m *Manifest) Meta() map[string]json.RawMessage

Meta is the manifest's metadata object; nil when it has none.

func (*Manifest) Started

func (m *Manifest) Started() (time.Time, bool)

Started is the session's start time, started_at.

func (*Manifest) Title

func (m *Manifest) Title() string

Title is the session's title, metadata.title.

func (*Manifest) UnmarshalJSON

func (m *Manifest) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes the manifest, keeping undeclared members and members of another JSON type. A value that is not an object fails.

type Members

type Members = jsonline.Members

Members is embedded in every object this package decodes. It keeps the members the Go type does not declare, and remembers which declared members the input carried and which were null, so an object decoded and encoded again is the same JSON value.

type Message

type Message struct {
	Role      string          `json:"role"`
	Content   Content         `json:"content"`
	ID        string          `json:"id"`
	Agent     string          `json:"agent"`
	SessionID string          `json:"sessionId"`
	Metadata  json.RawMessage `json:"metadata"`
	ModelInfo *ModelInfo      `json:"modelInfo"`
	Metrics   *Metrics        `json:"metrics"`
	TS        json.RawMessage `json:"ts"`

	Members

	// Elem is the element as read, whatever it holds.
	Elem json.RawMessage `json:"-"`
	// Err is why the element did not decode: it is not an object, or
	// its members do not fit; nothing else is then set.
	Err error `json:"-"`
	// contains filtered or unexported fields
}

Message is one element of a messages array: MessageWithMetadata, a provider-neutral message with Cline's members.

func CanonicalSource

func CanonicalSource(ms []*Message) []*Message

CanonicalSource is the history a sidecar counts and hashes: every message but the display-only ones.

func (*Message) Blocks

func (m *Message) Blocks() []*Block

Blocks returns the message's content as blocks: its blocks, or one text block for string content. Content that is neither gives none.

func (*Message) DisplayOnly

func (m *Message) DisplayOnly() bool

DisplayOnly reports whether the message is metadata.displayOnly: a message the chat view shows and no request sends.

func (*Message) IsCompactionSummary

func (m *Message) IsCompactionSummary() bool

IsCompactionSummary reports whether the message is a compaction's summary, a user message of metadata.kind "compaction_summary".

func (*Message) Kind

func (m *Message) Kind() string

Kind is metadata.kind, such as "compaction_summary".

func (Message) MarshalJSON

func (m Message) MarshalJSON() ([]byte, error)

MarshalJSON writes the message back as it was read.

func (*Message) Meta

func (m *Message) Meta() map[string]json.RawMessage

Meta is the message's metadata object; nil when it has none.

func (*Message) Time

func (m *Message) Time() (time.Time, bool)

Time is the message's ts, ms since the epoch; false when it has none.

func (*Message) UnmarshalJSON

func (m *Message) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes a message, keeping undeclared members and members of another JSON type; an element that is not an object is kept with Err set.

type MessagesFile

type MessagesFile struct {
	// Name is the file's name in the session directory.
	Name string `json:"-"`

	Version      json.RawMessage `json:"version"`
	UpdatedAt    string          `json:"updated_at"`
	Agent        string          `json:"agent"`
	SessionID    string          `json:"sessionId"`
	TaskType     string          `json:"taskType"`
	Origin       *Origin         `json:"origin"`
	SystemPrompt *string         `json:"system_prompt"`

	Members

	// Bare says the file is a bare array of messages, with no envelope.
	Bare bool `json:"-"`
	// Messages are the elements of the messages array, in order.
	Messages []*Message `json:"-"`
	// HasMessages says the envelope has a messages member that is an
	// array.
	HasMessages bool `json:"-"`
	// Err is set when the file could not be read whole: it does not
	// parse, it is not an object or an array, or it is cut short.
	// Messages then holds the elements that end before the fault.
	Err error `json:"-"`
}

MessagesFile is a <id>.messages.json: the canonical history of a session, or of a sub-agent or team task, version 1. Before the version the file was a bare array of messages, which Cline still reads.

func ParseMessagesFile

func ParseMessagesFile(name string, data []byte) *MessagesFile

ParseMessagesFile reads a messages file from its bytes: the envelope's members, and its messages array element by element.

func (MessagesFile) MarshalJSON

func (f MessagesFile) MarshalJSON() ([]byte, error)

MarshalJSON writes the envelope and its messages back.

func (*MessagesFile) VersionNumber

func (f *MessagesFile) VersionNumber() (int64, bool)

VersionNumber is the file's version; false when it records none or one that is not a number.

type Metrics

type Metrics struct {
	InputTokens      json.RawMessage `json:"inputTokens"`
	OutputTokens     json.RawMessage `json:"outputTokens"`
	CacheReadTokens  json.RawMessage `json:"cacheReadTokens"`
	CacheWriteTokens json.RawMessage `json:"cacheWriteTokens"`
	Cost             json.RawMessage `json:"cost"`

	Members
}

Metrics is an assistant message's usage. inputTokens is the AI SDK's total input, cache reads and writes included. Counts are kept as written.

func (Metrics) MarshalJSON

func (x Metrics) MarshalJSON() ([]byte, error)

MarshalJSON writes the metrics back as they were read.

func (*Metrics) UnmarshalJSON

func (x *Metrics) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes the metrics, keeping undeclared members.

type ModelInfo

type ModelInfo struct {
	ID       string `json:"id"`
	Provider string `json:"provider"`
	Family   string `json:"family"`

	Members
}

ModelInfo is the model an assistant message was written with.

func (ModelInfo) MarshalJSON

func (i ModelInfo) MarshalJSON() ([]byte, error)

MarshalJSON writes the model info back as it was read.

func (*ModelInfo) UnmarshalJSON

func (i *ModelInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes the model info, keeping undeclared members.

type Origin

type Origin struct {
	Source         string `json:"source"`
	Mode           string `json:"mode"`
	SessionID      string `json:"sessionId"`
	ParentThreadID string `json:"parentThreadId"`
	Subagent       string `json:"subagent"`
	Version        string `json:"version"`
	Trigger        string `json:"trigger"`

	Members
}

Origin is a messages file's origin: the session's source and history mode, its parent thread and agent for a sub-agent, and the client's version.

func (Origin) MarshalJSON

func (o Origin) MarshalJSON() ([]byte, error)

MarshalJSON writes the origin back as it was read.

func (*Origin) UnmarshalJSON

func (o *Origin) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes the origin, keeping undeclared members.

type Projection

type Projection struct {
	// Applies says Cline would project the sidecar: the context is its
	// messages, then the canonical history after its source.
	Applies bool
	// By says what matched: "hash", or "boundary" for a sidecar older
	// than the hash; Why says why it did not apply.
	By, Why string
	// Count is source_message_count; Unhashed is set when the history
	// holds a message the hash here cannot reproduce, so the hash was
	// not compared.
	Count    int
	Unhashed error
}

Projection says whether a sidecar applies to a canonical history.

type Row

type Row struct {
	SessionID       string
	Source          string
	StartedAt       string
	EndedAt         string
	Status          string
	ParentSessionID string
	ParentAgentID   string
	AgentID         string
	ConversationID  string
	IsSubagent      bool
	Prompt          string
	MessagesPath    string
	// Metadata is the row's metadata, JSON.
	Metadata json.RawMessage
	// Unit names the row in findings.
	Unit string
	// Raw is the whole row as a JSON object, its columns by name.
	Raw json.RawMessage
}

Row is a session's row in Cline's index: the sessions table of sessions.db, or an entry of sessions.index.json. It records what the files leave out: which agent spawned a sub-agent (ParentAgentID, the AgentID of another row, else the root's lead), the sub-agent's own agent and conversation, and the task it was given (Prompt).

type Session

type Session struct {
	// Dir is the session directory, and ID its name, the session's ID.
	Dir string
	ID  string

	// Manifest is <id>.json; ManifestErr why it did not read.
	Manifest    *Manifest
	ManifestErr error
	HasManifest bool

	// Messages is the session's own history, nil when the directory
	// holds none.
	Messages *MessagesFile
	// Compaction is the compaction sidecar, nil when there is none.
	Compaction *Compaction
	// Agents are the histories of the sub-agents and team tasks the
	// session ran, by file name.
	Agents []*MessagesFile

	// Others lists the other files of the directory, each a unit the
	// converter does not read; Dirs its directories.
	Others []string
	Dirs   []string
}

Session is one session directory as read.

func ParseSession

func ParseSession(id string, files map[string][]byte) *Session

ParseSession reads a session from its files' contents, by name, without touching the file system. id is the session's ID, the directory's name; a file whose name is not one of the session's is listed in Others.

func ReadSession

func ReadSession(path string) (*Session, error)

ReadSession reads the session directory path names, or the directory of the file it names. A file that cannot be read is recorded with its error, never returned as one; ReadSession fails only when the directory cannot be listed or holds no session.

func (*Session) ManifestName

func (s *Session) ManifestName() string

ManifestName is the manifest's file name.

func (*Session) Units

func (s *Session) Units() int

Units is the number of units the session accounts for: each file it reads, each message of each messages array, and each other file.

type TeamTask

type TeamTask struct {
	Root, Agent, Task string
}

TeamTask is a team task's session ID read back.

func ParseTeamTaskSubSessionID

func ParseTeamTaskSubSessionID(id string) (TeamTask, bool)

ParseTeamTaskSubSessionID reads a team task's session ID; false when id is not one.

Directories

Path Synopsis
Package convert converts the Cline SDK's session directories into the Agent Session Format: a session's history, rebuilt as each request sent it, and the histories of the sub-agents and team tasks it ran, linked to the calls that ran them.
Package convert converts the Cline SDK's session directories into the Agent Session Format: a session's history, rebuilt as each request sent it, and the histories of the sub-agents and team tasks it ran, linked to the calls that ran them.
Package sqlite reads Cline's session index, sessions.db: its sessions table, which alone records which agent spawned a sub-agent, yielding its rows as the clinesdk package's.
Package sqlite reads Cline's session index, sessions.db: its sessions table, which alone records which agent spawned a sub-agent, yielding its rows as the clinesdk package's.

Jump to

Keyboard shortcuts

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