@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
22 lines • 1.19 kB
JavaScript
import { splitModelOnlyNotices } from "../output-format.js";
/**
* Resolve a stable "mon_" monitor id to its current runtime id (bash_N/watch_N), passing a
* runtime id through unchanged. Companion tools may run against a manager that does not
* implement `resolveId` (narrower embedder/test managers expose `get` only); such managers
* have never seen a `mon_` id, so falling back to the id verbatim preserves the lookup they
* already supported. This is the single choke point for that rule — do not inline it.
*/
export function resolveTerminalId(manager, id) {
return manager.resolveId?.(id) ?? id;
}
export function textResult(text, extra) {
return { content: [{ type: "text", text }], details: extra?.details, isError: extra?.isError };
}
export function errorResult(text) {
return { content: [{ type: "text", text }], details: undefined, isError: true };
}
/** A result whose truncation/drop notices are model-only parts (see `splitModelOnlyNotices`). */
export function noticedResult(text, notices, extra) {
return { content: splitModelOnlyNotices(text, notices), details: extra?.details, isError: extra?.isError };
}
//# sourceMappingURL=context.js.map