/** * Multi-host delegation gate SSOT — pending-delegations + spawn todo enforcement. * Grok / Hermes / OpenCode adapters call evaluatePreToolGate via delegation-gate-runtime. * Constitution (11/29/69/70 + destructive shell) lives here. Grok may still extra-block Codex 2/7. */ import { type PendingDelegation } from './pending-delegations.js'; export { getActivePendingDelegations } from './pending-delegations.js'; import { updatePlanTodoStatus, type SpawnToolInput } from './lead-dev-plan-persistence.js'; import { writeSuitSessionBoot, maybeHeatHostStation, type CeremonyLevel, type SpawnPlanMode, type SuitHost, type SuitProfile } from './suit-temperament.js'; export { writeSuitSessionBoot, maybeHeatHostStation }; export { extractSpawnCwd, validateAsideWorktreeCwd, provisionGitWorktree } from './aside-worktree.js'; export { validateSpawnMatchesTodo, updatePlanTodoStatus, savePersistedLeadDevPlan, archiveStaleLeadDevPlan, findRecentStalePlanArchive, } from './lead-dev-plan-persistence.js'; export { buildReceiptFromConsultOutput, hasValidSynthesisConsultReceipt, isSynthesisConsultTodoId, loadSynthesisConsultReceipt, parseConsultVerdictFromText, tryRecordSynthesisConsultReceipt, writeSynthesisConsultReceipt, type SynthesisConsultReceipt, type SynthesisConsultVerdict, } from './synthesis-consult-receipt.js'; export declare const updatePlanTodoStatusInPlace: typeof updatePlanTodoStatus; export type DelegationGateHost = SuitHost; export interface DelegationGateFeatures { lead_dev_mode: boolean; auto_chain_delegations: boolean; /** v3 — deny (guided/strict), warn (frontier), off */ spawn_plan_mode?: SpawnPlanMode; ceremony?: CeremonyLevel; suit_profile?: SuitProfile; no_new_surface?: boolean; } export interface ToolGateInput { prompt?: string; description?: string; task?: string; subagent_type?: string; agent?: string; delegationId?: string; delegation_id?: string; planTodoId?: string; command?: string; path?: string; file_path?: string; filePath?: string; toolName?: string; tool?: string; name?: string; server?: string; mcpServer?: string; arguments?: Record; args?: Record; [key: string]: unknown; } export interface PreToolGateContext { projectRoot: string; sessionId: string | null; features: DelegationGateFeatures; host?: DelegationGateHost; hookEvent?: string; } export interface PreToolGateDeny { allow: false; reason: string; gate: string; hint?: Record; pendingCount?: number; delegationId?: string; } export interface PreToolGateAllow { allow: true; reason?: string; gate?: string; hint?: Record; } export type PreToolGateResult = PreToolGateAllow | PreToolGateDeny; export interface PostToolSpawnResult { satisfied: PendingDelegation[]; clearedAll: boolean; expectedTodoId?: string | null; receiptRecorded?: boolean; todoCompleted?: boolean; } export interface PostToolSpawnOptions { toolOutput?: unknown; sessionId?: string | null; } export declare function loadDelegationGateFeatures(projectRoot?: string, host?: DelegationGateHost): DelegationGateFeatures; export declare function normalizeHostToolInput(toolInput: ToolGateInput): SpawnToolInput & { command?: string; }; export declare function isSubagentTool(toolName: string): boolean; export declare function isShellTool(toolName: string): boolean; export declare function isWriteTool(toolName: string, host?: DelegationGateHost): boolean; export declare function isReadOnlyTool(toolName: string): boolean; /** Spawn plan missing — applies before auto_chain opt-out for subagent tools. */ export declare function evaluateSpawnPlanGate(toolName: string, toolInput: ToolGateInput, ctx: PreToolGateContext): PreToolGateResult; /** Block writes / spawns / shell while synthesis checkpoint is due. */ export declare function evaluateSynthesisGate(toolName: string, toolInput: ToolGateInput, ctx: PreToolGateContext): PreToolGateResult; /** Block writes / unrelated work while pending delegations exist. */ export declare function evaluatePendingDelegationGate(toolName: string, toolInput: ToolGateInput, ctx: PreToolGateContext): PreToolGateResult; /** Codex 11 / 29 / 69 / 70 + destructive shell — always on, all hosts that call this SSOT. */ export declare function evaluateConstitutionGate(toolName: string, toolInput: ToolGateInput, ctx: PreToolGateContext): PreToolGateResult; export declare function evaluatePreToolGate(toolName: string, toolInput: ToolGateInput, ctx: PreToolGateContext): PreToolGateResult; export declare function evaluatePostToolSpawn(toolName: string, toolInput: ToolGateInput, projectRoot: string, options?: PostToolSpawnOptions): PostToolSpawnResult; export declare function isOrchestrateToolEvent(toolName: string, toolInput?: ToolGateInput): boolean; /** Back-compat shims for Grok hook-utils and tests. */ export declare function checkPendingDelegationGate(toolName: string, toolInput: ToolGateInput, features: DelegationGateFeatures, projectRoot: string, sessionId: string | null): PreToolGateDeny | null; export declare function checkSubagentGate(toolName: string, features: DelegationGateFeatures, projectRoot: string, sessionId: string | null, toolInput?: ToolGateInput): PreToolGateDeny | null; export declare function satisfyDelegationsFromToolInput(toolInput: ToolGateInput, projectRoot: string): { satisfied: PendingDelegation[]; clearedAll: boolean; };