holomime 1.8.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -1
- package/dist/cli.js +1194 -1146
- package/dist/index.d.ts +218 -1
- package/dist/index.js +525 -1
- package/dist/integrations/langchain.d.ts +164 -0
- package/dist/integrations/langchain.js +962 -0
- package/dist/integrations/openclaw.d.ts +49 -0
- package/dist/integrations/openclaw.js +1465 -0
- package/package.json +10 -2
package/dist/index.d.ts
CHANGED
|
@@ -4792,6 +4792,63 @@ declare function generateIndexMarkdown(index: BehavioralIndex): string;
|
|
|
4792
4792
|
*/
|
|
4793
4793
|
declare function startMCPServer(): Promise<void>;
|
|
4794
4794
|
|
|
4795
|
+
/**
|
|
4796
|
+
* Types for the HoloMime Live real-time behavioral monitoring system.
|
|
4797
|
+
*/
|
|
4798
|
+
interface BrainRegionState {
|
|
4799
|
+
id: string;
|
|
4800
|
+
name: string;
|
|
4801
|
+
function: string;
|
|
4802
|
+
color: string;
|
|
4803
|
+
intensity: number;
|
|
4804
|
+
patterns: string[];
|
|
4805
|
+
}
|
|
4806
|
+
interface FiredPattern {
|
|
4807
|
+
id: string;
|
|
4808
|
+
name: string;
|
|
4809
|
+
severity: "info" | "warning" | "concern";
|
|
4810
|
+
percentage: number;
|
|
4811
|
+
description: string;
|
|
4812
|
+
}
|
|
4813
|
+
interface BrainEvent {
|
|
4814
|
+
type: "diagnosis";
|
|
4815
|
+
timestamp: string;
|
|
4816
|
+
health: number;
|
|
4817
|
+
grade: string;
|
|
4818
|
+
messageCount: number;
|
|
4819
|
+
regions: BrainRegionState[];
|
|
4820
|
+
patterns: FiredPattern[];
|
|
4821
|
+
activity: {
|
|
4822
|
+
role: "user" | "assistant";
|
|
4823
|
+
preview: string;
|
|
4824
|
+
} | null;
|
|
4825
|
+
}
|
|
4826
|
+
|
|
4827
|
+
/**
|
|
4828
|
+
* Snapshot encoding and share URL generation.
|
|
4829
|
+
* Used by brain command, diagnose command, and benchmark command
|
|
4830
|
+
* to generate shareable brain visualization URLs.
|
|
4831
|
+
*/
|
|
4832
|
+
|
|
4833
|
+
/**
|
|
4834
|
+
* Compress a BrainEvent into a compact base64url-encoded string for sharing.
|
|
4835
|
+
*/
|
|
4836
|
+
declare function encodeSnapshot(event: BrainEvent, agentName: string): string;
|
|
4837
|
+
/**
|
|
4838
|
+
* Generate a share URL from a DiagnosisResult.
|
|
4839
|
+
* Converts diagnosis → BrainEvent → compressed snapshot → URL.
|
|
4840
|
+
*/
|
|
4841
|
+
declare function generateShareUrl(diagnosis: DiagnosisResult, agentName?: string): string;
|
|
4842
|
+
/**
|
|
4843
|
+
* Copy text to system clipboard. Silent fail on unsupported platforms.
|
|
4844
|
+
*/
|
|
4845
|
+
declare function copyToClipboard(text: string): boolean;
|
|
4846
|
+
/**
|
|
4847
|
+
* Generate and print a share URL from a DiagnosisResult.
|
|
4848
|
+
* Convenience function that combines generation + clipboard + display.
|
|
4849
|
+
*/
|
|
4850
|
+
declare function shareFromDiagnosis(diagnosis: DiagnosisResult, agentName?: string): void;
|
|
4851
|
+
|
|
4795
4852
|
/**
|
|
4796
4853
|
* Oversight — human gating controls for autonomous operations.
|
|
4797
4854
|
*
|
|
@@ -5895,4 +5952,164 @@ declare function listPresets(): BehavioralPreset[];
|
|
|
5895
5952
|
*/
|
|
5896
5953
|
declare function getPreset(key: string): BehavioralPreset | undefined;
|
|
5897
5954
|
|
|
5898
|
-
|
|
5955
|
+
/**
|
|
5956
|
+
* LangChain / CrewAI / LlamaIndex Callback Handler
|
|
5957
|
+
*
|
|
5958
|
+
* Monitors LLM responses in real-time and detects behavioral anti-patterns.
|
|
5959
|
+
* Works with any LangChain-compatible framework that supports callback handlers.
|
|
5960
|
+
*
|
|
5961
|
+
* Usage:
|
|
5962
|
+
* import { HolomimeCallbackHandler } from "holomime/integrations/langchain";
|
|
5963
|
+
*
|
|
5964
|
+
* const handler = new HolomimeCallbackHandler({
|
|
5965
|
+
* mode: "monitor", // "monitor" | "enforce" | "strict"
|
|
5966
|
+
* personality: ".personality.json",
|
|
5967
|
+
* onViolation: (v) => console.warn("Behavioral drift:", v),
|
|
5968
|
+
* });
|
|
5969
|
+
*
|
|
5970
|
+
* // LangChain
|
|
5971
|
+
* const chain = prompt.pipe(model).pipe(parser);
|
|
5972
|
+
* await chain.invoke({ input: "hello" }, { callbacks: [handler] });
|
|
5973
|
+
*
|
|
5974
|
+
* // CrewAI — pass as LangChain callback on the underlying LLM
|
|
5975
|
+
* // LlamaIndex — use as a callback handler on the LLM
|
|
5976
|
+
*/
|
|
5977
|
+
|
|
5978
|
+
type CallbackMode = "monitor" | "enforce" | "strict";
|
|
5979
|
+
interface CallbackViolation {
|
|
5980
|
+
patterns: DetectedPattern[];
|
|
5981
|
+
severity: "warning" | "concern";
|
|
5982
|
+
response: string;
|
|
5983
|
+
runId?: string;
|
|
5984
|
+
timestamp: string;
|
|
5985
|
+
}
|
|
5986
|
+
interface HolomimeCallbackOptions {
|
|
5987
|
+
/** Guard mode. Default: "monitor". */
|
|
5988
|
+
mode?: CallbackMode;
|
|
5989
|
+
/** Path to .personality.json or inline spec object. */
|
|
5990
|
+
personality?: string | object;
|
|
5991
|
+
/** Minimum severity to trigger. Default: "warning". */
|
|
5992
|
+
minSeverity?: "warning" | "concern";
|
|
5993
|
+
/** Callback fired on every violation. */
|
|
5994
|
+
onViolation?: (violation: CallbackViolation) => void;
|
|
5995
|
+
/** Agent name for reports. Default: "langchain-agent". */
|
|
5996
|
+
name?: string;
|
|
5997
|
+
/** Buffer size — number of messages to retain for context. Default: 50. */
|
|
5998
|
+
bufferSize?: number;
|
|
5999
|
+
}
|
|
6000
|
+
interface CallbackStats {
|
|
6001
|
+
totalResponses: number;
|
|
6002
|
+
passed: number;
|
|
6003
|
+
violated: number;
|
|
6004
|
+
blocked: number;
|
|
6005
|
+
patternCounts: Record<string, number>;
|
|
6006
|
+
}
|
|
6007
|
+
/**
|
|
6008
|
+
* HolomimeCallbackHandler — behavioral alignment monitor for LangChain-compatible frameworks.
|
|
6009
|
+
*
|
|
6010
|
+
* Implements the LangChain BaseCallbackHandler interface without importing langchain,
|
|
6011
|
+
* keeping it as an optional peer dependency. Works with LangChain, CrewAI, and any
|
|
6012
|
+
* framework that accepts { handleLLMEnd, handleLLMStart, handleLLMError } callbacks.
|
|
6013
|
+
*/
|
|
6014
|
+
declare class HolomimeCallbackHandler {
|
|
6015
|
+
readonly name = "holomime";
|
|
6016
|
+
readonly lc_serializable = false;
|
|
6017
|
+
private guard;
|
|
6018
|
+
private mode;
|
|
6019
|
+
private minSeverity;
|
|
6020
|
+
private onViolation?;
|
|
6021
|
+
private messageBuffer;
|
|
6022
|
+
private bufferSize;
|
|
6023
|
+
private currentRunMessages;
|
|
6024
|
+
private _stats;
|
|
6025
|
+
constructor(options?: HolomimeCallbackOptions);
|
|
6026
|
+
/**
|
|
6027
|
+
* Called when an LLM starts generating.
|
|
6028
|
+
* Captures the input messages for context.
|
|
6029
|
+
*/
|
|
6030
|
+
handleLLMStart(_llm: any, prompts: string[], runId?: string): void;
|
|
6031
|
+
/**
|
|
6032
|
+
* Called when an LLM finishes generating.
|
|
6033
|
+
* Runs behavioral analysis on the response.
|
|
6034
|
+
*/
|
|
6035
|
+
handleLLMEnd(output: any, runId?: string): void;
|
|
6036
|
+
/**
|
|
6037
|
+
* Called on LLM errors. Clean up run tracking.
|
|
6038
|
+
*/
|
|
6039
|
+
handleLLMError(_error: any, runId?: string): void;
|
|
6040
|
+
/**
|
|
6041
|
+
* Called when a chain starts. Captures input for context.
|
|
6042
|
+
*/
|
|
6043
|
+
handleChainStart(_chain: any, inputs: Record<string, any>, runId?: string): void;
|
|
6044
|
+
/**
|
|
6045
|
+
* Get cumulative stats.
|
|
6046
|
+
*/
|
|
6047
|
+
stats(): CallbackStats;
|
|
6048
|
+
/**
|
|
6049
|
+
* Reset the message buffer and stats.
|
|
6050
|
+
*/
|
|
6051
|
+
reset(): void;
|
|
6052
|
+
/**
|
|
6053
|
+
* Get the current guard result for the buffered conversation.
|
|
6054
|
+
*/
|
|
6055
|
+
diagnose(): GuardResult;
|
|
6056
|
+
private severityMeetsMin;
|
|
6057
|
+
private extractResponseText;
|
|
6058
|
+
}
|
|
6059
|
+
/**
|
|
6060
|
+
* Error thrown in strict mode when a concern-level violation is detected.
|
|
6061
|
+
*/
|
|
6062
|
+
declare class HolomimeViolationError extends Error {
|
|
6063
|
+
readonly violation: CallbackViolation;
|
|
6064
|
+
constructor(violation: CallbackViolation);
|
|
6065
|
+
}
|
|
6066
|
+
|
|
6067
|
+
/**
|
|
6068
|
+
* HoloMime Plugin for OpenClaw
|
|
6069
|
+
*
|
|
6070
|
+
* Adds behavioral alignment monitoring to any OpenClaw agent.
|
|
6071
|
+
* Detects sycophancy, over-apologizing, hedge-stacking, boundary violations,
|
|
6072
|
+
* and 4 more behavioral patterns using 8 rule-based detectors.
|
|
6073
|
+
*
|
|
6074
|
+
* Usage:
|
|
6075
|
+
* import register from "holomime/integrations/openclaw";
|
|
6076
|
+
* register(api);
|
|
6077
|
+
*/
|
|
6078
|
+
interface OpenClawPluginConfig {
|
|
6079
|
+
personalityPath: string;
|
|
6080
|
+
autoInject: boolean;
|
|
6081
|
+
diagnosisDetail: "summary" | "standard" | "full";
|
|
6082
|
+
}
|
|
6083
|
+
interface OpenClawPluginApi {
|
|
6084
|
+
registerTool(id: string, definition: {
|
|
6085
|
+
description: string;
|
|
6086
|
+
parameters: Record<string, unknown>;
|
|
6087
|
+
handler: (params: Record<string, unknown>, context: ToolContext) => Promise<unknown>;
|
|
6088
|
+
}): void;
|
|
6089
|
+
registerCommand(definition: {
|
|
6090
|
+
name: string;
|
|
6091
|
+
description: string;
|
|
6092
|
+
acceptsArgs: boolean;
|
|
6093
|
+
handler: (ctx: CommandContext) => {
|
|
6094
|
+
text: string;
|
|
6095
|
+
};
|
|
6096
|
+
}): void;
|
|
6097
|
+
on(event: string, handler: (event: HookEvent) => void | Promise<void>): void;
|
|
6098
|
+
getConfig(): OpenClawPluginConfig;
|
|
6099
|
+
}
|
|
6100
|
+
interface ToolContext {
|
|
6101
|
+
getConversationHistory?(): Array<{
|
|
6102
|
+
role: string;
|
|
6103
|
+
content: string;
|
|
6104
|
+
}>;
|
|
6105
|
+
}
|
|
6106
|
+
interface CommandContext {
|
|
6107
|
+
args?: string;
|
|
6108
|
+
}
|
|
6109
|
+
interface HookEvent {
|
|
6110
|
+
appendSystemContext?(text: string): void;
|
|
6111
|
+
prependSystemContext?(text: string): void;
|
|
6112
|
+
}
|
|
6113
|
+
declare function register(api: OpenClawPluginApi): void;
|
|
6114
|
+
|
|
6115
|
+
export { ARCHETYPES, ATTACHMENT_STYLES, type AdversarialCallbacks, type AdversarialCategory, type AdversarialReport, type AdversarialResult, type AdversarialRunOptions, type AdversarialScenario, type AlpacaExample, type AnonymizedPatternReport, AnthropicProvider, type ArchetypeTemplate, type AssessmentReport, type AssessmentResult, type AssetReview, type AssetType, type AttachmentStyle, type AuditEntry, type AuditEventType, type AutopilotResult, type AutopilotThreshold, type AwarenessDimension, BUILT_IN_DETECTORS, type BehavioralBaseline, type BehavioralCredential, type BehavioralEvent, type BehavioralEventType, type BehavioralGap, type BehavioralIndex, type BehavioralMemoryStore, type BehavioralPolicy, type BehavioralPolicyRule, type BehavioralPreset, type BenchmarkCallbacks, type BenchmarkComparison, type BenchmarkReport, type BenchmarkResult, type BenchmarkScenario, type BigFive, CATEGORIES, type CallbackMode, type CallbackStats, type CallbackViolation, type CertifyInput, type Communication, type CompactionResult, type CompactionSummary, type CompileInput, type CompiledConfig, type CompiledEmbodiedConfig, type ReACTStep as ComplianceReACTStep, type ComplianceReport, type ContextLayerInput, type Conversation, type ConversationLog, type CorpusFilter, type CorpusStats, type CorrectionRecord, type CrossAgentQuery, type CustomDetectorConfig, DEFAULT_OVERSIGHT, DIMENSIONS, type DPOPair, type DetectedPattern, type DetectorFactory, type DetectorFn$1 as DetectorFn, type DetectorOptions, type DiagnosisResult, type DimensionTrajectory, type Domain, type DriftTrigger, type EdgeType, type Embodiment, type EvolutionEntry, type EvolutionHistory, type EvolutionSummary, type EvolveCallbacks, type EvolveOptions, type EvolveResult, type Expression, type FleetAgent, type FleetAgentStatus, type FleetConfig, type FleetHandle, type FleetOptions, type FrameworkSection, type GazePolicy, type Gesture, type GraphEdge, type GraphNode, type Growth, type GrowthArea, type GrowthReport, type GrowthSnapshot, Guard, type GuardEntry, type GuardFilterResult, type GuardMiddleware, type GuardMiddlewareOptions, type GuardMiddlewareStats, type GuardMode, type GuardResult, type GuardViolation, type GuardWrapResult, type HFPushOptions, type HFPushResult, type HapticPolicy, HolomimeCallbackHandler, type HolomimeCallbackOptions, HolomimeViolationError, type HubDetector, type IndexComparison, type IndexEntry, type Intervention, type InterventionRepertoire, type InterventionSource, type InterviewCallbacks, type InterviewProbe, type InterviewResponse, type InterviewResult, type IterationResult, type KnowledgeGraph, LEARNING_ORIENTATIONS, type LLMMessage, type LLMProvider, type LeaderboardEntry, type LeaderboardSubmission, type LearningOrientation, LocalMarketplaceBackend, type LogFormat, type MarketplaceAsset, type MarketplaceBackend, MarketplaceClient, type MarketplaceSearchQuery, type MarketplaceSearchResult, type Message, type Modality, type MonitoringCertificate, type Morphology, type MotionParameters, type NetworkCallbacks, type NetworkConfig, type NetworkNode, type NetworkResult, type NetworkSession, type NodeType, OllamaProvider, OpenAIProvider, type OpenClawPluginApi, type OpenClawPluginConfig, type OutcomeReport, type OversightAction, type OversightMode, type OversightNotification, type OversightPolicy, PROVIDER_PARAMS, type PairingStrategy, type PatternCorrelation, type PatternDelta, type PatternReport, type PatternStatus, type PatternTracker, type PersonalitySpec, type PersonalityTier, type PhaseConfig, type PhysicalSafety, type PolicyIntent, type PreSessionDiagnosis, type Prescription, type Prosody, type Provider, type ProviderConfig, type ProxemicZone, type PublishRequest, type PublishedBenchmark, type RLHFExample, type ReACTAction, type ReACTContext, type ReACTReport, type ReACTReportOptions, type ReACTStep$1 as ReACTStep, type Registry, type RegistryEntry, type ReportStatistics, type RiskFinding, type RollingContext, STANDARD_PROBES, SURFACE_MULTIPLIERS, type SafetyEnvelope, type SelfAuditFlag, type SelfAuditResult, type SelfObservation, type SessionCallbacks, type SessionOptions, type SessionOutcome, type SessionSummary, type SessionTranscript, type SessionTurn, type Severity, type SharedIntervention, type SharedKnowledge, type SortField, type StagingDiff, type Surface, type SyncAnchor, type SyncProfile, type SyncRule, THERAPIST_META_SPEC, THERAPY_DIMENSIONS, THERAPY_PHASES, type TherapistPromptOptions, type TherapyDimensions, type TherapyMemory, type TherapyPhase, type TieredPersonality, type TrainingExport, type TraitAlignment, type TraitScores, type TreatmentGoal, type TreatmentPlan, type TreatmentProgressReport, type VerifyResult, type WatchCallbacks, type WatchEvent, type WatchHandle, type WatchOptions, type WrapAgentOptions, type WrapOptions, type WrappedAgent, addEdge, addNode, addSessionToMemory, agentHandleFromSpec, appendAuditEntry, appendEvolution, applyRecommendations, bigFiveSchema, buildAgentTherapistPrompt, buildAnonymizedReport, buildPatientSystemPrompt, buildReACTContext, buildReACTFraming, buildSharedKnowledge, buildTherapistSystemPrompt, checkApproval, checkIterationBudget, communicationSchema, compactEvolutionRun, compactIteration, compareBenchmarks, compareIndex, compile, compileCustomDetector, compileEmbodied, compileForOpenClaw, compileL0, compileL1, compileL2, compileTiered, compiledConfigSchema, compiledEmbodiedConfigSchema, computeDimensionScore, computeGazePolicy, computeMotionParameters, computeProsody, computeProxemics, computeSyncProfile, conversationLogSchema, conversationSchema, convertToHFFormat, copyToClipboard, corpusStats, createBehavioralMemory, createGist, createGraph, createGuardMiddleware, createIndex, createIndexEntry, createMemory, createProvider, createRepertoire, createTreatmentPlan, decayUnseenPatterns, deepMergeSpec, detectApologies, detectBoundaryIssues, detectFormalityIssues, detectHedging, detectRecoveryPatterns, detectRetrievalQuality, detectSentiment, detectVerbosity, discoverAgentData, discoverAgents, discoverNetworkAgents, domainSchema, embodimentSchema, emitBehavioralEvent, encodeSnapshot, estimateConfidence, evaluateOutcome, expireOldEdges, exportTrainingData, expressionSchema, extractAlpacaExamples, extractDPOPairs, extractDPOPairsWithLLM, extractRLHFExamples, extractRecommendations, fetchLeaderboard, fetchPersonality, fetchRegistry, findCrossAgentCorrelations, findEdges, findNode, findNodesByType, formatComplianceReportMarkdown, formatGapSummary, formatPolicyYaml, formatReACTReportMarkdown, gazePolicySchema, generateBehavioralPolicy, generateBenchmarkMarkdown, generateComparisonMarkdown, generateComplianceReport, generateCredential, generateGapRecommendation, generateIndexMarkdown, generateMonitoringCertificate, generateMutations, generatePrescriptions, generateProgressReport, generateReACTReport, generateShareUrl, generateSystemPrompt, gestureSchema, getAdversarialCategories, getAdversarialScenarios, getAgentBehaviors, getArchetype, getArchetypesByCategory, getBehavioralMemorySummary, getBenchmarkScenarios, getBestCorrection, getCategories, getDetector, getDimension, getEvolutionSummary, getInheritanceChain, getInterviewContext, getMarketplaceClient, getMemoryContext, getNeighbors, getPhaseContext, getPreset, getScenarioById, getTotalSignalCount, getTrajectory, getTriggersForPattern, graphStats, growthAreaSchema, growthSchema, hapticPolicySchema, hashSpec, learnIntervention, listArchetypeIds, listDetectors, listDetectorsByCategory, listDetectorsByTag, listPresets, loadAuditLog, loadBehavioralMemory, loadBenchmarkResults, loadCorpus, loadCustomDetectors, loadEvolution, loadFleetConfig, loadGraph, loadLatestBenchmark, loadMemory, loadNetworkConfig, loadRepertoire, loadSpec, loadTranscripts, loadTreatmentPlan, mergeStores, messageSchema, modalitySchema, morphologySchema, motionParametersSchema, pairAgents, parseAnthropicAPILog, parseChatGPTExport, parseClaudeExport, parseConversationLog, parseConversationLogFromString, parseJSONLLog, parseMarkdownDetector, parseOTelGenAIExport, parseOpenAIAPILog, personalitySpecSchema, physicalSafetySchema, populateFromDiagnosis, populateFromEvolve, populateFromSession, prescribeDPOPairs, processReACTResponse, prosodySchema, providerSchema, proxemicZoneSchema, publishToLeaderboard, pushToHFHub, queryCorpus, queryInterventions, querySharedKnowledge, recommendTier, recordInterventionOutcome, recordObservation, recordSelfObservation, recordSessionOutcome, registerBuiltInDetectors, registerDetector, register as registerOpenClawPlugin, resetMarketplaceClient, resolveInheritance, resolveOversight, runAdversarialSuite, runAssessment, runAutopilot, runBenchmark, runDiagnosis, runEvolve, runInterview, runNetwork, runPreSessionDiagnosis, runSelfAudit, runTherapySession, safetyEnvelopeSchema, saveBehavioralMemory, saveBenchmarkResult, saveCredential, saveGraph, saveMemory, saveRepertoire, saveTranscript, saveTreatmentPlan, scoreLabel, scoreTraitsFromMessages, seedBuiltInPersonalities, selectIntervention, severityMeetsThreshold, severitySchema, shareAnonymizedPatterns, shareFromDiagnosis, startFleet, startMCPServer, startWatch, summarize, summarizeSessionForMemory, summarizeTherapy, surfaceSchema, syncAnchorSchema, syncProfileSchema, syncRuleSchema, therapyDimensionsSchema, therapyScoreLabel, transferIntervention, unregisterDetector, updateEdgeWeight, validateDetectorConfig, verifyAuditChain, verifyCredential, wrapAgent };
|