/**
 * Worker utilities — standalone helper functions used by SubAgentRuntime,
 * WorktreeSession, and other phantom modules.
 */
import type { SkillArtifact, SkillBinding } from '../../engines/skill-runtime.js';
import type { WorkflowArtifact } from '../../engines/workflow-runtime.js';
import type { HookArtifact } from '../../engines/hook-runtime.js';
import type { AutomationArtifact } from '../../engines/automation-runtime.js';
import type { FileRef } from '../../engines/token-supremacy.js';
import type { MemoryBackend } from '../../engines/runtime-backends.js';
/** Low-level record returned by every shell command invocation. */
export interface CommandRecord {
    command: string;
    cwd: string;
    exitCode: number;
    stdout: string;
    stderr: string;
}
/** Shell-safe single-quote wrapper. */
export declare function quote(value: string): string;
/**
 * Run a shell command in the given cwd. Returns a CommandRecord on success.
 * Throws (or returns the record with exitCode≠0) when allowFailure is false.
 */
export declare function runCommand(cwd: string, command: string, allowFailure?: boolean, timeoutMs?: number): Promise<CommandRecord>;
/** Converts an absolute path to a path relative to root; returns original if it escapes root. */
export declare function relativeTo(root: string, target: string): string;
/** Sanitise an arbitrary string into a safe filename component (≤60 chars). */
export declare function sanitizeFileName(value: string): string;
/**
 * Walk the repo for source/test files using git ls-files (with a filesystem
 * fallback). Returns FileRef[] with path, sizeBytes, and lastModified.
 */
export declare function scanFiles(repoRoot: string): Promise<FileRef[]>;
/** Type guard: true if value is a MemoryBackend (has descriptor property). */
export declare function isMemoryBackend(value: unknown): value is MemoryBackend;
export declare function dedupeStrings(values: string[]): string[];
export declare function dedupeSkillArtifacts(values: SkillArtifact[]): SkillArtifact[];
export declare function dedupeWorkflowArtifacts(values: WorkflowArtifact[]): WorkflowArtifact[];
export declare function dedupeHookArtifacts(values: HookArtifact[]): HookArtifact[];
export declare function dedupeAutomationArtifacts(values: AutomationArtifact[]): AutomationArtifact[];
/**
 * Intersect allowedTools with defaults. Falls back to defaults when
 * allowedTools is empty or produces no valid intersection.
 */
export declare function scopedTools(allowedTools: string[] | undefined, defaults: string[]): string[];
/** Filter bindings to only those whose type is in allowedTools. */
export declare function filterBindingsByTools(bindings: SkillBinding[], allowedTools: string[]): SkillBinding[];
/** Rough token count estimator — 1 token ≈ 4 chars of text / JSON. */
export declare function estimateTokenCount(value: unknown): number;
/**
 * Extract the 13-digit millisecond timestamp embedded in a runId.
 * Returns 0 if no match is found.
 */
export declare function extractRunTimestamp(run: {
    runId: string;
}): number;
