Interface: ThreadTreeJSON
@providerprotocol/agents / index / ThreadTreeJSON
Interface: ThreadTreeJSON
Section titled “Interface: 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
Example
Section titled “Example”// Saving a thread tree to storageconst json: ThreadTreeJSON = tree.toJSON();await Bun.write('conversation.json', JSON.stringify(json));
// Restoring from storageconst data = await Bun.file('conversation.json').json();const restored = ThreadTree.fromJSON(data as ThreadTreeJSON);Properties
Section titled “Properties”currentId
Section titled “currentId”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
Section titled “rootId”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.