Skip to documentation
Docs navigation
Docs/TopicNode
Types

TopicNode

TypeScript contract for TopicNode.

What it does

TypeScript contract for TopicNode.

Use TopicNode to keep application code aligned with the values MemoGrafter accepts or returns at this boundary. It is a TypeScript-only contract and adds no runtime behavior.

Definition

TypeScript
interface TopicNode {
  id: string;
  sessionId: string;
  segmentId: string;
  label: string;
  summary: string;
  embedding: number[];
  tags?: string[];
  source?: string;
  messageRange: [number, number];
  topicOrder: number;
  driftScore: number;
  agentColor: string | null;
  fleetId: string | null;
  agentId: string | null;
  suppressed?: boolean;
  suppressedAt?: Date | null;
  createdAt: Date;
}

Fields and behavior

id, sessionId, and segmentId identify the topic and its owning session/segment.
label is the short extracted topic name; summary is its generated description.
messageRange is the inclusive source-message index range; topicOrder is its position in the session.
driftScore records the topic-boundary signal. embedding is the stored semantic vector and can be large.
tags and source preserve caller metadata.
suppressed and suppressedAt describe topic lifecycle state.
agentColor, fleetId, and agentId are populated for fleet-owned topics and otherwise are null.
createdAt is a JavaScript Date when read through the package API.

Result

A compile-time-only TypeScript contract with no runtime value.

Example

example.ts
import type { TopicNode } from "memo-grafter";

function useValue(value: TopicNode) {
  return value;
}

Important behavior

Use import type when the contract is not needed at runtime.