MCPcopy Create free account
hub / github.com/apache/maka / classifyTerminalRuntimeLedger

Function classifyTerminalRuntimeLedger

packages/runtime/src/terminal-run-commit.ts:40–61  ·  view source on GitHub ↗
(
  run: AgentRunHeader,
  events: readonly RuntimeEvent[],
)

Source from the content-addressed store, hash-verified

38 };
39
40export function classifyTerminalRuntimeLedger(
41 run: AgentRunHeader,
42 events: readonly RuntimeEvent[],
43): TerminalRuntimeLedgerClassification {
44 const terminalEvents = matchingTerminalRuntimeEvents(run, events);
45 if (terminalEvents.length === 0) {
46 return { kind: 'none', terminalEvents };
47 }
48 if (terminalEvents.length > 1) {
49 return { kind: 'ambiguous', terminalEvents };
50 }
51
52 const fact = classifyRuntimeEventTerminalFact(run, events).fact;
53 if (fact) {
54 return { kind: 'fact', fact, terminalEvents };
55 }
56 return {
57 kind: 'incomplete_single_terminal',
58 terminalEvent: terminalEvents[0]!,
59 terminalEvents,
60 };
61}
62
63export interface CommitTerminalRunWithRuntimeFactInput {
64 runStore: AgentRunStore;

Tested by 1

readTurnMethod · 0.72