All files / src/objects Network.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72                                                                                                                                               
/** How the platform's resources connect — served by `/app/network/*`.
 *
 *  Both views are built by svc-core from stored records
 *  (`app/services/network/`), never by a model:
 *
 *  - the **knowledge network**: agents → the repositories granted to them →
 *    the sources inside, with each agent's memory store beside it
 *  - the **memory graph**: agents → the conversations they remember → the
 *    newest memory entries
 */
 
export type NetworkNodeKind =
  | "agent"
  | "repository"
  | "knowledge"
  | "memory"
  | "conversation"
  | "memory_entry";
 
export type NetworkEdgeKind =
  | "grant"
  | "member"
  | "memory"
  | "conversation"
  | "entry";
 
export interface NetworkNode {
  /** `<kind>:<resource id>`, unique across kinds. */
  id: string;
  kind: NetworkNodeKind;
  label: string;
  /** The resource the node stands for; null when it is not one. */
  ref_id: string | null;
  /** Kind-specific figures — counts, source type, flags, timestamps. */
  meta: Record<string, unknown>;
}
 
export interface NetworkEdge {
  source: string;
  target: string;
  kind: NetworkEdgeKind;
}
 
/** Knowledge network summary. `memory_entries` is null when memory was not
 *  asked for or svc-ai could not answer — never a stand-in zero. */
export interface KnowledgeNetworkSummary {
  agents: number;
  repositories: number;
  sources: number;
  reachable_sources: number;
  shared_sources: number;
  unreachable_sources: number;
  agents_without_knowledge: number;
  memory_entries: number | null;
}
 
export interface MemoryGraphSummary {
  agents: number;
  conversations: number;
  entries: number | null;
  deleted_conversations: number;
  memory_available: boolean;
}
 
export interface NetworkGraph<S = Record<string, unknown>> {
  nodes: NetworkNode[];
  edges: NetworkEdge[];
  summary: S;
  /** A layer was capped; only part of it is drawn. */
  truncated: boolean;
}