import type { Backend } from '../../agent-adapter/types.js'; import type { IdentityJsonValue, RoleToolSurfaceInput } from '../agent-run/identity.js'; import type { ResolvedAgentRunRole } from '../agent-run/run-config.js'; import type { ArmDefinition, ArmLimits } from './arm-schema.js'; import type { BenchmarkBrokerCapability } from './capabilities.js'; declare const FAILURE_ROWS: readonly [readonly [1, "arm_schema_invalid"], readonly [2, "arm_field_conflict"], readonly [3, "coder_review_variant_invalid"], readonly [4, "ask_manager_unsupported_mode"], readonly [5, "limit_out_of_range"], readonly [6, "deadline_nonpositive"], readonly [7, "capacity_rule_violated"], readonly [8, "credential_capability_unknown"], readonly [9, "credential_capability_unsupported"], readonly [10, "credential_capability_state_insufficient"], readonly [11, "profile_unresolvable"], readonly [12, "profile_has_fallbacks"], readonly [13, "profile_extra_option_unsupported"], readonly [14, "backend_unsupported_for_kind"], readonly [15, "asset_missing"], readonly [16, "asset_unreadable"], readonly [17, "asset_hash_mismatch"], readonly [18, "duplicate_skill_name"], readonly [19, "mcp_composition_invalid"], readonly [20, "template_not_whitelisted"], readonly [21, "image_digest_unpinned"], readonly [22, "policy_freeze_failed"], readonly [23, "policy_reresolution_attempted"], readonly [24, "coordinator_start_failed"], readonly [25, "parent_detached"], readonly [26, "finalization_incomplete"], readonly [27, "sidecar_unauthenticated"], readonly [28, "backend_lacks_long_mcp_call"], readonly [29, "cli_version_unsupported_for_long_mcp_call"], readonly [30, "policy_guard_absent"], readonly [31, "runtime_port_unbound"], readonly [32, "port_scope_escaped"], readonly [33, "capability_denied"], readonly [34, "stale_generation"], readonly [35, "cross_branch_mutation"], readonly [36, "out_of_trial_path"], readonly [37, "proposal_invalidated"], readonly [38, "seal_precondition_unmet"], readonly [39, "attempt_unaccounted"], readonly [40, "composite_manifest_invalid"], readonly [41, "terminal_predicate_unmet"], readonly [42, "ledger_unreadable"], readonly [43, "arm_profile_value_mismatch"], readonly [44, "run_config_schema_unknown"]]; export type BenchmarkFailureReason = typeof FAILURE_ROWS[number][1]; export type BenchmarkFailureClass = 'P' | 'R'; export interface BenchmarkFailureSpec { code: number; reason: BenchmarkFailureReason; failureClass: BenchmarkFailureClass; } export declare const BENCHMARK_FAILURES: readonly BenchmarkFailureSpec[]; export declare const BENCHMARK_FAILURE_INVARIANTS: Readonly<{ P: readonly string[]; R: readonly string[]; }>; export interface FailureStderr { write(chunk: string): unknown; } export declare class PolicyCompilationError extends Error { readonly reason: BenchmarkFailureReason; readonly payload?: Readonly>; readonly code: number; readonly failureClass: BenchmarkFailureClass; constructor(reason: BenchmarkFailureReason, detail?: string, payload?: Readonly>); record(): Record; } export declare function reportBenchmarkFailure(error: PolicyCompilationError, stderr?: FailureStderr): void; export type AssetKind = 'arm' | 'credential_capability' | 'profile' | 'cli_artifact' | 'provider_route' | 'prompt' | 'tool_set' | 'plugin_dir' | 'skill' | 'mcp_server' | 'thread_template' | 'thread_agent' | 'limits'; export interface PolicyAssetInventoryEntry { ordinal: number; kind: AssetKind; logical_name: string; resolved_path: string; content_sha256: string; } export interface ResolvedPolicyModelExecution { backend: Backend; requested_model: string; model_alias_policy: IdentityJsonValue; provider_protocol: string | null; configured_route_base_host: string | null; claude_cli_version: string | null; cli_name: Backend | null; cli_version: string | null; reasoning_effort: string | null; fallback_empty: true; } export type CredentialCapabilityState = 'unsupported' | 'offline-contract-passed' | 'live-handshake-passed'; export interface ResolvedTrialPolicy { schema_version: 'cortex-benchmark-resolved-policy/2'; arm: ArmDefinition; arm_canonical_sha256: string; trial_id: string; root_run_id: string; task: { task_id: string; image_ref: string; image_digest: string; }; deadline: { compiled_at_epoch_ms: number; absolute_epoch_ms: number; monotonic_origin_ns: bigint; }; asset_inventory: PolicyAssetInventoryEntry[]; asset_inventory_sha256: string; model_execution: ResolvedPolicyModelExecution; roles: Record; /** Compiled benchmark policy guard per slot. A slot without a guard has no key. */ role_policy_guard: Record; /** Gate condition for constructing a PI trial adapter; false refuses the arm at construction. */ pi_benchmark_capability_proven: boolean; identity: { model_execution_identity_hash: Record; role_tool_surface_hash: Record; bundle_manifest_hash: string; }; child_template_whitelist: string[]; capability_whitelist: BenchmarkBrokerCapability[]; credential: { capability_key: string; capability_state: CredentialCapabilityState; upstream_base_url: string; route_identity_host: string; proxy_base_url: string; dummy_token_ref: string; }; limits: ArmLimits; derived: { effective_admission_budget: number; }; artifact_inventory_spec: IdentityJsonValue; } /** * The role surface the phase-B compiler hashed for a slot, read back out of the frozen policy. The * compiler's own `roleSurface` is not exported and its working value is gone by the time a thread * runs, so this reconstructs the same members from what the policy publishes: the prompt and * directive digests and the plugin and skill content hashes from the asset inventory, and the tool * list, MCP composition and the hard-coded empty hook policy from the resolved role. The compiled * guard is deliberately NOT included — a caller that wants the full eight-member surface adds * `role_policy_guard[slot]`, which is the difference between the two byte sources. * Returns null for a slot the policy does not compile. */ export declare function compiledRoleSurface(policy: ResolvedTrialPolicy, slot: string): RoleToolSurfaceInput | null; export declare function deepFreezePolicy(policy: ResolvedTrialPolicy): ResolvedTrialPolicy; export declare function remainingDeadlineMs(policy: ResolvedTrialPolicy, monotonicNowNs: bigint): number; export {};