@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
46 lines • 3.05 kB
TypeScript
import type { Context, Tool } from "@earendil-works/pi-ai";
import type { Options } from "./sdk-boundary.ts";
export declare const SDK_TO_PI_TOOL_NAME: Readonly<Record<string, string>>;
/**
* Senpi tools served to Claude Code as its built-ins. `write` and `edit` are deliberately absent:
* Claude Code runs its own read-before-write validator on built-in Write/Edit BEFORE any
* PreToolUse hook, and its read state is always empty here (senpi denies the SDK's Read), so the
* SDK answered those calls itself while senpi still executed them (#2401). They go through the
* custom-tools MCP server instead, where the host denial always answers and senpi alone executes.
*/
export declare const PI_TO_SDK_TOOL_NAME: Readonly<Record<string, string>>;
/**
* Versioned host-tool denial policy. `configFingerprint` in session-sync.ts hashes this as
* `hostToolPolicy` into `toolsetHash`; a mismatch is `toolset_changed` and retires the live
* resident query (reattach with the current hooks). The same hash is persisted in the
* restart sidecar, so the first admission after an upgrade also reattaches with
* `toolset_changed` - the resumed query carries the current hooks, so the pre-bump
* denial text is never served again. Bump when denial copy or hooks change so
* wording-only edits cannot keep serving the old reason.
*/
export declare const HOST_TOOL_POLICY_FINGERPRINT = "host-tool-denial-v4";
export declare const BUILTIN_SDK_TOOLS: readonly ["Read", "Bash", "Grep", "Glob"];
/**
* The reason the host deny hook gives. Claude Code itself labels every PreToolUse deny as
* "PreToolUse:<Tool> hook error: <reason>" with is_error true, and that label cannot be changed, so the
* reason has to say first that it is the expected handoff and must not be reported (senpi#3417).
*/
export declare const TOOL_EXECUTION_DENIED_MESSAGE: string;
export declare const HOST_TOOL_EXECUTION_DENIED_MESSAGE: string;
export declare const CUSTOM_TOOLS_MCP_SERVER_NAME = "custom-tools";
export declare const CUSTOM_TOOLS_MCP_PREFIX = "mcp__custom-tools__";
export declare const HOST_CAPTURED_SDK_TOOL_MATCHER = "Bash|Write|Edit|Read|Grep|Glob|mcp__custom-tools__.*";
export declare const HOST_TOOL_DENIAL_HOOKS: NonNullable<Options["hooks"]>;
export type ResolvedSdkTools = {
sdkTools: string[];
customTools: Tool[];
customToolNameToSdk: Map<string, string>;
customToolNameToPi: Map<string, string>;
};
export declare function mapPiToolNameToSdk(name: string, customToolNameToSdk?: ReadonlyMap<string, string>): string;
export declare function mapSdkToolNameToPi(name: string, customToolNameToPi?: ReadonlyMap<string, string>): string;
/** Translate Claude Code's built-in-tool inputs into senpi's active tool schemas. */
export declare function mapToolArgs(toolName: string, args: Readonly<Record<string, unknown>> | undefined): Record<string, unknown>;
export declare function resolveSdkTools(context: Context): ResolvedSdkTools;
export declare const canUseTool: NonNullable<Options["canUseTool"]>;
//# sourceMappingURL=tools.d.ts.map