/** * #553: approvals mono-agent resolves wait inline for the verdict. * * An org's `autonomy` block is mono-agent's display copy of its enforced * settings (mono-agent internal/orgdecide/reconcile.go:17-78). mono-agent's * decision service polls monomind every 15s (service.go:106), routes each * pending approval by level × tier to a rule, a decider or a person * (route.go:118-138), and resolves the first two over /api/set-approval. * checkApproval only ever answered "pending", so the role's call was denied * as "pending human approval" and the role had to retry once mono-agent had * approved it. * * awaitApproval queues the request as before and, when the org's autonomy * routes it to a rule or a decider, holds the call until it is resolved or * the bounded wait runs out. A request routed to a person — and any org whose * autonomy block is missing, paused or not understood — returns at once. * * Known gap: `monoagentcli org autonomy pause` writes only mono-agent's DB * (cmd/monoagentcli/org_autonomy.go:319-384, PausedUntil), not the display * copy, so monomind cannot see a pause today and waits (up to the bound) * while mono-agent routes to a person. `paused_until` (ISO date) and * `paused: true` in the display copy are honoured for when it does. */ import type { OrgDaemon } from './daemon.js'; /** mono-agent's decider timeout when none is set (orgdecide/store.go:29). */ export declare const DECIDER_TIMEOUT_DEFAULT_S = 120; /** Slack on top of the decider timeout: up to one 15s poll tick before * mono-agent sees the request, plus the 10s it adds to the decider call * (service.go:106, 390). */ export declare const DECIDER_WAIT_SLACK_S = 25; /** Upper bound on the inline wait. Claude's PreToolUse hook lets a call * PROCEED when the hook times out (POLICY_HOOK_TIMEOUT_S, 600s), so the * wait stays well below that. */ export declare const DECIDER_WAIT_MAX_S = 300; type Tier = 'routine' | 'consequential' | 'irreversible'; /** Port of mono-agent ClassForAction (internal/orgdecide/route.go:42-54). */ export declare function classForAction(action: string): string; /** Port of mono-agent TierFor (route.go:74-107): exact override, then the * tool:* / grant:* wildcard, then the default; unclassified is irreversible. * Two facts mono-agent reads from its DB are not visible here: * - A grant's own tier. mono-agent stores it only in its DB (the GrantSpec * display copy in the org file has no tier) and gives a grant with no * outbound workflow nodes `consequential` (orggrant/outbound.go:60-65). * Here a grant with no grant: / grant:* override is irreversible, * so at mid such a call is treated as human-owned and denied as pending * at once, as before #553, while mono-agent actually routes it to the * decider — a missed wait, not a safety issue. At full both route to the * decider, so the ownership matches. * - RoleHasGrantsAndBash, which only moves tool:Bash from routine to * consequential — both routed away from a person at mid and full, so the * ownership below is the same either way. */ export declare function tierFor(cls: string, overrides: Record): Tier; /** Port of mono-agent Route (route.go:118-138). */ export declare function routeFor(level: string, tier: Tier): 'rule' | 'decider' | 'human'; export type ApprovalOwnership = { owner: 'human'; } | { owner: 'decider'; decider: string; waitMs: number; }; /** What the approval gate returns: the verdict plus who owns the request. * `approved: null` means still pending (a human request, or an automated * one not resolved within `waitedMs`). */ export interface ApprovalVerdict { approved: boolean | null; owner: 'human' | 'decider'; /** Who resolves it, e.g. `decider model claude-opus` or `rule (routine at full)`. */ decider?: string; /** Who resolved it (resolvedBy), when resolved. */ resolvedBy?: string; /** How long the call waited, when it waited. */ waitedMs?: number; /** The org stopped or the role closed while the call waited. */ cancelled?: boolean; } /** Who resolves an approval of `action` under this autonomy block. Anything * missing, paused, unknown or malformed is human-owned (no wait). */ export declare function approvalOwnership(autonomy: unknown, action: string, now?: number): ApprovalOwnership; /** The org file's autonomy block, read fresh (cached by mtime and size) so a * level change made while the org runs is seen on the next check. Undefined * when the file is missing or unparseable. */ export declare function readOrgAutonomy(root: string, org: string): unknown; /** checkApproval, plus the #553 inline wait for a request mono-agent owns. */ export declare function awaitApproval(daemon: OrgDaemon, org: string, role: string, action: string, input?: Record): Promise; export {}; //# sourceMappingURL=approval-decider.d.ts.map