holomime 1.1.1 → 1.3.0
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 +47 -18
- package/dist/cli.js +1860 -349
- package/dist/index.d.ts +469 -8
- package/dist/index.js +1702 -164
- package/dist/mcp-server.js +1139 -203
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -2772,6 +2772,18 @@ declare function loadCorpus(corpusPath?: string): BehavioralEvent[];
|
|
|
2772
2772
|
* Compute summary statistics over a corpus of behavioral events.
|
|
2773
2773
|
*/
|
|
2774
2774
|
declare function corpusStats(events: BehavioralEvent[]): CorpusStats;
|
|
2775
|
+
interface CorpusFilter {
|
|
2776
|
+
agent?: string;
|
|
2777
|
+
eventType?: BehavioralEventType;
|
|
2778
|
+
since?: string;
|
|
2779
|
+
until?: string;
|
|
2780
|
+
limit?: number;
|
|
2781
|
+
}
|
|
2782
|
+
/**
|
|
2783
|
+
* Query the behavioral corpus with filters.
|
|
2784
|
+
* Returns matching events, most recent first.
|
|
2785
|
+
*/
|
|
2786
|
+
declare function queryCorpus(filters?: CorpusFilter, corpusPath?: string): BehavioralEvent[];
|
|
2775
2787
|
|
|
2776
2788
|
/**
|
|
2777
2789
|
* Unified LLM provider interface for HoloMime.
|
|
@@ -2809,6 +2821,127 @@ interface PreSessionDiagnosis {
|
|
|
2809
2821
|
}
|
|
2810
2822
|
declare function runPreSessionDiagnosis(messages: Message[], spec: any): PreSessionDiagnosis;
|
|
2811
2823
|
|
|
2824
|
+
/**
|
|
2825
|
+
* Persistent Therapy Memory — therapist remembers previous sessions.
|
|
2826
|
+
*
|
|
2827
|
+
* Storage: .holomime/memory/{agent-handle}/therapy-memory.json
|
|
2828
|
+
* No external dependencies — local JSON files only.
|
|
2829
|
+
*/
|
|
2830
|
+
|
|
2831
|
+
interface SessionSummary {
|
|
2832
|
+
date: string;
|
|
2833
|
+
severity: "routine" | "targeted" | "intervention";
|
|
2834
|
+
patternsDiscussed: string[];
|
|
2835
|
+
keyInsight: string;
|
|
2836
|
+
interventionsUsed: string[];
|
|
2837
|
+
tesScore: number | null;
|
|
2838
|
+
turnCount: number;
|
|
2839
|
+
}
|
|
2840
|
+
type PatternStatus = "active" | "improving" | "resolved" | "relapsed";
|
|
2841
|
+
interface PatternTracker {
|
|
2842
|
+
patternId: string;
|
|
2843
|
+
firstDetected: string;
|
|
2844
|
+
sessionCount: number;
|
|
2845
|
+
status: PatternStatus;
|
|
2846
|
+
interventionsAttempted: string[];
|
|
2847
|
+
lastSeverity: string;
|
|
2848
|
+
lastSeen: string;
|
|
2849
|
+
}
|
|
2850
|
+
interface RollingContext {
|
|
2851
|
+
recentSummaries: SessionSummary[];
|
|
2852
|
+
persistentThemes: string[];
|
|
2853
|
+
carryForwardNotes: string;
|
|
2854
|
+
}
|
|
2855
|
+
interface TherapyMemory {
|
|
2856
|
+
agentHandle: string;
|
|
2857
|
+
agentName: string;
|
|
2858
|
+
createdAt: string;
|
|
2859
|
+
lastUpdatedAt: string;
|
|
2860
|
+
totalSessions: number;
|
|
2861
|
+
sessions: SessionSummary[];
|
|
2862
|
+
patterns: PatternTracker[];
|
|
2863
|
+
rollingContext: RollingContext;
|
|
2864
|
+
}
|
|
2865
|
+
declare function loadMemory(agentHandle: string): TherapyMemory | null;
|
|
2866
|
+
declare function saveMemory(memory: TherapyMemory): string;
|
|
2867
|
+
declare function createMemory(agentHandle: string, agentName: string): TherapyMemory;
|
|
2868
|
+
/**
|
|
2869
|
+
* Add a completed session to the agent's therapy memory.
|
|
2870
|
+
* Updates pattern trackers, rolling context, and session history.
|
|
2871
|
+
*/
|
|
2872
|
+
declare function addSessionToMemory(memory: TherapyMemory, transcript: SessionTranscript, tesScore: number | null, provider?: LLMProvider): Promise<void>;
|
|
2873
|
+
/**
|
|
2874
|
+
* LLM-assisted session condensation for memory storage.
|
|
2875
|
+
* Falls back to rule-based extraction if LLM fails.
|
|
2876
|
+
*/
|
|
2877
|
+
declare function summarizeSessionForMemory(transcript: SessionTranscript, provider: LLMProvider): Promise<string>;
|
|
2878
|
+
/**
|
|
2879
|
+
* Format therapy memory for injection into the therapist system prompt.
|
|
2880
|
+
* Kept concise (~500 tokens) to avoid overwhelming the context.
|
|
2881
|
+
*/
|
|
2882
|
+
declare function getMemoryContext(memory: TherapyMemory): string;
|
|
2883
|
+
/**
|
|
2884
|
+
* Derive the agent handle from a spec for memory lookup.
|
|
2885
|
+
*/
|
|
2886
|
+
declare function agentHandleFromSpec(spec: any): string;
|
|
2887
|
+
|
|
2888
|
+
/**
|
|
2889
|
+
* Interview System — structured self-awareness probes for AI agents.
|
|
2890
|
+
*
|
|
2891
|
+
* Scores an agent's metacognition across 4 dimensions and identifies
|
|
2892
|
+
* blind spots. Results feed into the therapist prompt to improve
|
|
2893
|
+
* therapy session quality.
|
|
2894
|
+
*
|
|
2895
|
+
* Inspired by MiroFish's multi-agent interview system.
|
|
2896
|
+
*/
|
|
2897
|
+
|
|
2898
|
+
type AwarenessDimension = "self_awareness" | "limitation_awareness" | "pattern_awareness" | "growth_orientation";
|
|
2899
|
+
interface InterviewProbe {
|
|
2900
|
+
id: string;
|
|
2901
|
+
question: string;
|
|
2902
|
+
dimension: AwarenessDimension;
|
|
2903
|
+
scoringCriteria: string;
|
|
2904
|
+
}
|
|
2905
|
+
interface InterviewResponse {
|
|
2906
|
+
probeId: string;
|
|
2907
|
+
question: string;
|
|
2908
|
+
agentResponse: string;
|
|
2909
|
+
awarenessScore: number;
|
|
2910
|
+
blindSpots: string[];
|
|
2911
|
+
insights: string[];
|
|
2912
|
+
dimension: AwarenessDimension;
|
|
2913
|
+
}
|
|
2914
|
+
interface InterviewResult {
|
|
2915
|
+
agentName: string;
|
|
2916
|
+
timestamp: string;
|
|
2917
|
+
responses: InterviewResponse[];
|
|
2918
|
+
overallAwareness: number;
|
|
2919
|
+
blindSpots: string[];
|
|
2920
|
+
strengths: string[];
|
|
2921
|
+
recommendedFocus: string[];
|
|
2922
|
+
dimensionScores: Record<AwarenessDimension, number>;
|
|
2923
|
+
}
|
|
2924
|
+
interface InterviewCallbacks {
|
|
2925
|
+
onProbeStart?: (probeIndex: number, total: number, question: string) => void;
|
|
2926
|
+
onAgentResponse?: (probeIndex: number, response: string) => void;
|
|
2927
|
+
onProbeScored?: (probeIndex: number, score: number) => void;
|
|
2928
|
+
onThinking?: (label: string) => {
|
|
2929
|
+
stop: () => void;
|
|
2930
|
+
};
|
|
2931
|
+
}
|
|
2932
|
+
declare const STANDARD_PROBES: InterviewProbe[];
|
|
2933
|
+
/**
|
|
2934
|
+
* Run a full interview with an AI agent.
|
|
2935
|
+
*
|
|
2936
|
+
* Each probe is presented to the agent via LLM, then the response
|
|
2937
|
+
* is scored by the LLM against the scoring criteria.
|
|
2938
|
+
*/
|
|
2939
|
+
declare function runInterview(spec: any, provider: LLMProvider, callbacks?: InterviewCallbacks, probes?: InterviewProbe[]): Promise<InterviewResult>;
|
|
2940
|
+
/**
|
|
2941
|
+
* Format interview results for injection into the therapist prompt.
|
|
2942
|
+
*/
|
|
2943
|
+
declare function getInterviewContext(result: InterviewResult): string;
|
|
2944
|
+
|
|
2812
2945
|
/**
|
|
2813
2946
|
* Therapy Protocol — Structures the conversation between the therapist
|
|
2814
2947
|
* and the agent (patient) into therapeutic phases.
|
|
@@ -2836,7 +2969,12 @@ declare const THERAPY_PHASES: Record<TherapyPhase, PhaseConfig>;
|
|
|
2836
2969
|
* Build the therapist system prompt — the master prompt that drives
|
|
2837
2970
|
* the therapist's behavior throughout the therapy session.
|
|
2838
2971
|
*/
|
|
2839
|
-
|
|
2972
|
+
interface TherapistPromptOptions {
|
|
2973
|
+
memory?: TherapyMemory;
|
|
2974
|
+
interview?: InterviewResult;
|
|
2975
|
+
useReACT?: boolean;
|
|
2976
|
+
}
|
|
2977
|
+
declare function buildTherapistSystemPrompt(spec: any, diagnosis: PreSessionDiagnosis, options?: TherapistPromptOptions): string;
|
|
2840
2978
|
/**
|
|
2841
2979
|
* Build the patient (agent) system prompt — so the agent responds
|
|
2842
2980
|
* as itself during the therapy session.
|
|
@@ -2875,6 +3013,14 @@ interface SessionOptions {
|
|
|
2875
3013
|
callbacks?: SessionCallbacks;
|
|
2876
3014
|
/** Enable human-in-the-loop mode — pauses after each exchange for supervisor input. */
|
|
2877
3015
|
interactive?: boolean;
|
|
3016
|
+
/** Inject therapy memory for session continuity. */
|
|
3017
|
+
memory?: TherapyMemory;
|
|
3018
|
+
/** Inject interview results for targeted therapy. */
|
|
3019
|
+
interview?: InterviewResult;
|
|
3020
|
+
/** Enable ReACT structured reasoning for therapist. */
|
|
3021
|
+
useReACT?: boolean;
|
|
3022
|
+
/** Save memory and graph after session completes. */
|
|
3023
|
+
persistState?: boolean;
|
|
2878
3024
|
}
|
|
2879
3025
|
/**
|
|
2880
3026
|
* Run a full therapy session (7 phases, dual-LLM).
|
|
@@ -3707,6 +3853,7 @@ declare class OpenAIProvider implements LLMProvider {
|
|
|
3707
3853
|
modelName: string;
|
|
3708
3854
|
private apiKey;
|
|
3709
3855
|
constructor(apiKey: string, model?: string);
|
|
3856
|
+
private fetchWithRetry;
|
|
3710
3857
|
chat(messages: LLMMessage[]): Promise<string>;
|
|
3711
3858
|
chatStream(messages: LLMMessage[]): AsyncGenerator<string>;
|
|
3712
3859
|
}
|
|
@@ -3965,7 +4112,7 @@ declare function createGist(spec: unknown, handle: string, token: string): Promi
|
|
|
3965
4112
|
*/
|
|
3966
4113
|
|
|
3967
4114
|
/** A detector is any function that analyzes messages and optionally returns a pattern. */
|
|
3968
|
-
type DetectorFn = (messages: Message[]) => DetectedPattern | null;
|
|
4115
|
+
type DetectorFn$1 = (messages: Message[]) => DetectedPattern | null;
|
|
3969
4116
|
/** Options for configuring a detector instance. */
|
|
3970
4117
|
interface DetectorOptions {
|
|
3971
4118
|
/** Override the default severity threshold. */
|
|
@@ -3976,7 +4123,7 @@ interface DetectorOptions {
|
|
|
3976
4123
|
[key: string]: unknown;
|
|
3977
4124
|
}
|
|
3978
4125
|
/** A configurable detector factory — returns a DetectorFn with options baked in. */
|
|
3979
|
-
type DetectorFactory = (options?: DetectorOptions) => DetectorFn;
|
|
4126
|
+
type DetectorFactory = (options?: DetectorOptions) => DetectorFn$1;
|
|
3980
4127
|
interface HubDetector {
|
|
3981
4128
|
/** Unique identifier (e.g., "holomime/apology" or "community/jargon-checker"). */
|
|
3982
4129
|
id: string;
|
|
@@ -3993,7 +4140,7 @@ interface HubDetector {
|
|
|
3993
4140
|
/** Number of distinct signals this detector checks. */
|
|
3994
4141
|
signalCount: number;
|
|
3995
4142
|
/** The detector function. */
|
|
3996
|
-
detect: DetectorFn;
|
|
4143
|
+
detect: DetectorFn$1;
|
|
3997
4144
|
/** Optional: configurable factory. */
|
|
3998
4145
|
factory?: DetectorFactory;
|
|
3999
4146
|
/** Tags for discovery. */
|
|
@@ -4067,7 +4214,7 @@ interface GuardResult {
|
|
|
4067
4214
|
severity: "clean" | "warning" | "concern";
|
|
4068
4215
|
}
|
|
4069
4216
|
interface GuardEntry {
|
|
4070
|
-
detector: DetectorFn;
|
|
4217
|
+
detector: DetectorFn$1;
|
|
4071
4218
|
id?: string;
|
|
4072
4219
|
}
|
|
4073
4220
|
declare class Guard {
|
|
@@ -4085,7 +4232,7 @@ declare class Guard {
|
|
|
4085
4232
|
* - A HubDetector object: `guard.use(myCustomDetector)`
|
|
4086
4233
|
* - A DetectorFactory with options: `guard.use(myFactory, { threshold: 0.3 })`
|
|
4087
4234
|
*/
|
|
4088
|
-
use(detector: DetectorFn | string | HubDetector, options?: DetectorOptions): Guard;
|
|
4235
|
+
use(detector: DetectorFn$1 | string | HubDetector, options?: DetectorOptions): Guard;
|
|
4089
4236
|
/** Add all built-in detectors to the guard. */
|
|
4090
4237
|
useAll(): Guard;
|
|
4091
4238
|
/** Run all chained detectors against the messages. */
|
|
@@ -4249,6 +4396,320 @@ declare function checkIterationBudget(currentIteration: number, policy: Oversigh
|
|
|
4249
4396
|
limit: number;
|
|
4250
4397
|
};
|
|
4251
4398
|
|
|
4399
|
+
/**
|
|
4400
|
+
* Behavioral Knowledge Graph — tracks what interventions work.
|
|
4401
|
+
*
|
|
4402
|
+
* A local graph database that connects agents, behaviors, triggers,
|
|
4403
|
+
* interventions, and outcomes. Enables cross-agent learning by
|
|
4404
|
+
* recording which interventions improve which patterns.
|
|
4405
|
+
*
|
|
4406
|
+
* Storage: .holomime/graph/knowledge-graph.json
|
|
4407
|
+
* Temporal semantics: edges have weight, validAt, lastConfirmed, expired.
|
|
4408
|
+
*/
|
|
4409
|
+
|
|
4410
|
+
type NodeType = "agent" | "behavior" | "trigger" | "intervention" | "outcome";
|
|
4411
|
+
type EdgeType = "exhibits" | "triggers" | "treats" | "improves" | "worsens" | "correlates";
|
|
4412
|
+
interface GraphNode {
|
|
4413
|
+
id: string;
|
|
4414
|
+
type: NodeType;
|
|
4415
|
+
label: string;
|
|
4416
|
+
metadata: Record<string, unknown>;
|
|
4417
|
+
createdAt: string;
|
|
4418
|
+
}
|
|
4419
|
+
interface GraphEdge {
|
|
4420
|
+
source: string;
|
|
4421
|
+
target: string;
|
|
4422
|
+
type: EdgeType;
|
|
4423
|
+
weight: number;
|
|
4424
|
+
validAt: string;
|
|
4425
|
+
lastConfirmed: string;
|
|
4426
|
+
expired: boolean;
|
|
4427
|
+
}
|
|
4428
|
+
interface KnowledgeGraph {
|
|
4429
|
+
version: 1;
|
|
4430
|
+
nodes: GraphNode[];
|
|
4431
|
+
edges: GraphEdge[];
|
|
4432
|
+
lastUpdated: string;
|
|
4433
|
+
}
|
|
4434
|
+
declare function loadGraph(): KnowledgeGraph;
|
|
4435
|
+
declare function saveGraph(graph: KnowledgeGraph): string;
|
|
4436
|
+
declare function createGraph(): KnowledgeGraph;
|
|
4437
|
+
declare function addNode(graph: KnowledgeGraph, id: string, type: NodeType, label: string, metadata?: Record<string, unknown>): GraphNode;
|
|
4438
|
+
declare function addEdge(graph: KnowledgeGraph, source: string, target: string, type: EdgeType, weight?: number): GraphEdge;
|
|
4439
|
+
declare function findNode(graph: KnowledgeGraph, id: string): GraphNode | undefined;
|
|
4440
|
+
declare function findNodesByType(graph: KnowledgeGraph, type: NodeType): GraphNode[];
|
|
4441
|
+
declare function findEdges(graph: KnowledgeGraph, opts: {
|
|
4442
|
+
source?: string;
|
|
4443
|
+
target?: string;
|
|
4444
|
+
type?: EdgeType;
|
|
4445
|
+
}): GraphEdge[];
|
|
4446
|
+
declare function getNeighbors(graph: KnowledgeGraph, nodeId: string): GraphNode[];
|
|
4447
|
+
/**
|
|
4448
|
+
* Find interventions that have been effective for a specific pattern.
|
|
4449
|
+
* Returns interventions sorted by edge weight (effectiveness).
|
|
4450
|
+
*/
|
|
4451
|
+
declare function queryInterventions(graph: KnowledgeGraph, patternId: string): {
|
|
4452
|
+
intervention: GraphNode;
|
|
4453
|
+
weight: number;
|
|
4454
|
+
}[];
|
|
4455
|
+
/**
|
|
4456
|
+
* Get all behaviors exhibited by a specific agent.
|
|
4457
|
+
*/
|
|
4458
|
+
declare function getAgentBehaviors(graph: KnowledgeGraph, agentHandle: string): {
|
|
4459
|
+
behavior: GraphNode;
|
|
4460
|
+
weight: number;
|
|
4461
|
+
}[];
|
|
4462
|
+
/**
|
|
4463
|
+
* Populate graph from a diagnosis result.
|
|
4464
|
+
*/
|
|
4465
|
+
declare function populateFromDiagnosis(graph: KnowledgeGraph, agentHandle: string, agentName: string, patterns: DetectedPattern[]): void;
|
|
4466
|
+
/**
|
|
4467
|
+
* Populate graph from a completed therapy session.
|
|
4468
|
+
*/
|
|
4469
|
+
declare function populateFromSession(graph: KnowledgeGraph, agentHandle: string, transcript: SessionTranscript): void;
|
|
4470
|
+
/**
|
|
4471
|
+
* Populate graph from an evolve iteration result.
|
|
4472
|
+
*/
|
|
4473
|
+
declare function populateFromEvolve(graph: KnowledgeGraph, agentHandle: string, patternsDetected: string[], patternsResolved: string[], interventions: string[], health: number): void;
|
|
4474
|
+
/**
|
|
4475
|
+
* Update an edge's weight (e.g., after evaluating intervention effectiveness).
|
|
4476
|
+
*/
|
|
4477
|
+
declare function updateEdgeWeight(graph: KnowledgeGraph, source: string, target: string, type: EdgeType, newWeight: number): void;
|
|
4478
|
+
/**
|
|
4479
|
+
* Expire edges older than the given threshold (days).
|
|
4480
|
+
*/
|
|
4481
|
+
declare function expireOldEdges(graph: KnowledgeGraph, maxAgeDays?: number): number;
|
|
4482
|
+
/**
|
|
4483
|
+
* Get graph statistics.
|
|
4484
|
+
*/
|
|
4485
|
+
declare function graphStats(graph: KnowledgeGraph): {
|
|
4486
|
+
nodes: number;
|
|
4487
|
+
edges: number;
|
|
4488
|
+
agents: number;
|
|
4489
|
+
behaviors: number;
|
|
4490
|
+
interventions: number;
|
|
4491
|
+
activeEdges: number;
|
|
4492
|
+
};
|
|
4493
|
+
|
|
4494
|
+
/**
|
|
4495
|
+
* Self-Improving Intervention Tracker — interventions that learn from outcomes.
|
|
4496
|
+
*
|
|
4497
|
+
* If intervention X failed for pattern Y, auto-escalate to Z.
|
|
4498
|
+
* Tracks success rates, filters previously failed, and learns new
|
|
4499
|
+
* interventions from successful therapy sessions.
|
|
4500
|
+
*
|
|
4501
|
+
* Storage: .holomime/interventions/repertoire.json
|
|
4502
|
+
*/
|
|
4503
|
+
|
|
4504
|
+
type InterventionSource = "built-in" | "learned" | "cross-agent";
|
|
4505
|
+
interface Intervention {
|
|
4506
|
+
id: string;
|
|
4507
|
+
name: string;
|
|
4508
|
+
targetPatterns: string[];
|
|
4509
|
+
specChanges: Record<string, unknown>;
|
|
4510
|
+
promptGuidance: string;
|
|
4511
|
+
escalationLevel: 1 | 2 | 3;
|
|
4512
|
+
successRate: number;
|
|
4513
|
+
timesUsed: number;
|
|
4514
|
+
timesSucceeded: number;
|
|
4515
|
+
source: InterventionSource;
|
|
4516
|
+
createdAt: string;
|
|
4517
|
+
}
|
|
4518
|
+
interface InterventionRepertoire {
|
|
4519
|
+
version: 1;
|
|
4520
|
+
interventions: Intervention[];
|
|
4521
|
+
lastUpdated: string;
|
|
4522
|
+
}
|
|
4523
|
+
declare function loadRepertoire(): InterventionRepertoire;
|
|
4524
|
+
declare function saveRepertoire(repertoire: InterventionRepertoire): string;
|
|
4525
|
+
declare function createRepertoire(): InterventionRepertoire;
|
|
4526
|
+
/**
|
|
4527
|
+
* Select the best intervention for a pattern.
|
|
4528
|
+
* Uses graph edge weights + success rates, filters previously failed,
|
|
4529
|
+
* and escalates level if lower levels have failed.
|
|
4530
|
+
*/
|
|
4531
|
+
declare function selectIntervention(repertoire: InterventionRepertoire, patternId: string, graph?: KnowledgeGraph): Intervention | null;
|
|
4532
|
+
/**
|
|
4533
|
+
* Record whether an intervention succeeded or failed.
|
|
4534
|
+
* Updates success rate using exponential moving average.
|
|
4535
|
+
*/
|
|
4536
|
+
declare function recordInterventionOutcome(repertoire: InterventionRepertoire, interventionId: string, success: boolean): void;
|
|
4537
|
+
/**
|
|
4538
|
+
* Learn new interventions from a successful therapy session.
|
|
4539
|
+
* Uses LLM to extract novel techniques from the transcript.
|
|
4540
|
+
*/
|
|
4541
|
+
declare function learnIntervention(repertoire: InterventionRepertoire, transcript: SessionTranscript, health: number, provider: LLMProvider): Promise<Intervention[]>;
|
|
4542
|
+
|
|
4543
|
+
/**
|
|
4544
|
+
* ReACT Reasoning for Therapist — structured Thought → Action → Observation → Response.
|
|
4545
|
+
*
|
|
4546
|
+
* Instead of free-form conversation, the therapist uses a structured
|
|
4547
|
+
* reasoning loop with tool-like actions that query local data.
|
|
4548
|
+
* No additional LLM calls — actions are pure local data queries.
|
|
4549
|
+
*
|
|
4550
|
+
* Inspired by MiroFish's ReACT agent architecture.
|
|
4551
|
+
*/
|
|
4552
|
+
|
|
4553
|
+
interface ReACTStep {
|
|
4554
|
+
thought: string;
|
|
4555
|
+
action: string;
|
|
4556
|
+
actionInput: string;
|
|
4557
|
+
observation: string;
|
|
4558
|
+
}
|
|
4559
|
+
interface ReACTContext {
|
|
4560
|
+
memory: TherapyMemory | null;
|
|
4561
|
+
graph: KnowledgeGraph;
|
|
4562
|
+
repertoire: InterventionRepertoire;
|
|
4563
|
+
diagnosis: PreSessionDiagnosis;
|
|
4564
|
+
agentHandle: string;
|
|
4565
|
+
}
|
|
4566
|
+
type ReACTAction = "assess_pattern" | "check_history" | "suggest_intervention" | "evaluate_progress" | "query_graph";
|
|
4567
|
+
/**
|
|
4568
|
+
* Build the ReACT framing section for the therapist system prompt.
|
|
4569
|
+
*/
|
|
4570
|
+
declare function buildReACTFraming(): string;
|
|
4571
|
+
/**
|
|
4572
|
+
* Parse ReACT reasoning from an LLM response and execute actions.
|
|
4573
|
+
* Returns the final response and the reasoning steps.
|
|
4574
|
+
*/
|
|
4575
|
+
declare function processReACTResponse(rawResponse: string, ctx: ReACTContext): {
|
|
4576
|
+
response: string;
|
|
4577
|
+
steps: ReACTStep[];
|
|
4578
|
+
};
|
|
4579
|
+
/**
|
|
4580
|
+
* Build a ReACT context from the current agent state.
|
|
4581
|
+
* Loads memory, graph, and repertoire from disk.
|
|
4582
|
+
*/
|
|
4583
|
+
declare function buildReACTContext(agentHandle: string, diagnosis: PreSessionDiagnosis): ReACTContext;
|
|
4584
|
+
|
|
4585
|
+
/**
|
|
4586
|
+
* Custom Behavioral Detectors — user-defined detectors as JSON config.
|
|
4587
|
+
*
|
|
4588
|
+
* Users define custom detectors in .holomime/detectors/*.json.
|
|
4589
|
+
* Each detector specifies regex patterns, weights, thresholds,
|
|
4590
|
+
* and prescriptions. No code, no arbitrary execution — just config.
|
|
4591
|
+
*
|
|
4592
|
+
* Inspired by Cognee's DataPoints abstraction.
|
|
4593
|
+
*/
|
|
4594
|
+
|
|
4595
|
+
declare const customDetectorConfigSchema: z.ZodObject<{
|
|
4596
|
+
id: z.ZodString;
|
|
4597
|
+
name: z.ZodString;
|
|
4598
|
+
description: z.ZodString;
|
|
4599
|
+
severity: z.ZodDefault<z.ZodEnum<["info", "warning", "concern"]>>;
|
|
4600
|
+
patterns: z.ZodArray<z.ZodObject<{
|
|
4601
|
+
regex: z.ZodString;
|
|
4602
|
+
weight: z.ZodDefault<z.ZodNumber>;
|
|
4603
|
+
}, "strip", z.ZodTypeAny, {
|
|
4604
|
+
regex: string;
|
|
4605
|
+
weight: number;
|
|
4606
|
+
}, {
|
|
4607
|
+
regex: string;
|
|
4608
|
+
weight?: number | undefined;
|
|
4609
|
+
}>, "many">;
|
|
4610
|
+
threshold: z.ZodDefault<z.ZodNumber>;
|
|
4611
|
+
prescription: z.ZodOptional<z.ZodString>;
|
|
4612
|
+
}, "strip", z.ZodTypeAny, {
|
|
4613
|
+
id: string;
|
|
4614
|
+
severity: "info" | "warning" | "concern";
|
|
4615
|
+
name: string;
|
|
4616
|
+
description: string;
|
|
4617
|
+
patterns: {
|
|
4618
|
+
regex: string;
|
|
4619
|
+
weight: number;
|
|
4620
|
+
}[];
|
|
4621
|
+
threshold: number;
|
|
4622
|
+
prescription?: string | undefined;
|
|
4623
|
+
}, {
|
|
4624
|
+
id: string;
|
|
4625
|
+
name: string;
|
|
4626
|
+
description: string;
|
|
4627
|
+
patterns: {
|
|
4628
|
+
regex: string;
|
|
4629
|
+
weight?: number | undefined;
|
|
4630
|
+
}[];
|
|
4631
|
+
severity?: "info" | "warning" | "concern" | undefined;
|
|
4632
|
+
prescription?: string | undefined;
|
|
4633
|
+
threshold?: number | undefined;
|
|
4634
|
+
}>;
|
|
4635
|
+
type CustomDetectorConfig = z.infer<typeof customDetectorConfigSchema>;
|
|
4636
|
+
declare function validateDetectorConfig(config: unknown): {
|
|
4637
|
+
valid: boolean;
|
|
4638
|
+
errors: string[];
|
|
4639
|
+
config?: CustomDetectorConfig;
|
|
4640
|
+
};
|
|
4641
|
+
type DetectorFn = (messages: Message[]) => DetectedPattern | undefined;
|
|
4642
|
+
/**
|
|
4643
|
+
* Compile a JSON detector config into a standard detector function.
|
|
4644
|
+
* The compiled function has the same signature as built-in detectors.
|
|
4645
|
+
*/
|
|
4646
|
+
declare function compileCustomDetector(config: CustomDetectorConfig): DetectorFn;
|
|
4647
|
+
/**
|
|
4648
|
+
* Load all custom detectors from .holomime/detectors/*.json.
|
|
4649
|
+
* Returns compiled detector functions ready to use alongside built-in detectors.
|
|
4650
|
+
*/
|
|
4651
|
+
declare function loadCustomDetectors(dir?: string): {
|
|
4652
|
+
detectors: DetectorFn[];
|
|
4653
|
+
errors: string[];
|
|
4654
|
+
};
|
|
4655
|
+
|
|
4656
|
+
/**
|
|
4657
|
+
* Cross-Agent Knowledge Sharing — fleet and network share learned interventions.
|
|
4658
|
+
*
|
|
4659
|
+
* What worked for Agent A informs Agent B. Aggregates interventions,
|
|
4660
|
+
* pattern correlations, and transferable DPO pairs across agents.
|
|
4661
|
+
*
|
|
4662
|
+
* Inspired by Cognee's multi-agent knowledge sharing architecture.
|
|
4663
|
+
*/
|
|
4664
|
+
|
|
4665
|
+
interface SharedKnowledge {
|
|
4666
|
+
effectiveInterventions: SharedIntervention[];
|
|
4667
|
+
patternCorrelations: PatternCorrelation[];
|
|
4668
|
+
agentCount: number;
|
|
4669
|
+
lastUpdated: string;
|
|
4670
|
+
}
|
|
4671
|
+
interface SharedIntervention {
|
|
4672
|
+
intervention: Intervention;
|
|
4673
|
+
usedByAgents: string[];
|
|
4674
|
+
globalSuccessRate: number;
|
|
4675
|
+
targetPatterns: string[];
|
|
4676
|
+
}
|
|
4677
|
+
interface PatternCorrelation {
|
|
4678
|
+
patternA: string;
|
|
4679
|
+
patternB: string;
|
|
4680
|
+
coOccurrenceRate: number;
|
|
4681
|
+
agentCount: number;
|
|
4682
|
+
}
|
|
4683
|
+
interface CrossAgentQuery {
|
|
4684
|
+
patternId: string;
|
|
4685
|
+
excludeAgent?: string;
|
|
4686
|
+
}
|
|
4687
|
+
/**
|
|
4688
|
+
* Build shared knowledge from multiple agents' graphs and repertoires.
|
|
4689
|
+
*/
|
|
4690
|
+
declare function buildSharedKnowledge(graphs: KnowledgeGraph[], repertoires: InterventionRepertoire[]): SharedKnowledge;
|
|
4691
|
+
/**
|
|
4692
|
+
* Query shared knowledge for interventions effective against a specific pattern.
|
|
4693
|
+
*/
|
|
4694
|
+
declare function querySharedKnowledge(query: CrossAgentQuery, shared: SharedKnowledge): SharedIntervention[];
|
|
4695
|
+
/**
|
|
4696
|
+
* Find pattern correlations involving a specific pattern.
|
|
4697
|
+
*/
|
|
4698
|
+
declare function findCrossAgentCorrelations(shared: SharedKnowledge, patternId: string): PatternCorrelation[];
|
|
4699
|
+
/**
|
|
4700
|
+
* Transfer an intervention from one agent's repertoire to another's.
|
|
4701
|
+
* Adapts the intervention for the target agent's context.
|
|
4702
|
+
*/
|
|
4703
|
+
declare function transferIntervention(intervention: Intervention, targetRepertoire: InterventionRepertoire): Intervention | null;
|
|
4704
|
+
/**
|
|
4705
|
+
* Discover all agent directories and load their graphs/repertoires.
|
|
4706
|
+
* Looks for .holomime/memory/ therapy-memory.json files, aggregates data.
|
|
4707
|
+
*/
|
|
4708
|
+
declare function discoverAgentData(baseDir?: string): {
|
|
4709
|
+
graphs: KnowledgeGraph[];
|
|
4710
|
+
repertoires: InterventionRepertoire[];
|
|
4711
|
+
};
|
|
4712
|
+
|
|
4252
4713
|
/**
|
|
4253
4714
|
* Network Core — multi-agent therapy mesh engine.
|
|
4254
4715
|
*
|
|
@@ -4265,7 +4726,7 @@ interface NetworkNode {
|
|
|
4265
4726
|
logDir?: string;
|
|
4266
4727
|
role?: "patient" | "therapist" | "both";
|
|
4267
4728
|
}
|
|
4268
|
-
type PairingStrategy = "severity" | "round-robin" | "complementary";
|
|
4729
|
+
type PairingStrategy = "severity" | "round-robin" | "complementary" | "knowledge";
|
|
4269
4730
|
interface NetworkConfig {
|
|
4270
4731
|
agents: NetworkNode[];
|
|
4271
4732
|
pairing: PairingStrategy;
|
|
@@ -4352,4 +4813,4 @@ declare const THERAPIST_META_SPEC: PersonalitySpec;
|
|
|
4352
4813
|
*/
|
|
4353
4814
|
declare function buildAgentTherapistPrompt(therapistSpec: PersonalitySpec, patientSpec: PersonalitySpec, diagnosis: PreSessionDiagnosis): string;
|
|
4354
4815
|
|
|
4355
|
-
export { ARCHETYPES, ATTACHMENT_STYLES, type AlpacaExample, AnthropicProvider, type ArchetypeTemplate, type AssessmentReport, type AssessmentResult, type AttachmentStyle, type AutopilotResult, type AutopilotThreshold, BUILT_IN_DETECTORS, type BehavioralCredential, type BehavioralEvent, type BehavioralEventType, type BehavioralIndex, type BenchmarkCallbacks, type BenchmarkComparison, type BenchmarkReport, type BenchmarkResult, type BenchmarkScenario, type BigFive, CATEGORIES, type CertifyInput, type Communication, type CompileInput, type CompiledConfig, type CompiledEmbodiedConfig, type Conversation, type ConversationLog, type CorpusStats, DEFAULT_OVERSIGHT, DIMENSIONS, type DPOPair, type DetectedPattern, type DetectorFactory, type DetectorFn, type DetectorOptions, type DiagnosisResult, type Domain, 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 GazePolicy, type Gesture, type Growth, type GrowthArea, type GrowthReport, type GrowthSnapshot, Guard, type GuardEntry, type GuardResult, type HFPushOptions, type HFPushResult, type HapticPolicy, type HubDetector, type IndexComparison, type IndexEntry, type IterationResult, LEARNING_ORIENTATIONS, type LLMMessage, type LLMProvider, type LearningOrientation, type LogFormat, type Message, type Modality, type Morphology, type MotionParameters, type NetworkCallbacks, type NetworkConfig, type NetworkNode, type NetworkResult, type NetworkSession, OllamaProvider, OpenAIProvider, type OutcomeReport, type OversightAction, type OversightMode, type OversightNotification, type OversightPolicy, PROVIDER_PARAMS, type PairingStrategy, type PatternDelta, type PatternReport, type PersonalitySpec, type PhaseConfig, type PhysicalSafety, type PreSessionDiagnosis, type Prescription, type Prosody, type Provider, type ProviderConfig, type ProxemicZone, type PublishedBenchmark, type RLHFExample, type Registry, type RegistryEntry, SURFACE_MULTIPLIERS, type SafetyEnvelope, type SelfAuditFlag, type SelfAuditResult, type SessionCallbacks, type SessionOptions, type SessionOutcome, type SessionTranscript, type SessionTurn, type Severity, type Surface, type SyncAnchor, type SyncProfile, type SyncRule, THERAPIST_META_SPEC, THERAPY_DIMENSIONS, THERAPY_PHASES, type TherapyDimensions, type TherapyPhase, 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 WrappedAgent, appendEvolution, applyRecommendations, bigFiveSchema, buildAgentTherapistPrompt, buildPatientSystemPrompt, buildTherapistSystemPrompt, checkApproval, checkIterationBudget, communicationSchema, compareBenchmarks, compareIndex, compile, compileEmbodied, compileForOpenClaw, compiledConfigSchema, compiledEmbodiedConfigSchema, computeDimensionScore, computeGazePolicy, computeMotionParameters, computeProsody, computeProxemics, computeSyncProfile, conversationLogSchema, conversationSchema, convertToHFFormat, corpusStats, createGist, createIndex, createIndexEntry, createProvider, createTreatmentPlan, deepMergeSpec, detectApologies, detectBoundaryIssues, detectFormalityIssues, detectHedging, detectRecoveryPatterns, detectSentiment, detectVerbosity, discoverAgents, discoverNetworkAgents, domainSchema, embodimentSchema, emitBehavioralEvent, evaluateOutcome, exportTrainingData, expressionSchema, extractAlpacaExamples, extractDPOPairs, extractDPOPairsWithLLM, extractRLHFExamples, extractRecommendations, fetchPersonality, fetchRegistry, gazePolicySchema, generateBenchmarkMarkdown, generateComparisonMarkdown, generateCredential, generateIndexMarkdown, generatePrescriptions, generateProgressReport, generateSystemPrompt, gestureSchema, getArchetype, getArchetypesByCategory, getBenchmarkScenarios, getCategories, getDetector, getDimension, getEvolutionSummary, getInheritanceChain, getScenarioById, getTotalSignalCount, growthAreaSchema, growthSchema, hapticPolicySchema, hashSpec, listArchetypeIds, listDetectors, listDetectorsByCategory, listDetectorsByTag, loadBenchmarkResults, loadCorpus, loadEvolution, loadFleetConfig, loadLatestBenchmark, loadNetworkConfig, loadSpec, loadTranscripts, loadTreatmentPlan, messageSchema, modalitySchema, morphologySchema, motionParametersSchema, pairAgents, parseAnthropicAPILog, parseChatGPTExport, parseClaudeExport, parseConversationLog, parseConversationLogFromString, parseJSONLLog, parseOTelGenAIExport, parseOpenAIAPILog, personalitySpecSchema, physicalSafetySchema, prescribeDPOPairs, prosodySchema, providerSchema, proxemicZoneSchema, pushToHFHub, recordSessionOutcome, registerBuiltInDetectors, registerDetector, resolveInheritance, resolveOversight, runAssessment, runAutopilot, runBenchmark, runDiagnosis, runEvolve, runNetwork, runPreSessionDiagnosis, runSelfAudit, runTherapySession, safetyEnvelopeSchema, saveBenchmarkResult, saveCredential, saveTranscript, saveTreatmentPlan, scoreLabel, scoreTraitsFromMessages, severityMeetsThreshold, severitySchema, startFleet, startMCPServer, startWatch, summarize, summarizeTherapy, surfaceSchema, syncAnchorSchema, syncProfileSchema, syncRuleSchema, therapyDimensionsSchema, therapyScoreLabel, unregisterDetector, verifyCredential, wrapAgent };
|
|
4816
|
+
export { ARCHETYPES, ATTACHMENT_STYLES, type AlpacaExample, AnthropicProvider, type ArchetypeTemplate, type AssessmentReport, type AssessmentResult, type AttachmentStyle, type AutopilotResult, type AutopilotThreshold, type AwarenessDimension, BUILT_IN_DETECTORS, type BehavioralCredential, type BehavioralEvent, type BehavioralEventType, type BehavioralIndex, type BenchmarkCallbacks, type BenchmarkComparison, type BenchmarkReport, type BenchmarkResult, type BenchmarkScenario, type BigFive, CATEGORIES, type CertifyInput, type Communication, type CompileInput, type CompiledConfig, type CompiledEmbodiedConfig, type Conversation, type ConversationLog, type CorpusFilter, type CorpusStats, type CrossAgentQuery, type CustomDetectorConfig, DEFAULT_OVERSIGHT, DIMENSIONS, type DPOPair, type DetectedPattern, type DetectorFactory, type DetectorFn$1 as DetectorFn, type DetectorOptions, type DiagnosisResult, type Domain, 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 GazePolicy, type Gesture, type GraphEdge, type GraphNode, type Growth, type GrowthArea, type GrowthReport, type GrowthSnapshot, Guard, type GuardEntry, type GuardResult, type HFPushOptions, type HFPushResult, type HapticPolicy, 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 LearningOrientation, type LogFormat, type Message, type Modality, type Morphology, type MotionParameters, type NetworkCallbacks, type NetworkConfig, type NetworkNode, type NetworkResult, type NetworkSession, type NodeType, OllamaProvider, OpenAIProvider, 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 PhaseConfig, type PhysicalSafety, type PreSessionDiagnosis, type Prescription, type Prosody, type Provider, type ProviderConfig, type ProxemicZone, type PublishedBenchmark, type RLHFExample, type ReACTAction, type ReACTContext, type ReACTStep, type Registry, type RegistryEntry, type RollingContext, STANDARD_PROBES, SURFACE_MULTIPLIERS, type SafetyEnvelope, type SelfAuditFlag, type SelfAuditResult, type SessionCallbacks, type SessionOptions, type SessionOutcome, type SessionSummary, type SessionTranscript, type SessionTurn, type Severity, type SharedIntervention, type SharedKnowledge, type Surface, type SyncAnchor, type SyncProfile, type SyncRule, THERAPIST_META_SPEC, THERAPY_DIMENSIONS, THERAPY_PHASES, type TherapistPromptOptions, type TherapyDimensions, type TherapyMemory, type TherapyPhase, 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 WrappedAgent, addEdge, addNode, addSessionToMemory, agentHandleFromSpec, appendEvolution, applyRecommendations, bigFiveSchema, buildAgentTherapistPrompt, buildPatientSystemPrompt, buildReACTContext, buildReACTFraming, buildSharedKnowledge, buildTherapistSystemPrompt, checkApproval, checkIterationBudget, communicationSchema, compareBenchmarks, compareIndex, compile, compileCustomDetector, compileEmbodied, compileForOpenClaw, compiledConfigSchema, compiledEmbodiedConfigSchema, computeDimensionScore, computeGazePolicy, computeMotionParameters, computeProsody, computeProxemics, computeSyncProfile, conversationLogSchema, conversationSchema, convertToHFFormat, corpusStats, createGist, createGraph, createIndex, createIndexEntry, createMemory, createProvider, createRepertoire, createTreatmentPlan, deepMergeSpec, detectApologies, detectBoundaryIssues, detectFormalityIssues, detectHedging, detectRecoveryPatterns, detectSentiment, detectVerbosity, discoverAgentData, discoverAgents, discoverNetworkAgents, domainSchema, embodimentSchema, emitBehavioralEvent, evaluateOutcome, expireOldEdges, exportTrainingData, expressionSchema, extractAlpacaExamples, extractDPOPairs, extractDPOPairsWithLLM, extractRLHFExamples, extractRecommendations, fetchPersonality, fetchRegistry, findCrossAgentCorrelations, findEdges, findNode, findNodesByType, gazePolicySchema, generateBenchmarkMarkdown, generateComparisonMarkdown, generateCredential, generateIndexMarkdown, generatePrescriptions, generateProgressReport, generateSystemPrompt, gestureSchema, getAgentBehaviors, getArchetype, getArchetypesByCategory, getBenchmarkScenarios, getCategories, getDetector, getDimension, getEvolutionSummary, getInheritanceChain, getInterviewContext, getMemoryContext, getNeighbors, getScenarioById, getTotalSignalCount, graphStats, growthAreaSchema, growthSchema, hapticPolicySchema, hashSpec, learnIntervention, listArchetypeIds, listDetectors, listDetectorsByCategory, listDetectorsByTag, loadBenchmarkResults, loadCorpus, loadCustomDetectors, loadEvolution, loadFleetConfig, loadGraph, loadLatestBenchmark, loadMemory, loadNetworkConfig, loadRepertoire, loadSpec, loadTranscripts, loadTreatmentPlan, messageSchema, modalitySchema, morphologySchema, motionParametersSchema, pairAgents, parseAnthropicAPILog, parseChatGPTExport, parseClaudeExport, parseConversationLog, parseConversationLogFromString, parseJSONLLog, parseOTelGenAIExport, parseOpenAIAPILog, personalitySpecSchema, physicalSafetySchema, populateFromDiagnosis, populateFromEvolve, populateFromSession, prescribeDPOPairs, processReACTResponse, prosodySchema, providerSchema, proxemicZoneSchema, pushToHFHub, queryCorpus, queryInterventions, querySharedKnowledge, recordInterventionOutcome, recordSessionOutcome, registerBuiltInDetectors, registerDetector, resolveInheritance, resolveOversight, runAssessment, runAutopilot, runBenchmark, runDiagnosis, runEvolve, runInterview, runNetwork, runPreSessionDiagnosis, runSelfAudit, runTherapySession, safetyEnvelopeSchema, saveBenchmarkResult, saveCredential, saveGraph, saveMemory, saveRepertoire, saveTranscript, saveTreatmentPlan, scoreLabel, scoreTraitsFromMessages, selectIntervention, severityMeetsThreshold, severitySchema, startFleet, startMCPServer, startWatch, summarize, summarizeSessionForMemory, summarizeTherapy, surfaceSchema, syncAnchorSchema, syncProfileSchema, syncRuleSchema, therapyDimensionsSchema, therapyScoreLabel, transferIntervention, unregisterDetector, updateEdgeWeight, validateDetectorConfig, verifyCredential, wrapAgent };
|