import type { CliId } from '../adapters/cli/types.js'; /** * Env for every `herdr` invocation in this file. * * `plugin install` clones an operator-supplied repo and then runs that repo's * own install action — third-party code, spawned as a grandchild of whoever * called us. Two callers exist: the setup wizard, and the DASHBOARD's * settings-write handler (installTraexPluginNow runs live in the dashboard * process, which is the machine's only holder of the Feishu H5 login family, * APP_SECRET included). Neither herdr nor a plugin has any use for botmux's * credentials, so the whole redaction set applies — the same boundary a session * CLI child gets, so nothing here is a new or narrower rule. */ export declare function herdrChildEnv(): NodeJS.ProcessEnv; /** * Author-recommended plugin source, surfaced in the dashboard ONLY as a one-click * suggestion the operator must actively select (never a silent default / auto-install). * * Intentionally EMPTY this round: the only known community TraeX plugin's * `scripts/install.sh` uses BSD `sed -i ''` and fails on Linux (the daemon's own * platform), so a one-click default would action-fail. Re-populate with a * `{source, ref: }` (NOT a branch — avoid drift) once upstream * install.sh is fixed and validated on herdr 0.7.3 / Linux. */ export declare const TRAEX_RECOMMENDED_SOURCE = ""; export declare const TRAEX_RECOMMENDED_REF = ""; export interface HerdrIntegrationResult { /** Integrations we attempted (after dedup + filtering by available CLIs). */ attempted: string[]; /** Newly installed during this run. */ installed: string[]; /** Already-present integrations we skipped. */ alreadyInstalled: string[]; /** Integrations whose `herdr integration install` returned non-zero. */ failed: { name: string; reason: string; manualCommand?: string; }[]; /** TraeX herdr plugin status, when a herdr+traex bot exists. */ traexPlugin?: { attempted: boolean; enabled: boolean; source?: string; ref?: string; installed: boolean; alreadyInstalled: boolean; actionInvoked: boolean; skippedReason?: 'disabled' | 'missing_source' | 'plugin_unsupported'; /** Current herdr version, set when skippedReason === 'plugin_unsupported'. */ herdrVersion?: string; failed?: { step: 'install' | 'action'; reason: string; manualCommand: string; }; }; /** CliIds in bots.json that have no upstream herdr integration mapping. */ unsupportedCliIds: CliId[]; } /** * Async sibling of `spawnHerdr`. The TraeX plugin path uses this (not the sync * `spawnSync`) so it can also run live from the dashboard's settings-write * handler without blocking the daemon event loop for up to 120s during a * `herdr plugin install`. Never rejects — resolves an ok/err discriminated * union just like `spawnHerdr`. */ export declare function spawnHerdrAsync(args: string[], timeout?: number): Promise<{ ok: true; stdout: string; } | { ok: false; reason: string; stdout: string; }>; /** * Install / update / verify the TraeX herdr plugin for an operator-supplied * (source, ref). Async so it runs both at startup (awaited by * ensureHerdrIntegrations) and live from the dashboard settings-write handler. * * Correct idempotency (herdr 0.7.x): plugin-ID presence alone is NOT "done" — * - needsInstall = plugin absent OR its herdr `source`/`requested_ref` metadata * differs from the desired (source, ref) → `plugin install` (herdr `replaces:` * and re-checks out on a changed ref/source); * - needsAction = our own success marker is missing or points at a different * `resolved_commit` → re-run the install action. A prior action failure leaves * NO marker, so we retry the action next time WITHOUT a needless re-clone. * The whole check→install→action→marker sequence runs under a cross-process file * lock so concurrent triggers (two tabs, or a dashboard PUT racing startup) can't * double-clone the repo or double-write ~/.trae hooks. */ export declare function installTraexPluginNow(source: string, ref: string): Promise>; /** * Live (dashboard) path: when a settings-write flips the TraeX plugin config, * install immediately instead of waiting for the next daemon restart. Returns * undefined (no-op) unless the write actually touched `herdrTraexPlugin` AND * the resolved config is enabled with a non-empty `source` — so unrelated settings * writes never trigger an install, and enabling without a source stays a no-op * (the UI surfaces the required-source hint). `installFn` is injectable for tests. */ export declare function maybeInstallTraexPluginOnSettingsChange(patchTouchedHerdrTraex: boolean, resolved: { enabled: boolean; source: string; ref: string; } | undefined, installFn?: (source: string, ref: string) => Promise>): Promise | undefined>; /** * Install herdr integrations for the given CLI ids. Caller is responsible * for ensuring `herdr` itself is on PATH first (use ensureHerdr). * * @param cliIds De-duped CliIds collected from bots.json. Order doesn't * matter; we map → herdr integration → de-dup again before * touching the filesystem. */ export declare function ensureHerdrIntegrations(cliIds: Iterable): Promise; //# sourceMappingURL=ensure-herdr-integrations.d.ts.map