Traces: the mechanism TraceService implements.
API
@Interface()
export abstract class Traces {
abstract observeShardRead?: ((path: string) => void) | undefined;
abstract ownedSubagents(parent: {
projectId: string;
agentId: string;
sessionId: string;
createdAt: string;
}): Promise<OwnedSubagent[]>;
abstract subagentChildren(
projectId: string,
agentId: string,
sessionId: string,
): Promise<Array<{ sessionId: string; agentId: string | null; spawnedAt: string }>>;
abstract deleteSessionTraces(
projectId: string,
agentId: string,
sessionId: string,
): Promise<void>;
abstract readMessages(
projectId: string,
agentId: string,
sessionId: string,
): Promise<HistoryMessage[]>;
abstract readMessagesPage(
projectId: string,
agentId: string,
sessionId: string,
req: MessagesPageRequest,
): Promise<MessagesPageResult>;
abstract readHistoryWindow(
projectId: string,
agentId: string,
sessionId: string,
req: MessagesPageRequest | { kind: "full" },
): Promise<HistoryWindowRead>;
abstract historyTraceFiles(
projectId: string,
agentId: string,
sessionId: string,
): Promise<HistoryTraceFile[]>;
abstract forkSessionTrace(
projectId: string,
agentId: string,
sourceSessionId: string,
position: TracePosition,
): Promise<ForkTraceResult>;
abstract contextBreakdown(
projectId: string,
agentId: string,
sessionId: string,
): Promise<SessionContextParts>;
abstract listTraceFiles(
projectId: string,
agentId: string,
sessionId: string,
): Promise<TraceFileInfo[]>;
abstract readEvents(
projectId: string,
agentId: string,
sessionId: string,
index: number,
offset: number,
limit: number,
): Promise<TraceEventsResponse>;
abstract readTraceImage(
projectId: string,
agentId: string,
sessionId: string,
fileIndex: number,
ordinal: number,
slot: number | undefined,
): Promise<{ mime: string; bytes: Buffer }>;
abstract analyze(
projectId: string,
agentId: string,
sessionId: string,
index: number,
): Promise<TraceAnalysisResponse>;
abstract analyzeRecords(
projectId: string,
messages: readonly AmspRecord[],
): Promise<TraceAnalysisResponse>;
abstract agentTraces(
projectId: string,
agentId: string,
paging: { offset: number; limit: number } | null,
opts?: { category?: SessionCategory },
): Promise<AgentTracesResponse>;
abstract readFileRaw(
projectId: string,
agentId: string,
sessionId: string,
index: number,
): Promise<Buffer<ArrayBufferLike>>;
abstract importTraceFile(
projectId: string,
agentId: string,
content: string,
): Promise<TraceImportResponse>;
abstract importSessions(
projectId: string,
agentId: string,
sessions: readonly ImportedSession[],
): Promise<{ imported: number; skipped: string[] }>;
}Contract Topology
Static AST wiring across @Module / @Provide / @UseMembers (19)
observeShardRead
observeShardRead?: ((path: string) => void) | undefinedownedSubagents
ownedSubagents(parent: { projectId: string; agentId: string; sessionId: string; createdAt: string; }): Promise<OwnedSubagent[]>@paramparent
{ projectId: string; agentId: string; sessionId: string; createdAt: string; }@returns
Promise<OwnedSubagent[]>subagentChildren
subagentChildren(projectId: string, agentId: string, sessionId: string): Promise<Array<{ sessionId: string; agentId: string | null; spawnedAt: string }>>@paramprojectId
string@paramagentId
string@paramsessionId
string@returns
Promise<Array<{ sessionId: string; agentId: string | null; spawnedAt: string }>>deleteSessionTraces
deleteSessionTraces(projectId: string, agentId: string, sessionId: string): Promise<void>@paramprojectId
string@paramagentId
string@paramsessionId
string@returns
Promise<void>readMessages
readMessages(projectId: string, agentId: string, sessionId: string): Promise<HistoryMessage[]>@paramprojectId
string@paramagentId
string@paramsessionId
string@returns
Promise<HistoryMessage[]>readMessagesPage
readMessagesPage(projectId: string, agentId: string, sessionId: string, req: MessagesPageRequest): Promise<MessagesPageResult>@paramprojectId
string@paramagentId
string@paramsessionId
string@paramreq
MessagesPageRequest@returns
Promise<MessagesPageResult>readHistoryWindow
readHistoryWindow(projectId: string, agentId: string, sessionId: string, req: MessagesPageRequest | { kind: "full" }): Promise<HistoryWindowRead>@paramprojectId
string@paramagentId
string@paramsessionId
string@paramreq
MessagesPageRequest | { kind: "full" }@returns
Promise<HistoryWindowRead>historyTraceFiles
historyTraceFiles(projectId: string, agentId: string, sessionId: string): Promise<HistoryTraceFile[]>@paramprojectId
string@paramagentId
string@paramsessionId
string@returns
Promise<HistoryTraceFile[]>forkSessionTrace
forkSessionTrace(projectId: string, agentId: string, sourceSessionId: string, position: TracePosition): Promise<ForkTraceResult>@paramprojectId
string@paramagentId
string@paramsourceSessionId
string@paramposition
TracePosition@returns
Promise<ForkTraceResult>contextBreakdown
contextBreakdown(projectId: string, agentId: string, sessionId: string): Promise<SessionContextParts>@paramprojectId
string@paramagentId
string@paramsessionId
string@returns
Promise<SessionContextParts>listTraceFiles
listTraceFiles(projectId: string, agentId: string, sessionId: string): Promise<TraceFileInfo[]>@paramprojectId
string@paramagentId
string@paramsessionId
string@returns
Promise<TraceFileInfo[]>readEvents
readEvents(projectId: string, agentId: string, sessionId: string, index: number, offset: number, limit: number): Promise<TraceEventsResponse>@paramprojectId
string@paramagentId
string@paramsessionId
string@paramindex
number@paramoffset
number@paramlimit
number@returns
Promise<TraceEventsResponse>readTraceImage
readTraceImage(projectId: string, agentId: string, sessionId: string, fileIndex: number, ordinal: number, slot: number | undefined): Promise<{ mime: string; bytes: Buffer }>@paramprojectId
string@paramagentId
string@paramsessionId
string@paramfileIndex
number@paramordinal
number@paramslot
number | undefined@returns
Promise<{ mime: string; bytes: Buffer }>analyze
analyze(projectId: string, agentId: string, sessionId: string, index: number): Promise<TraceAnalysisResponse>@paramprojectId
string@paramagentId
string@paramsessionId
string@paramindex
number@returns
Promise<TraceAnalysisResponse>analyzeRecords
analyzeRecords(projectId: string, messages: readonly AmspRecord[]): Promise<TraceAnalysisResponse>The same analysis of one Trace file's records read elsewhere — a machine's file from the
hub's copy (machines/history-routes.ts) — priced with projectId's rates.
@paramprojectId
string@parammessages
readonly AmspRecord[]@returns
Promise<TraceAnalysisResponse>agentTraces
agentTraces(projectId: string, agentId: string, paging: { offset: number; limit: number } | null, opts?: { category?: SessionCategory }): Promise<AgentTracesResponse>@paramprojectId
string@paramagentId
string@parampaging
{ offset: number; limit: number } | null@paramopts?
{ category?: SessionCategory }@returns
Promise<AgentTracesResponse>readFileRaw
readFileRaw(projectId: string, agentId: string, sessionId: string, index: number): Promise<Buffer<ArrayBufferLike>>@paramprojectId
string@paramagentId
string@paramsessionId
string@paramindex
number@returns
Promise<Buffer<ArrayBufferLike>>importTraceFile
importTraceFile(projectId: string, agentId: string, content: string): Promise<TraceImportResponse>@paramprojectId
string@paramagentId
string@paramcontent
string@returns
Promise<TraceImportResponse>importSessions
importSessions(projectId: string, agentId: string, sessions: readonly ImportedSession[]): Promise<{ imported: number; skipped: string[] }>@paramprojectId
string@paramagentId
string@paramsessions
readonly ImportedSession[]@returns
Promise<{ imported: number; skipped: string[] }>