declare const OPERATION_ERROR_CODES: readonly ["INPUT_INVALID", "OPERATION_NOT_FOUND", "OPERATION_VERSION_UNSUPPORTED", "PROFILE_NOT_FOUND", "PROFILE_POSTURE_NOT_ALLOWED", "PROFILE_OWNER_OPT_IN_REQUIRED", "SESSION_NOT_FOUND", "PERMISSION_HINT_INVALID", "DELEGATION_ARTIFACT_INVALID", "DELEGATION_EXPIRED", "DELEGATION_AUDIENCE_MISMATCH", "DELEGATION_HOST_MISMATCH", "DELEGATION_REJECTED", "ENCRYPTION_NETWORK_UNRESOLVED", "NODE_UNREACHABLE", "NODE_ERROR", "KV_NOT_FOUND", "KV_PRECONDITION_FAILED", "KV_CONFLICT", "KV_RESPONSE_TOO_LARGE", "SQL_QUERY_INVALID", "SQL_EXECUTION_FAILED", "SQL_RESULT_LIMIT_EXCEEDED", "SQL_VALUE_UNSAFE", "SECRET_READ_FAILED", "SECRET_DECRYPT_FAILED", "OUTPUT_INVALID", "INTERNAL_ERROR"];
type OperationErrorCode = (typeof OPERATION_ERROR_CODES)[number];
interface OperationError {
    readonly code: OperationErrorCode;
    readonly message: string;
    readonly retryable: boolean;
    readonly details?: Readonly<Record<string, unknown>>;
}

/** A stable, cross-surface operation identifier. */
type OperationId = string;
type TinyCloudPosture = "owner-openkey" | "delegate-session" | "local-owner-key" | "unauthenticated";
type OperationOperatorType = "human" | "agent";
/**
 * Safe identity reported with every result. This deliberately excludes keys,
 * tokens, delegations, grants, and operation inputs or outputs.
 */
interface OperationContextSummary {
    readonly profile: string;
    readonly host: string;
    readonly posture: TinyCloudPosture;
    readonly operatorType?: OperationOperatorType;
    readonly principalDid?: string;
    readonly sessionDid?: string;
    readonly ownerDid?: string;
    readonly space?: string;
}
/**
 * Capability details are finalized by the authority/artifacts increment. The
 * kernel intentionally preserves them as canonical operation-owned data.
 */
type CapabilityRequirement = Readonly<Record<string, unknown>>;
interface PermissionRequestArtifact {
    readonly requestId: string;
    readonly [key: string]: unknown;
}
interface ApprovalAction {
    readonly kind: "openkey";
    readonly requestId: string;
    readonly url?: string;
    readonly fallback: string;
}
interface SetupAction {
    readonly kind: string;
    readonly [key: string]: unknown;
}
interface OperationRef {
    readonly operationId: OperationId;
    readonly operationVersion: number;
}
interface RetryDescriptor extends OperationRef {
    readonly inputDigest: string;
    readonly safeInput?: Readonly<Record<string, unknown>>;
    readonly requiresCallerInput: boolean;
}
interface OperationOkResult<O> {
    readonly status: "ok";
    readonly operation: OperationRef;
    readonly context: OperationContextSummary;
    readonly output: O;
}
interface OperationAuthorityRequiredResult {
    readonly status: "authority_required";
    readonly operation: OperationRef;
    readonly context: OperationContextSummary;
    readonly missing: readonly CapabilityRequirement[];
    readonly request: PermissionRequestArtifact;
    readonly approval: ApprovalAction;
    readonly retry: RetryDescriptor;
}
interface OperationSetupRequiredResult {
    readonly status: "setup_required";
    readonly operation: OperationRef;
    readonly context: OperationContextSummary;
    readonly setup: SetupAction;
    readonly retry: RetryDescriptor;
}
interface OperationErrorResult {
    readonly status: "error";
    readonly operation: OperationRef;
    readonly context: OperationContextSummary;
    readonly error: OperationError;
}
type OperationResult<O> = OperationOkResult<O> | OperationAuthorityRequiredResult | OperationSetupRequiredResult | OperationErrorResult;
/**
 * The only caller-controlled invocation settings. `privateKey` is a CLI-only,
 * nonpersistable override; it is deliberately excluded from result metadata,
 * retry descriptors, diagnostics, and all state written by this package.
 */
interface InvocationTarget {
    readonly profile?: string;
    readonly host?: string;
    /**
     * Absolute home directory used for this invocation's TinyCloud profile
     * state. Hosted projections set this per authenticated principal so
     * concurrent tenants never share process-global TC_HOME state.
     */
    readonly stateRoot?: string;
    readonly allowOwnerProfile?: boolean;
    readonly privateKey?: string;
}

export type { InvocationTarget as I, OperationOperatorType as O, TinyCloudPosture as T, OperationResult as a, OperationContextSummary as b };
