@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
28 lines • 1.4 kB
JavaScript
/**
* The tool catalog a caller sees, in the form both placements must agree on: a hand (the loopless runtime)
* and the fused engine expose the same declarations, in the same order, for the same configuration. It holds
* every field that reaches the model (the declaration, the system-prompt snippet and guidelines), the UI
* (label) or another client (`getAllTools`: namespace, annotations, the projected kernel prelude). A tool's
* `permissionParser` is code, not data, and is compared by the tool that owns it.
*/
import { projectKernelPrelude } from "../../core/extensions/kernel-prelude.js";
import { normalizeToolExposure } from "../../core/extensions/types.js";
export function toolCatalog(tools) {
return Array.from(tools, (tool) => ({
name: tool.name,
label: tool.label,
description: tool.description,
parameters: tool.parameters,
promptSnippet: tool.promptSnippet,
promptGuidelines: tool.promptGuidelines,
kernelPrelude: projectKernelPrelude(tool.name, tool.kernelPrelude),
namespace: tool.namespace,
annotations: tool.annotations,
sessionBound: tool.sessionBound === true,
...normalizeToolExposure(tool),
}));
}
export function handToolCatalog(definitions) {
return toolCatalog(Array.from(definitions.values(), (entry) => entry.definition));
}
//# sourceMappingURL=tool-catalog.js.map