import type { BackendConfig, PromptOptions, PromptResult } from "@tangle-network/sandbox"; import type { AgentTurnInput, AgentTurnResult } from "@tangle-network/agent-interface/environment-provider"; import type { AgentExactRunControlRef, InputPart } from "@tangle-network/agent-interface"; export declare function promptFromTurnInput(input: AgentTurnInput): string | InputPart[]; export declare function executionIdFromTurnInput(input: AgentTurnInput): string | undefined; export declare function promptOptionsFromTurnInput(input: AgentTurnInput, target: { provider: string; environmentId: string; sessionId?: string; }): PromptOptions; /** * The `BackendConfig` fields the Sandbox prompt options declare. * * A turn may carry any of them and nothing else. An undeclared field is * refused instead of forwarded, because the SDK drops what it does not * declare: the turn would then run on different settings with no error * anywhere, which is the silent substitution the SDK's own `model` field * exists to prevent. */ declare const SANDBOX_BACKEND_FIELD_LIST: readonly ["runtimeAttachments", "type", "profile", "model", "server", "interactions", "metadata"]; /** * The `BackendConfig["model"]` fields the Sandbox prompt options declare. * * This is the block that carries per-turn credentials — `authMode: "oauth"` * with `authFiles` for a subscription seat — so it is checked field by field * rather than passed through as opaque JSON. */ declare const SANDBOX_BACKEND_MODEL_FIELD_LIST: readonly ["provider", "model", "apiKey", "baseUrl", "maxThinkingTokens", "mode", "apiKeyEnv", "authMode", "authFiles"]; /** * The two lists above are the SDK's field sets, restated as values because a * TypeScript type cannot be read at run time. This pin keeps them exact in * both directions: a field the SDK adds, renames, or removes fails the build * here rather than reaching a caller as a wrong refusal or a silent drop. */ type Exhaustive = T; type SandboxBackendModel = NonNullable; type UncoveredBackendField = Exhaustive>; type StaleBackendField = Exhaustive>; type UncoveredBackendModelField = Exhaustive>; type StaleBackendModelField = Exhaustive>; declare const SANDBOX_AUTH_FILE_FIELD_LIST: readonly ["path", "content", "mode"]; type SandboxAuthFile = NonNullable[number]; type UncoveredAuthFileField = Exhaustive>; type StaleAuthFileField = Exhaustive>; type SandboxBackendFieldCoverage = [ UncoveredBackendField, StaleBackendField, UncoveredBackendModelField, StaleBackendModelField, UncoveredAuthFileField, StaleAuthFileField ]; export type { SandboxBackendFieldCoverage }; type SandboxPromptBackend = NonNullable; /** * Read the per-turn backend options a caller sent through `providerOptions`. * * `AgentTurnInput.providerOptions.backend` is the exact shape agent-runtime * emits for a per-turn backend or model override, so refusing it dropped the * caller's model, profile, and session credential bundle at the adapter * boundary. Every field is checked against what the Sandbox prompt options * declare, and the result is bounded JSON the SDK reads once. */ export declare function backendFromTurnProviderOptions(providerOptions: Record | undefined): SandboxPromptBackend | undefined; /** * The part of the backend options that decides which work a turn is. * * Bearer material is deliberately absent. A rotated seat token is the same * seat running the same work, so digesting the token bytes would make an * ordinary refresh conflict with the run it is continuing. The auth files are * reduced to the paths and modes they install, which states that the turn * carries a credential bundle and which slots it fills, without binding the * identity to the secret inside. */ export declare function backendRequestIdentity(backend: SandboxPromptBackend | undefined): Record | undefined; type SandboxRunStatus = "success" | "failed" | "blocked_on_approval" | "awaiting_question" | "awaiting_interaction" | "awaiting_plan_decision"; type ValidatedSandboxPromptResult = Record & { success: boolean; status: SandboxRunStatus; durationMs: number; executionId?: string; }; /** * The marker left in place of a tool result's discarded tail. * * It names the byte counts so a reader can tell a truncated result from a tool that genuinely * returned little, and so a caller can decide to re-fetch rather than reason from a partial page. */ export declare function toolOutputTruncationMarker(keptBytes: number, originalBytes: number): string; export declare function validatedSandboxPromptResult(result: PromptResult): ValidatedSandboxPromptResult; export declare function agentTurnResultFromPromptRecord(record: ValidatedSandboxPromptResult, options?: { contextTransferRequested?: boolean; contextTransferRequest?: import("@tangle-network/agent-interface").ContextTransferRequest; sessionId?: string; controlRef?: AgentExactRunControlRef; }): AgentTurnResult;