@phren/cli
Version:
Knowledge layer for AI agents - CLI, MCP server, and data layer
34 lines (33 loc) • 1.78 kB
TypeScript
/** Whose input a Claude row or callback is. */
export type InputCategory = "owner" | "notification" | "internal";
/** A category and a short, payload-free reason for it. */
export interface InputClassification {
category: InputCategory;
reason: string;
}
/** The facts a caller can supply. Absent facts are simply not evidence. */
export interface InputFacts {
text?: unknown;
hasImage?: boolean;
origin?: unknown;
commandMode?: unknown;
isMeta?: unknown;
isSidechain?: unknown;
isCompactSummary?: unknown;
/** The row's user content is only tool_result blocks. */
toolResult?: unknown;
/** The input arrived through the harness's notification delivery path
* (Claude's queued_command attachment, for example). */
notificationDelivery?: unknown;
}
/** A leading Claude envelope that says the input is the harness's own. Self-contained: hook-fast.ts
* embeds this function into the small forwarder, so it must not read module scope. */
export declare function classifyClaudePromptText(text: unknown): InputClassification;
/** Classify a Claude input from every fact a caller has. Provenance comes first, then row shape,
* then the leading text; ordinary prose that happens to name a tag stays the owner's. */
export declare function classifyClaudeInput(facts: InputFacts): InputClassification;
/** The validated category a callback may carry, or undefined for anything else. */
export declare function parseInputCategory(value: unknown): InputCategory | undefined;
/** Bounded payload facts shared by the generated and full forwarders. Keep
* self-contained: the fast script embeds it without importing the bundle. */
export declare function claudeCallbackFacts(value: Record<string, unknown>): Record<string, unknown>;