UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

30 lines • 1.66 kB
import { CALL_UNKNOWN } from "./compact-call-model.js"; /** RULING-123 (#5346): the execution and hook records whose compact copy names the call they belong to. */ export const CALL_NAMED_RECORDS = new Set([ "tool_execution_start", "tool_execution_update", "tool_execution_end", "tool_hook_status", ]); const streamEvent = (record) => Object(Reflect.get(record, "assistantMessageEvent")); /** A `toolcall_start`, `toolcall_delta` or `toolcall_end` update: it streams one call's block of its message. */ function streamsCall(record) { const kind = Reflect.get(streamEvent(record), "type"); return Reflect.get(record, "type") === "message_update" && typeof kind === "string" && kind.startsWith("toolcall_"); } /** The content index of the block a `toolcall_*` update streams; undefined for every other record. */ export function toolcallIndex(record) { const index = Reflect.get(streamEvent(record), "contentIndex"); return streamsCall(record) && typeof index === "number" ? index : undefined; } /** * What a compact peer's copy of `record` says when the lane holds no identity for it. A live call record the host * changed no call with (ignored as unknown or late, refused at the protocol depth limit, or arriving while the compact * state is unavailable) says `callUnknown` rather than omitting the key (RULING-123 (7), RULING-122's fail-safe rule); * every other record says nothing. */ export function unvouchedCall(record) { const named = CALL_NAMED_RECORDS.has(String(Reflect.get(record, "type"))); return named || streamsCall(record) ? CALL_UNKNOWN : undefined; } //# sourceMappingURL=compact-call-identity.js.map