/** * Pure force-policy for Pi subagent-first (TOOLING-002L / pi-force-subagent). * No I/O. Used by unit tests and by `.pi/extensions/aiws.ts` (copy or import). */ /** Approved inline escape-hatch phrases (current user message only). */ export declare const HATCH_PHRASES: readonly ["直接改", "do it inline", "你直接改", "别派 sub-agent", "main session 写就行", "不用 sub-agent", "no sub-agent"]; /** Allowed Agent subagent_type values for implement/review dispatch. */ export declare const ALLOWED_SUBAGENT_TYPES: readonly ["aiws-worker", "aiws-reviewer"]; export type AllowedSubagentType = (typeof ALLOWED_SUBAGENT_TYPES)[number]; /** Tool names treated as mutating writes when deny is active. */ export declare const DENIED_WRITE_TOOLS: readonly ["write", "edit", "Write", "Edit"]; /** * Path prefixes (posix-style, relative to project root) allowed for main-session * writes without hatch. Match is prefix after normalize (no leading ./). */ export declare const MAIN_WRITE_ALLOW_PREFIXES: readonly [".aiws/changes/", ".aiws/plan/", ".aiws/goals/"]; export type PolicyDecision = { allow: true; reason: string; } | { allow: false; reason: string; code: string; }; /** * Detect hatch in the **current** user message only (caller must pass only that text). */ export declare function detectHatch(currentUserMessage: string | null | undefined): boolean; /** * Normalize a path for allowlist checks: backslash→slash, strip leading ./ and / */ export declare function normalizeRelPath(filePath: string): string; /** * Whether a write target is on the main-session governance allowlist (no hatch required). */ export declare function isMainWriteAllowlisted(filePath: string): boolean; /** * Decide if main session may invoke a write-like tool for path. */ export declare function decideMainWrite(opts: { toolName: string; filePath?: string | null; hatchActive: boolean; }): PolicyDecision; /** * Whitelist subagent types for implement/review. Unknown types must not fall through * to a non-whitelisted type silently (dispatch layer rejects, no fallback). */ export declare function decideAgentType(subagentType: string | null | undefined): PolicyDecision; /** * Text for session_start system prompt injection. */ export declare function buildForcePolicyPromptBlock(): string; /** * Deprecation message when aiws_subagent is invoked. */ export declare function aiwsSubagentDeprecationMessage(prompt: string): string; /** * Suggested content for evidence/delegate-failure.md */ export declare function formatDelegateFailureEvidence(opts: { changeId?: string; error: string; attemptedType?: string; at?: string; }): string;