/** * Identity file management for Signet * * Handles loading and recognizing the standard identity files * (AGENTS.md, SOUL.md, IDENTITY.md, USER.md, HEARTBEAT.md, MEMORY.md, TOOLS.md) * that form the cross-harness identity standard. */ /** * Returns the base path for agent-specific files. * The 'default' agent maps to the workspace root; all others map to * `{workspaceDir}/agents/{agentName}`. */ export declare function resolveAgentBasePath(agentName: string, workspaceDir: string): string; /** * Specification for an identity file */ export type IdentityPresetName = "minimal" | "hermes" | "openclaw" | "custom"; export type IdentityMode = "managed" | "off"; /** Runtime-only compatibility mode for workspaces created before setup removed * the passthrough choice. New setup plans must use {@link IdentityMode}. */ export type ResolvedIdentityMode = IdentityMode | "passthrough"; export declare const IDENTITY_MODES: readonly ["managed", "off"]; export type IdentityFileContext = "startup" | "session"; export type IdentitySessionKind = "dreaming" | "heartbeat" | "bootstrap"; export interface IdentityFileSpec { /** Relative path from the base directory */ path: string; /** Human-readable description */ description: string; /** Whether this file is optional */ optional?: boolean; /** Whether this file is loaded during normal startup or only in a special session */ context?: IdentityFileContext; /** Special session kind when context is "session" */ session?: IdentitySessionKind; } export interface IdentityContextFileEntry { path: string; role?: string; budget?: number; enabled?: boolean; } export interface IdentitySpecialFileEntry extends IdentityContextFileEntry { kind: IdentitySessionKind; } export interface IdentityPresetSpec { name: IdentityPresetName; description: string; startup: IdentityContextFileEntry[]; special: IdentitySpecialFileEntry[]; } /** * Loaded identity file content */ export interface IdentityFile { /** Relative path (e.g., 'AGENTS.md') */ path: string; /** File contents */ content: string; /** Last modification time */ mtime: Date; /** File size in bytes */ size: number; } /** * Map of identity file key to loaded content */ export interface IdentityMap { agents?: IdentityFile; soul?: IdentityFile; identity?: IdentityFile; user?: IdentityFile; heartbeat?: IdentityFile; memory?: IdentityFile; tools?: IdentityFile; bootstrap?: IdentityFile; } /** * Standard identity files that form the cross-harness identity standard. * These are recognized by Signet and multiple harnesses. */ export declare const IDENTITY_FILES: Record; export declare const IDENTITY_PRESETS: Record; /** * Required identity files (non-optional) */ export declare const REQUIRED_IDENTITY_KEYS: string[]; /** * Optional identity files */ export declare const OPTIONAL_IDENTITY_KEYS: string[]; /** * Detection result for existing setup */ export interface SetupDetection { /** Base path checked */ basePath: string; /** Whether the base directory exists */ agentsDir: boolean; /** Whether agent.yaml exists */ agentYaml: boolean; /** Whether AGENTS.md exists */ agentsMd: boolean; /** Whether config.yaml exists */ configYaml: boolean; /** Whether memories.db exists */ memoryDb: boolean; /** Found identity files */ identityFiles: string[]; /** Whether memory directory exists with logs */ hasMemoryDir: boolean; /** Number of memory log files */ memoryLogCount: number; /** Whether .clawdhub/lock.json exists (OpenClaw skills registry) */ hasClawdhub: boolean; /** Whether ~/.claude/skills/ exists */ hasClaudeSkills: boolean; /** Detected installed harnesses */ harnesses: { claudeCode: boolean; openclaw: boolean; opencode: boolean; forge: boolean; codex: boolean; ohMyPi: boolean; pi: boolean; hermesAgent: boolean; gemini: boolean; }; } export declare function resolveHermesHomePath(): string; /** * Canonical list of common Hermes Agent repo install paths. * * Exported so `connector-hermes-agent` can import it instead of duplicating * the list, eliminating parity drift between install and detection logic. */ export declare function hermesAgentCandidateDirs(): readonly string[]; /** * Resolve the Hermes Agent repo directory. * * This detects a Hermes install before the Signet plugin has been copied in. * It checks for the repo's `plugins/memory` tree rather than the Signet plugin * file, so setup can offer and install the Hermes connector on first run. * Resolution order: HERMES_REPO, HERMES_HOME, ~/.hermes, legacy/common paths, * then the hermes executable location. */ export declare function resolveHermesRepoPath(): string | null; /** * Resolve the path to the Signet plugin file inside the Hermes Agent repo. * * Checks (in order): `HERMES_REPO` env var, common install paths, then * falls back to resolving the `hermes` CLI via `which(1)` + `realpathSync`. * * Returns the full path to `plugins/memory/signet/__init__.py` when found, * or `null` if Hermes is not installed or the Signet plugin is absent. * * Exported so connector-hermes-agent can import this instead of duplicating * the same logic, keeping the two detection paths in sync. */ export declare function resolveHermesRepoPluginPath(): string | null; /** * Detect existing identity setup at a given path */ export declare function detectExistingSetup(basePath: string): SetupDetection; /** * Load all identity files from a directory */ export declare function loadIdentityFiles(basePath: string): Promise; /** * Load identity files synchronously */ export declare function loadIdentityFilesSync(basePath: string): IdentityMap; /** * Check if a directory has the minimum required identity files. * Returns false when identity mode is off — that mode * intentionally omit identity files. */ export declare function hasValidIdentity(basePath: string): boolean; /** * Get list of missing required identity files. * Returns an empty list when identity mode is off. */ export declare function getMissingIdentityFiles(basePath: string): string[]; export declare function resolveIdentityModeFromConfig(config: unknown): ResolvedIdentityMode; export declare function loadIdentityMode(agentsDir: string): ResolvedIdentityMode; export declare function identityModeManagesFiles(mode: ResolvedIdentityMode): boolean; export declare function identityModeReadsFiles(mode: ResolvedIdentityMode): boolean; export declare function resolveStartupIdentityFiles(agentsDir: string): IdentityContextFileEntry[]; export declare function resolveSpecialIdentityFiles(agentsDir: string, kind: IdentitySessionKind): IdentitySpecialFileEntry[]; export declare const STATIC_IDENTITY_OFFLINE_STATUS = "[signet: daemon offline \u2014 running with static identity]"; export declare const STATIC_IDENTITY_SESSION_START_TIMEOUT_STATUS = "[signet: daemon session-start timed out \u2014 running with static identity]"; export declare function resolveSessionStartTimeoutMs(raw?: string): number; export declare function resolvePromptSubmitTimeoutMs(raw?: string): number; /** * Read identity files directly from disk and compose a degraded inject string. * Used as fallback when the daemon is unreachable during session-start. * * Returns null if no identity files exist. */ export declare function readStaticIdentity(agentsDir: string, status?: string): string | null; /** * Generate a summary of the identity for display */ export declare function summarizeIdentity(identity: IdentityMap): string; //# sourceMappingURL=identity.d.ts.map