/** * Per-harness install step for `installAgentPack` (SMI-5456 Wave 1 Step 5). * * One function per concern (shim, hooks, MCP registration) so the * orchestrator (`agent-pack-installer.ts`) stays a readable top-level loop. * Every function is additive to `entries`/`report` in place — the caller * owns aggregation and the manifest save. * * @module @skillsmith/core/install/agent-pack-installer.harness */ import type { AgentPackArtifact, HarnessId } from '../services/agent-pack/index.js'; import { type McpHarnessId } from './agent-harness-targets.js'; import type { AgentManifestEntry } from './agent-manifest.js'; import type { HarnessInstallReport } from './agent-pack-installer.types.js'; export interface HarnessInstallCtx { homeDir: string | undefined; force: boolean; backupDir: string; entries: AgentManifestEntry[]; /** * Config-file paths already backed up during THIS install run. Shared * across every merge call so a harness whose hooks + MCP registration * share one file (claude-code: `settings.json`; codex: `config.toml`) * only backs it up once, capturing genuine pre-install state rather than * repeatedly "backing up" content this same run already wrote. */ backedUpPaths: Set; } /** Write the named-agent shim for `harness` when a target exists (claude-code/copilot/opencode). */ export declare function installShim(harness: HarnessId, artifact: AgentPackArtifact | undefined, ctx: HarnessInstallCtx, report: HarnessInstallReport): void; /** Install + wire SessionStart/SessionEnd hook scripts for claude-code (JSON hook config). */ export declare function installJsonHooks(harness: 'claude-code', startArtifact: AgentPackArtifact | undefined, endArtifact: AgentPackArtifact | undefined, ctx: HarnessInstallCtx, report: HarnessInstallReport): void; /** * Install hook scripts for Codex (+x) and wire the SessionStart hook into * `~/.codex/config.toml` as a marker-delimited `[[hooks.SessionStart]]` * array-of-tables block (shape Step-6-verified against * developers.openai.com/codex/hooks). * * SessionStart ONLY — deliberate, do not "complete" this: * - Codex has NO SessionEnd event. There is nothing to wire the * session-end.sh cleanup script to. * - Codex's Stop event fires PER-TURN, not per-session. Wiring the marker * cleanup there would delete the agent-mediation marker file after the * FIRST turn, silently unmarking every subsequent tool call in the same * session and corrupting the mediation-share metric the whole Wave-1 * bet is measured by. * - Cleanup therefore rides the server's 12h marker TTL * (`telemetry/agent-marker.ts` `AGENT_MARKER_TTL_MS`) — the same * crash-backstop path every harness already relies on. * * session-end.sh is still installed (inert on Codex — nothing invokes it): * it keeps the on-disk script tree identical across hook-capable harnesses * and stays manifest-tracked, so uninstall removes it like any other owned * file. Zero uninstall complication. */ export declare function installCodexHooks(startArtifact: AgentPackArtifact | undefined, endArtifact: AgentPackArtifact | undefined, ctx: HarnessInstallCtx, report: HarnessInstallReport): void; /** * Exported for reuse by the Cursor legacy-key cleanup step * (`agent-pack-installer.cursor-hooks.ts`, SMI-5893 Wave 10, code-review * finding) — same Claude-shaped `{ matcher, hooks: [{ command }] }` entry * extraction, needed outside this module to identify our own entries under * a stale legacy key without a second, drift-prone duplicate implementation. */ export declare function hookEntryCommand(item: unknown): string | undefined; /** * Codex's named-agent "shim" is a `[agents.skillsmith-agent]` TOML entry * merged into the same `~/.codex/config.toml` as its MCP registration — * the artifact's content (`shims/codex/agents.toml`, rendered by the * locked `renderCodexToml`) is already the exact block text to install. */ export declare function installCodexAgentsShim(artifact: AgentPackArtifact | undefined, ctx: HarnessInstallCtx, report: HarnessInstallReport): void; /** Merge the `skillsmith` MCP server registration for any of the 7 MCP-capable harnesses. */ export declare function installMcpConfig(harness: McpHarnessId, ctx: HarnessInstallCtx, report: HarnessInstallReport): void; //# sourceMappingURL=agent-pack-installer.harness.d.ts.map