
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="da73c9dd-0325-5fa6-ab97-a9d0846f5a33")}catch(e){}}();
import { abortActorRun } from './common/abort_actor_run.js';
import { addTool } from './common/add_actor.js';
import { getUserDatasetsList } from './common/dataset_collection.js';
import { fetchApifyDocsTool } from './common/fetch_apify_docs.js';
import { getActorOutput } from './common/get_actor_output.js';
import { getActorRunLog } from './common/get_actor_run_log.js';
import { getDataset } from './common/get_dataset.js';
import { getDatasetItems } from './common/get_dataset_items.js';
import { getDatasetSchema } from './common/get_dataset_schema.js';
import { getKeyValueStore } from './common/get_key_value_store.js';
import { getKeyValueStoreKeys } from './common/get_key_value_store_keys.js';
import { getKeyValueStoreRecord } from './common/get_key_value_store_record.js';
import { getUserKeyValueStoresList } from './common/key_value_store_collection.js';
import { getUserRunsList } from './common/run_collection.js';
import { searchApifyDocsTool } from './common/search_apify_docs.js';
import { defaultCallActor } from './default/call_actor.js';
import { defaultFetchActorDetails } from './default/fetch_actor_details.js';
import { defaultGetActorRun } from './default/get_actor_run.js';
import { defaultSearchActors } from './default/search_actors.js';
import { openaiCallActor } from './openai/call_actor.js';
import { openaiFetchActorDetails } from './openai/fetch_actor_details.js';
import { fetchActorDetailsInternalTool } from './openai/fetch_actor_details_internal.js';
import { openaiGetActorRun } from './openai/get_actor_run.js';
import { openaiSearchActors } from './openai/search_actors.js';
import { searchActorsInternalTool } from './openai/search_actors_internal.js';
/** A plain ToolEntry always has a `name` property; mode maps never do. */
function isModeMap(entry) {
    return !('name' in entry);
}
/**
 * Unified tool category definitions — single source of truth.
 *
 * Each entry is either a plain ToolEntry (mode-independent) or a mode map
 * with ServerMode keys mapping to their ToolEntry variant.
 *
 * Use {@link getCategoryTools} to resolve entries into concrete ToolEntry arrays for a given mode.
 */
export const toolCategories = {
    experimental: [
        addTool,
    ],
    actors: [
        { default: defaultSearchActors, openai: openaiSearchActors },
        { default: defaultFetchActorDetails, openai: openaiFetchActorDetails },
        { default: defaultCallActor, openai: openaiCallActor },
    ],
    ui: [
        { openai: searchActorsInternalTool },
        { openai: fetchActorDetailsInternalTool },
    ],
    docs: [
        searchApifyDocsTool,
        fetchApifyDocsTool,
    ],
    runs: [
        { default: defaultGetActorRun, openai: openaiGetActorRun },
        getUserRunsList,
        getActorRunLog,
        abortActorRun,
    ],
    storage: [
        getDataset,
        getDatasetItems,
        getDatasetSchema,
        getActorOutput,
        getKeyValueStore,
        getKeyValueStoreKeys,
        getKeyValueStoreRecord,
        getUserDatasetsList,
        getUserKeyValueStoresList,
    ],
    dev: [],
};
/**
 * Canonical list of all tool category names, derived from toolCategories keys.
 */
export const CATEGORY_NAMES = Object.keys(toolCategories);
/** Set of known category names for O(1) membership checks. */
export const CATEGORY_NAME_SET = new Set(CATEGORY_NAMES);
/**
 * Resolve a single category's tool entries for the given server mode.
 *
 * For each entry:
 * - Plain ToolEntry (has `name`) → always included, mode-independent
 * - ModeMap → look up `entry[mode]`; included only if the mode key exists
 */
function resolveCategoryEntries(entries, mode) {
    const result = [];
    for (const entry of entries) {
        if (isModeMap(entry)) {
            const tool = entry[mode];
            if (tool) {
                result.push(tool);
            }
        }
        else {
            result.push(entry);
        }
    }
    return result;
}
/**
 * Resolve tool categories for a given server mode.
 *
 * Returns mode-resolved tool variants: openai mode gets openai-specific implementations
 * (async execution, widget metadata), default mode gets standard implementations.
 * Openai-only tools are excluded in default mode.
 *
 * @param mode - Required. Use `'default'` or `'openai'`.
 *   Made explicit (no default value) to prevent accidentally serving wrong-mode tools.
 */
export function getCategoryTools(mode = 'default') {
    return Object.fromEntries(CATEGORY_NAMES.map((name) => [name, resolveCategoryEntries(toolCategories[name], mode)]));
}
export const toolCategoriesEnabledByDefault = [
    'actors',
    'docs',
];
//# sourceMappingURL=categories.js.map
//# debugId=da73c9dd-0325-5fa6-ab97-a9d0846f5a33
