@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
27 lines • 1.2 kB
JavaScript
import { requestId } from "./delegation-wire.js";
import { classifyRpcMethod, RPC_METHOD_CLASS, RPC_METHOD_CLASSES_DIGEST, RPC_METHOD_CLASSES_VERSION, } from "./method-classes.js";
export const CLASSIFY_RECORD_COMMAND = "classify_record";
export function classifyRecord(record) {
const id = requestId(record);
const target = Reflect.get(record, "record");
const methodClass = classifyRpcMethod(target);
const type = typeof target === "object" && target !== null ? Reflect.get(target, "type") : undefined;
const entry = methodClass !== undefined && typeof type === "string" ? RPC_METHOD_CLASS[type] : undefined;
return {
...(id === undefined ? {} : { id }),
type: "response",
command: CLASSIFY_RECORD_COMMAND,
success: true,
data: {
class: methodClass ?? null,
version: RPC_METHOD_CLASSES_VERSION,
digest: RPC_METHOD_CLASSES_DIGEST,
...(entry === undefined
? {}
: typeof entry === "string"
? { static: true }
: { static: false, rule: entry.version }),
},
};
}
//# sourceMappingURL=delegation-classify.js.map