import type { Api, Model } from "@caupulican/pi-ai"; import type { CapabilityEnvelope } from "../autonomy/contracts.ts"; import type { ModelRegistry } from "../model-registry.ts"; import { type OrchestrationModelBinding, type OrchestrationThinkingLevel } from "../orchestration/contracts.ts"; import type { WorkerDelegationAuthorityRequest } from "./worker-delegation-request.ts"; import type { ResolvedWorkerProfile } from "./worker-profile-resolver.ts"; /** * Smallest token grant a worker can survive on. A worker's first response pays the full * uncached system prompt (~3.3k budgeted tokens in the field), so grants below this floor * starve mid-flight with every tool call denied `token_budget_exhausted` — reject them at * admission with an explicit reason instead (field session 019fd4dc: 8-9k grants died in * 2-3 responses under face-value cache-read counting; the floor plus discounted counting * makes small grants viable again). */ export declare const MIN_VIABLE_WORKER_TOKEN_BUDGET = 5000; export interface WorkerAuthorityResolutionInput { authority?: WorkerDelegationAuthorityRequest; base?: ResolvedWorkerProfile; modelPin?: OrchestrationModelBinding; foregroundModel?: Model; foregroundThinkingLevel?: OrchestrationThinkingLevel; foregroundToolNames?: readonly string[]; foregroundEnvelope?: CapabilityEnvelope; cwd?: string; modelRegistry: ModelRegistry; isModelExhausted(model: Model): boolean; } export type WorkerAuthorityResolution = { ok: true; shipment: ResolvedWorkerProfile; } | { ok: false; reason: string; }; /** * Bind a compiled implementation profile to the compiled verifier identity it will persist. * Verifier admission can legitimately derive a new immutable profile id (for example when the * host forces a legacy delegation-capable preset to the leaf contract), so retaining the * configured source id would make the execution contract internally inconsistent. Rebinding changes compiled * content and therefore derives a fresh implementation identity as well. */ export declare function bindCompiledVerifierIdentity(shipment: ResolvedWorkerProfile, verifierProfileId: string): ResolvedWorkerProfile; /** Bind the immutable profile snapshot to the exact native tools its host plan materialized. */ export declare function bindCompiledToolSurface(shipment: ResolvedWorkerProfile, toolNames: readonly string[]): ResolvedWorkerProfile; /** Materialize free-form model choices as one immutable profile-shaped execution snapshot. */ export declare function resolveWorkerAuthority(input: WorkerAuthorityResolutionInput): WorkerAuthorityResolution; //# sourceMappingURL=worker-authority-resolver.d.ts.map