import { z } from 'zod'; import { ImportedMcpsConfig } from './mcp-imports.js'; import './mcp-discovery-CLihUe93.js'; /** * `~/.agentproto/bundles.json` — named sets of imported MCPs + skills (+ * optionally the daemon's own `/mcp`), attachable to any harness in one * `agent_start({bundles:["research"]})` call. * * Same load/save/atomic-write pattern as `user-presets.ts`; validation * against the live imported-MCP set is the single boundary every writer * (MCP tools, HTTP routes) goes through (`saveBundle`). */ /** Per-import tool filter, applied on the `/mcp/imported/` mount as * `?allowTools=` / `?denyTools=`. Entries are exact tool names or `*` * patterns (`list_*`). `deny` wins over `allow`. */ interface BundleToolFilter { /** Only these tools are visible/callable. Non-empty when present. */ allow?: string[]; deny?: string[]; } interface Bundle { /** Stable machine-local id, e.g. `research`. */ id: string; label: string; description?: string; /** Imported-MCP ids (`mcp_imported_list`) to mount as native MCP servers * on a spawn carrying this bundle. `"*"` expands at spawn time to the * CURRENT import set (never validated at save time, never dangling). * Opt-in only: no default config ships a bundle with `"*"` (dozens of * tools per import would flood every harness palette). */ mcpImports: string[] | "*"; /** Optional per-import tool filters, keyed by import id (each key must be * in `mcpImports`, or any id when `mcpImports` is `"*"`). Imports without * an entry expose every tool. */ toolFilters?: Record; /** Also mount the daemon's own scoped `/mcp` — the same entry the * claude-code/hermes self-mount default builds. */ includeDaemon?: boolean; /** Skills unioned into the spawn's resolved skill list. */ skills: string[]; } declare const bundlesFileSchema: z.ZodObject<{ version: z.ZodLiteral<1>; bundles: z.ZodArray; mcpImports: z.ZodUnion, z.ZodLiteral<"*">]>; toolFilters: z.ZodOptional>; deny: z.ZodOptional>; }, z.core.$strip>>>; includeDaemon: z.ZodOptional; skills: z.ZodArray; }, z.core.$strip>>; }, z.core.$strip>; type BundlesFile = z.infer; /** Built-in bundle that carries the Bureau MCP import + the shared browser * skill. A user bundle with the same id in `bundles.json` replaces it. */ declare const BUILTIN_BROWSER_BUNDLE_ID = "browser"; declare const BUILTIN_BROWSER_BUNDLE_LABEL = "Browser (Bureau)"; /** * The built-in `browser` bundle: every imported entry whose alias equals * `defaults.browser.proxyImport` (none when unset), plus the `browser` skill. * Pure, so bundle_list, spawn expansion and tests share one definition. */ declare function builtinBrowserBundle(proxyImport: string | undefined, imported: ImportedMcpsConfig): Bundle; /** User bundles plus every built-in one; a user bundle with a built-in's id * wins (same policy as the rest of the daemon's user-over-builtin stores). * The built-in `browser` bundle exists only once `defaults.browser.proxyImport` * names a Bureau import: on a host without one it would mount nothing. */ declare function effectiveBundles(userBundles: readonly Bundle[], proxyImport: string | undefined, imported: ImportedMcpsConfig): Bundle[]; declare const BUNDLES_PATH: () => string; /** Missing or malformed user config is treated as empty — a bad bundle must * never prevent the daemon from starting. Writes always restore valid JSON. */ declare function loadBundles(path?: string): Promise; declare function listBundles(): Promise; declare function getBundle(id: string): Promise; /** Thrown by `saveBundle` when `mcpImports` names an id not present in the * live imported-MCP set — the create/update validation boundary. */ declare class BundleValidationError extends Error { } /** `bundle.mcpImports` ids that are no longer in the live imported-MCP set — * the id was valid at save time but the import was later removed * (`mcp_imported_remove`). Used by `bundle_list` to flag dangling refs and * by the spawn-expansion path to skip them with a warning. */ declare function danglingImports(bundle: Bundle, importedIds: ReadonlySet): string[]; /** Create a new bundle. Throws (Zod) on a malformed shape, or * `BundleValidationError` when `mcpImports` names an unknown import id. * Rejects when `id` already exists — use `updateBundle` to modify one. */ declare function createBundle(bundle: Bundle): Promise; /** Merge `patch` onto the existing bundle named `id` and persist it. Throws * `BundleValidationError` when `id` doesn't exist or the merged * `mcpImports` names an unknown import id. */ declare function updateBundle(id: string, patch: Partial>): Promise; declare function deleteBundle(id: string): Promise; export { BUILTIN_BROWSER_BUNDLE_ID, BUILTIN_BROWSER_BUNDLE_LABEL, BUNDLES_PATH, type Bundle, type BundleToolFilter, BundleValidationError, type BundlesFile, builtinBrowserBundle, createBundle, danglingImports, deleteBundle, effectiveBundles, getBundle, listBundles, loadBundles, updateBundle };