import type { ExtensionContext } from "@earendil-works/pi-coding-agent"; import { type GitContext, type GitDynamicState } from "./git-metadata.js"; import { type PinetSkinStatusVocabulary, type SlackBridgeSettings } from "./helpers.js"; import { type SecurityGuardrails } from "./guardrails.js"; import type { SinglePlayerThreadInfo } from "./single-player-runtime.js"; export type RuntimeAgentRole = "broker" | "worker"; export type ReactionCommandMap = Map; export interface ReloadableRuntimeSnapshot { settings: SlackBridgeSettings; botToken: string | undefined; appToken: string | undefined; allowedUsers: Set | null; guardrails: SecurityGuardrails; reactionCommands: ReactionCommandMap; securityPrompt: string; agentName: string; agentEmoji: string; activeSkinTheme: string | null; agentPersonality: string | null; agentAliases: string[]; } export interface RuntimeAgentContextDeps { cwd: string; getSettings: () => SlackBridgeSettings; setSettings: (settings: SlackBridgeSettings) => void; getBotToken: () => string | undefined; setBotToken: (token: string | undefined) => void; getAppToken: () => string | undefined; setAppToken: (token: string | undefined) => void; getAllowedUsers: () => Set | null; setAllowedUsers: (users: Set | null) => void; getGuardrails: () => SecurityGuardrails; setGuardrails: (guardrails: SecurityGuardrails) => void; getReactionCommands: () => ReactionCommandMap; setReactionCommands: (commands: ReactionCommandMap) => void; getSecurityPrompt: () => string; setSecurityPrompt: (prompt: string) => void; getAgentName: () => string; setAgentName: (name: string) => void; getAgentEmoji: () => string; setAgentEmoji: (emoji: string) => void; getAgentStableId: () => string; getBrokerStableId: () => string; getBrokerRole: () => "broker" | "follower" | null; getAgentOwnerToken: () => string; setAgentOwnerToken: (ownerToken: string) => void; getActiveSkinTheme: () => string | null; setActiveSkinTheme: (theme: string | null) => void; getAgentPersonality: () => string | null; setAgentPersonality: (personality: string | null) => void; getAgentAliases: () => Set; getThreads: () => Map; getExtensionContext: () => ExtensionContext | null; persistState: () => void; updateBadge: () => void; getGitContext: () => Promise; /** Optional test hook for live branch/dirty probing. */ getDynamicGitState?: (cwd: string) => Promise; } export interface RuntimeAgentContext { isUserAllowed: (userId: string) => boolean; maybeWarnSlackUserAccess: (ctx?: ExtensionContext) => void; maybeWarnSlackGuardrailPosture: (ctx?: ExtensionContext) => void; getStableIdForRole: (role: RuntimeAgentRole) => string; getIdentitySeedForRole: (role: RuntimeAgentRole, sessionFile?: string) => string; getSkinSeed: (preferredSeed?: string) => string; rememberAgentAlias: (name: string | undefined) => void; resolveSkinAssignment: (role: RuntimeAgentRole, seed?: string) => { name: string; emoji: string; personality: string; statusVocabulary?: PinetSkinStatusVocabulary; } | null; applyLocalAgentIdentity: (nextName: string, nextEmoji: string, nextPersonality: string | null) => void; refreshSettings: () => void; snapshotReloadableRuntime: () => ReloadableRuntimeSnapshot; restoreReloadableRuntime: (snapshot: ReloadableRuntimeSnapshot) => void; detectProjectTools: (repoRoot: string, cwd: string) => string[]; getAgentMetadata: (role?: RuntimeAgentRole) => Promise>; asStringValue: (value: unknown) => string | undefined; getMeshRoleFromMetadata: (metadata: Record | undefined, fallback?: RuntimeAgentRole) => RuntimeAgentRole; buildSkinMetadata: (metadata: Record | undefined, personality: string, statusVocabulary?: PinetSkinStatusVocabulary) => Record; getIdentityGuidelines: () => [string, string, string]; applyRegistrationIdentity: (registration: { name: string; emoji: string; metadata?: Record | null; }) => void; } export declare function createRuntimeAgentContext(deps: RuntimeAgentContextDeps): RuntimeAgentContext;