Skip to content

Interface: ThreadTreeJSON

@providerprotocol/agents


@providerprotocol/agents / index / ThreadTreeJSON

Defined in: src/thread-tree/types.ts:63

Serialized representation of a ThreadTree for JSON persistence.

This interface defines the complete JSON structure of a thread tree, including all nodes and tracking information for the root and current active position within the tree.

ThreadTree - The runtime class this interface serializes

// Saving a thread tree to storage
const json: ThreadTreeJSON = tree.toJSON();
await Bun.write('conversation.json', JSON.stringify(json));
// Restoring from storage
const data = await Bun.file('conversation.json').json();
const restored = ThreadTree.fromJSON(data as ThreadTreeJSON);

currentId: string

Defined in: src/thread-tree/types.ts:74

ID of the currently active node. This tracks which branch/position is currently being used for the conversation.


nodes: ThreadNodeJSON[]

Defined in: src/thread-tree/types.ts:80

Array of all nodes in the tree. Includes the root, all branches, and all leaf nodes.


rootId: string

Defined in: src/thread-tree/types.ts:68

ID of the root node in the tree. The root represents the initial conversation state.