import { WorkflowGraph } from '@datatechsolutions/shared-domain/ports/workflow';
import { WorkflowGraph as WorkflowGraph$1 } from '../../astrlabe/contracts.js';

/** Formats a millisecond count as a short, human-readable duration string. */
declare function formatDurationMs(ms: number | null | undefined): string;

/**
 * Parses a JSON string into a typed value, returning undefined (not throwing)
 * on empty input or malformed JSON. Used by form builders where the user types
 * JSON into a textarea and we want to surface a friendly "couldn't parse" state
 * rather than crashing the submit handler.
 */
declare function tryParseJson<T = unknown>(value: FormDataEntryValue | string | null | undefined): T | undefined;
/** Parses JSON into an object record. Returns undefined if the result is not a plain object. */
declare function tryParseJsonObject(value: FormDataEntryValue | string | null | undefined): Record<string, unknown> | undefined;
/** Parses JSON into an array of records. Returns undefined if not a plain array. */
declare function tryParseJsonArray(value: FormDataEntryValue | string | null | undefined): Array<Record<string, unknown>> | undefined;

type ToolCategory = 'search' | 'code' | 'file' | 'web' | 'math' | 'custom';
declare const TOOL_CATEGORY_VALUES: readonly ToolCategory[];
/** Narrows a form value to a ToolCategory, returning undefined if not one of the known values. */
declare function parseToolCategory(value: FormDataEntryValue | null | undefined): ToolCategory | undefined;

declare function adaptWorkflowGraphToUi(graph: WorkflowGraph): WorkflowGraph$1;

declare function getLambdaApiBase(): string;
declare function buildLambdaApiUrl(path: string): string;

declare function getAuthAppUrl(): string;
declare function buildHostedAuthUrl(path: string, search?: string): string;

export { TOOL_CATEGORY_VALUES, type ToolCategory, adaptWorkflowGraphToUi, buildHostedAuthUrl, buildLambdaApiUrl, formatDurationMs, getAuthAppUrl, getLambdaApiBase, parseToolCategory, tryParseJson, tryParseJsonArray, tryParseJsonObject };
