/** * Safe read/write helper for the OpenClaw gateway config file. * * The OpenClaw config (default: `~/.openclaw/openclaw.json`) is the source of * truth for the AgenticROS *plugin*'s skill configuration — * `plugins.entries.agenticros.config.skillPaths` and `.skillPackages` decide * which skill packages the plugin loads at gateway start. The MCP server and * the Gemini CLI read their config from `~/.agenticros/config.json` instead; * neither currently loads skills. * * This module exists so the rest of the CLI can mutate that nested * `plugins.entries.agenticros.config` slice without round-tripping the entire * JSON document or accidentally clobbering unrelated keys (gateway auth, * other plugins, etc). Every write goes through the full JSON parse → mutate * → stringify cycle to keep the file valid; comments are not supported in the * source JSON either way. */ /** Default location of the OpenClaw config. Overridable via `$OPENCLAW_CONFIG`. */ export declare function openclawConfigPath(): string; export declare function openclawConfigExists(): boolean; /** Flattened plugin tree OpenClaw 2026.6+ accepts (`pnpm deploy --prod`). */ export declare function pluginDeployDir(): string; /** True when `setup_gateway_plugin.sh` has produced a usable deploy tree. */ export declare function pluginDeployManifestExists(): boolean; /** True when `path` is the deploy dir or a file inside it. */ export declare function pathIsPluginDeploy(path: string, deployDir?: string): boolean; /** * Paths OpenClaw 2026.6+ rejects for linked installs (workspace source trees * with pnpm symlinks escaping the plugin root). */ export declare function pathLooksLikeWorkspacePluginSource(path: string): boolean; export type AgenticrosPluginInstallStatus = { ok: true; sourcePath?: string; } | { ok: false; reason: "no-openclaw-config" | "no-deploy" | "not-registered" | "wrong-path"; sourcePath?: string; detail?: string; }; /** * Whether AgenticROS is registered with OpenClaw via the flattened deploy dir. * * Merely having `~/.openclaw/openclaw.json` (from OpenClaw onboard) is not * enough — that was wrongly treated as "plugin already installed" and skipped * `setup_gateway_plugin.sh` on machines that installed OpenClaw first. */ export declare function getAgenticrosOpenclawPluginInstallStatus(opts?: { cfg?: Record | null; deployDir?: string; }): AgenticrosPluginInstallStatus; /** Convenience predicate for init skip / menu logic. */ export declare function isAgenticrosOpenclawPluginInstalled(opts?: { cfg?: Record; deployDir?: string; }): boolean; /** * Read the OpenClaw config or return `undefined` if it doesn't exist / is * not valid JSON. We never throw — callers can decide how loudly to fail. */ export declare function readOpenclawConfig(): Record | undefined; /** Write the config back, pretty-printed (2-space indent), with a trailing newline. */ export declare function writeOpenclawConfig(cfg: Record): void; /** * Locate (and lazily create) the `plugins.entries.agenticros.config` subtree. * Mutates `cfg` in place and returns the inner config object so callers can * read/modify its `skillPaths`, `skillPackages`, `skills`, etc. */ export declare function getAgenticrosPluginConfig(cfg: Record): Record; /** * Ensure `obj[key]` is an array of strings and return it (creating an empty * array if needed). Non-string entries in an existing array are preserved so * we don't silently drop opaque values, but lookups still operate on strings. */ export declare function ensureStringArray(obj: Record, key: string): unknown[]; /** * Locate the AgenticROS plugin manifest whose `contracts.tools` the CLI * should treat as canonical. * * Order: * 1. The in-repo source manifest at * `/packages/agenticros/openclaw.plugin.json`. This is * the "future-proof" list — anything `sync-skill-tools.mjs` adds for * a new skill lands here first, and the next `setup_gateway_plugin.sh` * run propagates it into the deploy. Stamping `alsoAllow` from this * file means the chat agent picks up the new tools the moment the * gateway restarts, with no second sync round-trip. * 2. The deploy dir produced by `setup_gateway_plugin.sh` * (`~/.agenticros/plugin-deploy/openclaw.plugin.json`) — used when * the CLI runs without a workspace checkout (npx-from-tarball). * * `installRoot` is the agenticros workspace root (`getCliPaths().repoRoot`). * Returns `undefined` if neither file exists yet — callers should treat that * as "plugin not installed yet, skip the sync step". */ export declare function findAgenticrosPluginManifest(installRoot?: string): string | undefined; /** * Read `contracts.tools` from the AgenticROS plugin manifest, or `undefined` * if we can't find / parse it. This is the canonical list the CLI uses when * stamping `tools.alsoAllow` in the OpenClaw config. */ export declare function readAgenticrosContractTools(installRoot?: string): string[] | undefined; export interface AlsoAllowSyncResult { /** Tools that were already in `alsoAllow` before we ran. */ preExisting: string[]; /** Tools we appended this run (anything from `tools` that wasn't already allowed). */ added: string[]; /** Full `alsoAllow` after the update — useful for logging. */ final: string[]; /** True when the on-disk config was modified. */ changed: boolean; } /** * Make sure every tool id in `tools` is reachable from the chat agent's tool * picker by appending missing entries to `cfg.tools.alsoAllow`. * * Why this exists: OpenClaw 2026.6+ ships a `tools.profile` ("coding", * "standard", …) that is a *strict* allowlist applied before plugin-registered * tools are merged in. Plugins like AgenticROS can register tools all day, but * the chat agent will never see them unless the user opts each one in via * `tools.alsoAllow`. The gateway logs this as "Browser is configured, but the * current tool profile does not include the browser tool…" for built-ins; for * plugin tools you instead just see the agent claim "I don't have those tools" * in chat. We keep the user out of that footgun by syncing `alsoAllow` to the * plugin's `contracts.tools` whenever the CLI knows the canonical list. * * Idempotent. Never removes entries (other plugins may have added their own). * Returns a result rather than mutating cfg in-place + writing, because * callers sometimes want to combine this with other config mutations and * write once at the end. This function still writes when run standalone * (when `write` is true, the default) so simple callers stay one-liners. */ export declare function ensureToolsAlsoAllow(tools: string[], opts?: { write?: boolean; cfg?: Record; }): AlsoAllowSyncResult | undefined; //# sourceMappingURL=openclaw-config.d.ts.map