holomime 1.3.0 → 1.4.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.
Files changed (4) hide show
  1. package/dist/cli.js +14638 -11150
  2. package/dist/index.d.ts +115 -1
  3. package/dist/index.js +377 -23
  4. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -4104,6 +4104,120 @@ declare function createGist(spec: unknown, handle: string, token: string): Promi
4104
4104
  rawUrl: string;
4105
4105
  }>;
4106
4106
 
4107
+ /**
4108
+ * HoloMime Marketplace — type definitions for community asset sharing.
4109
+ */
4110
+ type AssetType = "personality" | "detector" | "intervention" | "training-pairs";
4111
+ interface MarketplaceAsset {
4112
+ id: string;
4113
+ type: AssetType;
4114
+ handle: string;
4115
+ name: string;
4116
+ description: string;
4117
+ author: string;
4118
+ version: string;
4119
+ downloads: number;
4120
+ rating: number;
4121
+ tags: string[];
4122
+ created_at: string;
4123
+ updated_at: string;
4124
+ }
4125
+ type SortField = "downloads" | "rating" | "created_at" | "updated_at" | "name";
4126
+ interface MarketplaceSearchQuery {
4127
+ query?: string;
4128
+ type?: AssetType;
4129
+ tags?: string[];
4130
+ sort?: SortField;
4131
+ page?: number;
4132
+ limit?: number;
4133
+ }
4134
+ interface MarketplaceSearchResult {
4135
+ assets: MarketplaceAsset[];
4136
+ total: number;
4137
+ page: number;
4138
+ pages: number;
4139
+ }
4140
+ interface PublishRequest {
4141
+ type: AssetType;
4142
+ handle: string;
4143
+ name: string;
4144
+ description: string;
4145
+ author: string;
4146
+ version: string;
4147
+ tags: string[];
4148
+ content: unknown;
4149
+ }
4150
+ interface AssetReview {
4151
+ rating: number;
4152
+ comment: string;
4153
+ author: string;
4154
+ created_at: string;
4155
+ }
4156
+ interface MarketplaceBackend {
4157
+ search(query: MarketplaceSearchQuery): Promise<MarketplaceSearchResult>;
4158
+ getAsset(id: string): Promise<MarketplaceAsset | null>;
4159
+ getAssetContent(id: string): Promise<unknown | null>;
4160
+ publish(request: PublishRequest): Promise<MarketplaceAsset>;
4161
+ download(id: string): Promise<{
4162
+ asset: MarketplaceAsset;
4163
+ content: unknown;
4164
+ } | null>;
4165
+ rate(id: string, review: AssetReview): Promise<void>;
4166
+ report(id: string, reason: string): Promise<void>;
4167
+ }
4168
+
4169
+ /**
4170
+ * HoloMime Marketplace — API client.
4171
+ * Provides a unified interface for marketplace operations.
4172
+ * Currently backed by LocalMarketplaceBackend; can be swapped for a remote REST API.
4173
+ */
4174
+
4175
+ declare class MarketplaceClient {
4176
+ private backend;
4177
+ private config;
4178
+ constructor(backend?: MarketplaceBackend);
4179
+ search(query: MarketplaceSearchQuery): Promise<MarketplaceSearchResult>;
4180
+ searchByType(type: AssetType, options?: Omit<MarketplaceSearchQuery, "type">): Promise<MarketplaceSearchResult>;
4181
+ searchPersonalities(query?: string): Promise<MarketplaceSearchResult>;
4182
+ searchDetectors(query?: string): Promise<MarketplaceSearchResult>;
4183
+ searchInterventions(query?: string): Promise<MarketplaceSearchResult>;
4184
+ searchTrainingPairs(query?: string): Promise<MarketplaceSearchResult>;
4185
+ getAsset(id: string): Promise<MarketplaceAsset | null>;
4186
+ getAssetContent(id: string): Promise<unknown | null>;
4187
+ publish(request: PublishRequest): Promise<MarketplaceAsset>;
4188
+ download(id: string): Promise<{
4189
+ asset: MarketplaceAsset;
4190
+ content: unknown;
4191
+ } | null>;
4192
+ rate(id: string, review: AssetReview): Promise<void>;
4193
+ report(id: string, reason: string): Promise<void>;
4194
+ resolveHandle(handle: string, type?: AssetType): Promise<MarketplaceAsset | null>;
4195
+ }
4196
+ declare function getMarketplaceClient(): MarketplaceClient;
4197
+ declare function resetMarketplaceClient(): void;
4198
+
4199
+ /**
4200
+ * HoloMime Marketplace — local file-based backend.
4201
+ * Stores assets in ~/.holomime/marketplace/ as JSON files.
4202
+ * Implements MarketplaceBackend so it can be swapped for a remote API later.
4203
+ */
4204
+
4205
+ declare function seedBuiltInPersonalities(): number;
4206
+ declare class LocalMarketplaceBackend implements MarketplaceBackend {
4207
+ private ensureSeeded;
4208
+ private seed;
4209
+ search(query: MarketplaceSearchQuery): Promise<MarketplaceSearchResult>;
4210
+ getAsset(id: string): Promise<MarketplaceAsset | null>;
4211
+ getAssetContent(id: string): Promise<unknown | null>;
4212
+ publish(request: PublishRequest): Promise<MarketplaceAsset>;
4213
+ download(id: string): Promise<{
4214
+ asset: MarketplaceAsset;
4215
+ content: unknown;
4216
+ } | null>;
4217
+ rate(id: string, review: AssetReview): Promise<void>;
4218
+ report(id: string, reason: string): Promise<void>;
4219
+ }
4220
+
4107
4221
  /**
4108
4222
  * Detector Hub — Plugin interface for community-contributed behavioral detectors.
4109
4223
  *
@@ -4813,4 +4927,4 @@ declare const THERAPIST_META_SPEC: PersonalitySpec;
4813
4927
  */
4814
4928
  declare function buildAgentTherapistPrompt(therapistSpec: PersonalitySpec, patientSpec: PersonalitySpec, diagnosis: PreSessionDiagnosis): string;
4815
4929
 
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 };
4930
+ export { ARCHETYPES, ATTACHMENT_STYLES, type AlpacaExample, AnthropicProvider, type ArchetypeTemplate, type AssessmentReport, type AssessmentResult, type AssetReview, type AssetType, 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, LocalMarketplaceBackend, type LogFormat, type MarketplaceAsset, type MarketplaceBackend, MarketplaceClient, type MarketplaceSearchQuery, type MarketplaceSearchResult, 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 PublishRequest, 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 SortField, 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, getMarketplaceClient, 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, resetMarketplaceClient, resolveInheritance, resolveOversight, runAssessment, runAutopilot, runBenchmark, runDiagnosis, runEvolve, runInterview, runNetwork, runPreSessionDiagnosis, runSelfAudit, runTherapySession, safetyEnvelopeSchema, saveBenchmarkResult, saveCredential, saveGraph, saveMemory, saveRepertoire, saveTranscript, saveTreatmentPlan, scoreLabel, scoreTraitsFromMessages, seedBuiltInPersonalities, selectIntervention, severityMeetsThreshold, severitySchema, startFleet, startMCPServer, startWatch, summarize, summarizeSessionForMemory, summarizeTherapy, surfaceSchema, syncAnchorSchema, syncProfileSchema, syncRuleSchema, therapyDimensionsSchema, therapyScoreLabel, transferIntervention, unregisterDetector, updateEdgeWeight, validateDetectorConfig, verifyCredential, wrapAgent };
package/dist/index.js CHANGED
@@ -7005,6 +7005,355 @@ async function createGist(spec, handle, token) {
7005
7005
  };
7006
7006
  }
7007
7007
 
7008
+ // src/marketplace/api.ts
7009
+ import { existsSync as existsSync14, readFileSync as readFileSync15 } from "fs";
7010
+ import { join as join15 } from "path";
7011
+ import { homedir as homedir3 } from "os";
7012
+
7013
+ // src/marketplace/local-backend.ts
7014
+ import { existsSync as existsSync13, mkdirSync as mkdirSync11, readFileSync as readFileSync14, writeFileSync as writeFileSync12 } from "fs";
7015
+ import { join as join14 } from "path";
7016
+ import { homedir as homedir2 } from "os";
7017
+ function marketplaceDir() {
7018
+ const dir = join14(homedir2(), ".holomime", "marketplace");
7019
+ if (!existsSync13(dir)) {
7020
+ mkdirSync11(dir, { recursive: true });
7021
+ }
7022
+ return dir;
7023
+ }
7024
+ function assetsDir() {
7025
+ const dir = join14(marketplaceDir(), "assets");
7026
+ if (!existsSync13(dir)) {
7027
+ mkdirSync11(dir, { recursive: true });
7028
+ }
7029
+ return dir;
7030
+ }
7031
+ function reviewsDir() {
7032
+ const dir = join14(marketplaceDir(), "reviews");
7033
+ if (!existsSync13(dir)) {
7034
+ mkdirSync11(dir, { recursive: true });
7035
+ }
7036
+ return dir;
7037
+ }
7038
+ function reportsDir() {
7039
+ const dir = join14(marketplaceDir(), "reports");
7040
+ if (!existsSync13(dir)) {
7041
+ mkdirSync11(dir, { recursive: true });
7042
+ }
7043
+ return dir;
7044
+ }
7045
+ function indexPath() {
7046
+ return join14(marketplaceDir(), "index.json");
7047
+ }
7048
+ function loadIndex() {
7049
+ const path = indexPath();
7050
+ if (!existsSync13(path)) {
7051
+ return [];
7052
+ }
7053
+ try {
7054
+ return JSON.parse(readFileSync14(path, "utf-8"));
7055
+ } catch {
7056
+ return [];
7057
+ }
7058
+ }
7059
+ function saveIndex(assets) {
7060
+ writeFileSync12(indexPath(), JSON.stringify(assets, null, 2) + "\n");
7061
+ }
7062
+ function loadStoredAsset(id) {
7063
+ const path = join14(assetsDir(), `${id}.json`);
7064
+ if (!existsSync13(path)) {
7065
+ return null;
7066
+ }
7067
+ try {
7068
+ return JSON.parse(readFileSync14(path, "utf-8"));
7069
+ } catch {
7070
+ return null;
7071
+ }
7072
+ }
7073
+ function saveStoredAsset(stored) {
7074
+ const path = join14(assetsDir(), `${stored.meta.id}.json`);
7075
+ writeFileSync12(path, JSON.stringify(stored, null, 2) + "\n");
7076
+ }
7077
+ function generateId(type, handle) {
7078
+ return `${type}--${handle}--${Date.now().toString(36)}`;
7079
+ }
7080
+ function matchesQuery(asset, query) {
7081
+ const q = query.toLowerCase();
7082
+ return asset.name.toLowerCase().includes(q) || asset.description.toLowerCase().includes(q) || asset.handle.toLowerCase().includes(q) || asset.author.toLowerCase().includes(q) || asset.tags.some((t) => t.toLowerCase().includes(q));
7083
+ }
7084
+ function sortAssets(assets, field) {
7085
+ const sorted = [...assets];
7086
+ switch (field) {
7087
+ case "downloads":
7088
+ return sorted.sort((a, b) => b.downloads - a.downloads);
7089
+ case "rating":
7090
+ return sorted.sort((a, b) => b.rating - a.rating);
7091
+ case "created_at":
7092
+ return sorted.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
7093
+ case "updated_at":
7094
+ return sorted.sort((a, b) => new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime());
7095
+ case "name":
7096
+ return sorted.sort((a, b) => a.name.localeCompare(b.name));
7097
+ default:
7098
+ return sorted;
7099
+ }
7100
+ }
7101
+ var BUILT_IN_PERSONALITIES = [
7102
+ { handle: "friendly-helper", name: "Friendly Helper", description: "Warm, enthusiastic assistant that prioritizes clarity and encouragement", tags: ["general", "warm", "beginner-friendly"] },
7103
+ { handle: "code-reviewer", name: "Code Reviewer", description: "Meticulous, direct code reviewer focused on quality and best practices", tags: ["engineering", "code-review", "technical"] },
7104
+ { handle: "creative-writer", name: "Creative Writer", description: "Imaginative storyteller with rich vocabulary and narrative instincts", tags: ["creative", "writing", "storytelling"] },
7105
+ { handle: "data-analyst", name: "Data Analyst", description: "Precise, methodical analyst who communicates insights clearly", tags: ["analytics", "data", "technical"] },
7106
+ { handle: "therapist-bot", name: "Therapy Guide", description: "Empathetic, boundaried counselor using evidence-based approaches", tags: ["mental-health", "counseling", "empathy"] },
7107
+ { handle: "teacher", name: "Patient Teacher", description: "Adaptive educator who meets learners where they are", tags: ["education", "teaching", "patient"] },
7108
+ { handle: "debate-partner", name: "Debate Partner", description: "Sharp, fair-minded debater who steelmans opposing views", tags: ["debate", "critical-thinking", "reasoning"] },
7109
+ { handle: "customer-support", name: "Customer Support", description: "Calm, solution-oriented support agent with high empathy", tags: ["support", "customer-service", "empathy"] },
7110
+ { handle: "research-assistant", name: "Research Assistant", description: "Thorough researcher who cites sources and flags uncertainty", tags: ["research", "academic", "thorough"] },
7111
+ { handle: "startup-advisor", name: "Startup Advisor", description: "Direct, experienced mentor focused on execution over theory", tags: ["business", "startup", "mentoring"] },
7112
+ { handle: "devops-engineer", name: "DevOps Engineer", description: "Infrastructure-minded engineer prioritizing reliability and automation", tags: ["devops", "infrastructure", "engineering"] },
7113
+ { handle: "ux-designer", name: "UX Designer", description: "User-centered designer who balances aesthetics with usability", tags: ["design", "ux", "user-research"] },
7114
+ { handle: "legal-assistant", name: "Legal Assistant", description: "Careful, precise legal researcher who always flags non-advice boundaries", tags: ["legal", "compliance", "careful"] },
7115
+ { handle: "fitness-coach", name: "Fitness Coach", description: "Motivating coach who adapts plans to individual capabilities", tags: ["fitness", "health", "coaching"] },
7116
+ { handle: "product-manager", name: "Product Manager", description: "Strategic PM who balances user needs with business goals", tags: ["product", "strategy", "business"] },
7117
+ { handle: "security-auditor", name: "Security Auditor", description: "Paranoid-by-design security expert who assumes breach", tags: ["security", "audit", "engineering"] },
7118
+ { handle: "technical-writer", name: "Technical Writer", description: "Clear, structured writer who makes complex topics accessible", tags: ["documentation", "writing", "technical"] },
7119
+ { handle: "philosopher", name: "Philosopher", description: "Deep thinker who explores ideas with intellectual humility", tags: ["philosophy", "reasoning", "academic"] },
7120
+ { handle: "sales-enablement", name: "Sales Enablement", description: "Consultative seller focused on understanding customer needs", tags: ["sales", "business", "communication"] },
7121
+ { handle: "accessibility-expert", name: "Accessibility Expert", description: "Inclusive designer who champions universal access and WCAG compliance", tags: ["accessibility", "a11y", "inclusive-design"] }
7122
+ ];
7123
+ function seedBuiltInPersonalities() {
7124
+ const index = loadIndex();
7125
+ const existingHandles = new Set(index.map((a) => a.handle));
7126
+ let seeded = 0;
7127
+ const now = (/* @__PURE__ */ new Date()).toISOString();
7128
+ for (const p of BUILT_IN_PERSONALITIES) {
7129
+ if (existingHandles.has(p.handle)) continue;
7130
+ const id = `personality--${p.handle}--built-in`;
7131
+ const asset = {
7132
+ id,
7133
+ type: "personality",
7134
+ handle: p.handle,
7135
+ name: p.name,
7136
+ description: p.description,
7137
+ author: "holomime",
7138
+ version: "1.0.0",
7139
+ downloads: 0,
7140
+ rating: 0,
7141
+ tags: p.tags,
7142
+ created_at: now,
7143
+ updated_at: now
7144
+ };
7145
+ const content = {
7146
+ version: "2.0",
7147
+ name: p.name,
7148
+ handle: p.handle,
7149
+ purpose: p.description
7150
+ };
7151
+ index.push(asset);
7152
+ saveStoredAsset({ meta: asset, content });
7153
+ seeded++;
7154
+ }
7155
+ if (seeded > 0) {
7156
+ saveIndex(index);
7157
+ }
7158
+ return seeded;
7159
+ }
7160
+ var LocalMarketplaceBackend = class {
7161
+ ensureSeeded = false;
7162
+ seed() {
7163
+ if (this.ensureSeeded) return;
7164
+ this.ensureSeeded = true;
7165
+ seedBuiltInPersonalities();
7166
+ }
7167
+ async search(query) {
7168
+ this.seed();
7169
+ let assets = loadIndex();
7170
+ if (query.type) {
7171
+ assets = assets.filter((a) => a.type === query.type);
7172
+ }
7173
+ if (query.tags && query.tags.length > 0) {
7174
+ assets = assets.filter(
7175
+ (a) => query.tags.some((qt) => a.tags.some((at) => at.toLowerCase() === qt.toLowerCase()))
7176
+ );
7177
+ }
7178
+ if (query.query) {
7179
+ assets = assets.filter((a) => matchesQuery(a, query.query));
7180
+ }
7181
+ const sortField = query.sort ?? "downloads";
7182
+ assets = sortAssets(assets, sortField);
7183
+ const page = query.page ?? 1;
7184
+ const limit = query.limit ?? 20;
7185
+ const total = assets.length;
7186
+ const pages = Math.max(1, Math.ceil(total / limit));
7187
+ const start = (page - 1) * limit;
7188
+ const paged = assets.slice(start, start + limit);
7189
+ return { assets: paged, total, page, pages };
7190
+ }
7191
+ async getAsset(id) {
7192
+ this.seed();
7193
+ const index = loadIndex();
7194
+ return index.find((a) => a.id === id) ?? null;
7195
+ }
7196
+ async getAssetContent(id) {
7197
+ const stored = loadStoredAsset(id);
7198
+ return stored?.content ?? null;
7199
+ }
7200
+ async publish(request) {
7201
+ this.seed();
7202
+ const index = loadIndex();
7203
+ const id = generateId(request.type, request.handle);
7204
+ const now = (/* @__PURE__ */ new Date()).toISOString();
7205
+ const asset = {
7206
+ id,
7207
+ type: request.type,
7208
+ handle: request.handle,
7209
+ name: request.name,
7210
+ description: request.description,
7211
+ author: request.author,
7212
+ version: request.version,
7213
+ downloads: 0,
7214
+ rating: 0,
7215
+ tags: request.tags,
7216
+ created_at: now,
7217
+ updated_at: now
7218
+ };
7219
+ saveStoredAsset({ meta: asset, content: request.content });
7220
+ index.push(asset);
7221
+ saveIndex(index);
7222
+ return asset;
7223
+ }
7224
+ async download(id) {
7225
+ this.seed();
7226
+ const stored = loadStoredAsset(id);
7227
+ if (!stored) return null;
7228
+ const index = loadIndex();
7229
+ const entry = index.find((a) => a.id === id);
7230
+ if (entry) {
7231
+ entry.downloads++;
7232
+ saveIndex(index);
7233
+ stored.meta.downloads = entry.downloads;
7234
+ }
7235
+ return { asset: stored.meta, content: stored.content };
7236
+ }
7237
+ async rate(id, review) {
7238
+ this.seed();
7239
+ const reviewFile = join14(reviewsDir(), `${id}.json`);
7240
+ let reviews = [];
7241
+ if (existsSync13(reviewFile)) {
7242
+ try {
7243
+ reviews = JSON.parse(readFileSync14(reviewFile, "utf-8"));
7244
+ } catch {
7245
+ reviews = [];
7246
+ }
7247
+ }
7248
+ reviews.push(review);
7249
+ writeFileSync12(reviewFile, JSON.stringify(reviews, null, 2) + "\n");
7250
+ const index = loadIndex();
7251
+ const entry = index.find((a) => a.id === id);
7252
+ if (entry) {
7253
+ const avg = reviews.reduce((sum, r) => sum + r.rating, 0) / reviews.length;
7254
+ entry.rating = Math.round(avg * 10) / 10;
7255
+ entry.updated_at = (/* @__PURE__ */ new Date()).toISOString();
7256
+ saveIndex(index);
7257
+ }
7258
+ }
7259
+ async report(id, reason) {
7260
+ const reportFile = join14(reportsDir(), `${id}--${Date.now()}.json`);
7261
+ writeFileSync12(
7262
+ reportFile,
7263
+ JSON.stringify({ id, reason, reported_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2) + "\n"
7264
+ );
7265
+ }
7266
+ };
7267
+
7268
+ // src/marketplace/api.ts
7269
+ function loadConfig() {
7270
+ const configPath = join15(homedir3(), ".holomime", "config.json");
7271
+ if (!existsSync14(configPath)) {
7272
+ return {};
7273
+ }
7274
+ try {
7275
+ return JSON.parse(readFileSync15(configPath, "utf-8"));
7276
+ } catch {
7277
+ return {};
7278
+ }
7279
+ }
7280
+ var MarketplaceClient = class {
7281
+ backend;
7282
+ config;
7283
+ constructor(backend) {
7284
+ this.config = loadConfig();
7285
+ this.backend = backend ?? new LocalMarketplaceBackend();
7286
+ }
7287
+ // ─── Search ─────────────────────────────────────────────
7288
+ async search(query) {
7289
+ return this.backend.search(query);
7290
+ }
7291
+ async searchByType(type, options) {
7292
+ return this.backend.search({ ...options, type });
7293
+ }
7294
+ async searchPersonalities(query) {
7295
+ return this.backend.search({ type: "personality", query });
7296
+ }
7297
+ async searchDetectors(query) {
7298
+ return this.backend.search({ type: "detector", query });
7299
+ }
7300
+ async searchInterventions(query) {
7301
+ return this.backend.search({ type: "intervention", query });
7302
+ }
7303
+ async searchTrainingPairs(query) {
7304
+ return this.backend.search({ type: "training-pairs", query });
7305
+ }
7306
+ // ─── Get ────────────────────────────────────────────────
7307
+ async getAsset(id) {
7308
+ return this.backend.getAsset(id);
7309
+ }
7310
+ async getAssetContent(id) {
7311
+ return this.backend.getAssetContent(id);
7312
+ }
7313
+ // ─── Publish ────────────────────────────────────────────
7314
+ async publish(request) {
7315
+ return this.backend.publish(request);
7316
+ }
7317
+ // ─── Download ───────────────────────────────────────────
7318
+ async download(id) {
7319
+ return this.backend.download(id);
7320
+ }
7321
+ // ─── Rate ───────────────────────────────────────────────
7322
+ async rate(id, review) {
7323
+ return this.backend.rate(id, review);
7324
+ }
7325
+ // ─── Report ─────────────────────────────────────────────
7326
+ async report(id, reason) {
7327
+ return this.backend.report(id, reason);
7328
+ }
7329
+ // ─── Resolve handle to asset ──────────────────────────
7330
+ async resolveHandle(handle, type) {
7331
+ const cleanHandle = handle.startsWith("@") ? handle.slice(1) : handle;
7332
+ const parts = cleanHandle.split("/");
7333
+ const query = { type, limit: 50 };
7334
+ const result = await this.backend.search(query);
7335
+ if (parts.length === 2) {
7336
+ const [author, name] = parts;
7337
+ return result.assets.find(
7338
+ (a) => a.author.toLowerCase() === author.toLowerCase() && a.handle.toLowerCase() === name.toLowerCase()
7339
+ ) ?? null;
7340
+ }
7341
+ return result.assets.find(
7342
+ (a) => a.handle.toLowerCase() === cleanHandle.toLowerCase()
7343
+ ) ?? null;
7344
+ }
7345
+ };
7346
+ var _client = null;
7347
+ function getMarketplaceClient() {
7348
+ if (!_client) {
7349
+ _client = new MarketplaceClient();
7350
+ }
7351
+ return _client;
7352
+ }
7353
+ function resetMarketplaceClient() {
7354
+ _client = null;
7355
+ }
7356
+
7008
7357
  // src/hub/detector-interface.ts
7009
7358
  var registry = /* @__PURE__ */ new Map();
7010
7359
  function registerDetector(detector) {
@@ -7643,8 +7992,8 @@ function checkIterationBudget(currentIteration, policy) {
7643
7992
  }
7644
7993
 
7645
7994
  // src/analysis/cross-agent-sharing.ts
7646
- import { readdirSync as readdirSync6, existsSync as existsSync13 } from "fs";
7647
- import { join as join14 } from "path";
7995
+ import { readdirSync as readdirSync7, existsSync as existsSync15 } from "fs";
7996
+ import { join as join16 } from "path";
7648
7997
  function buildSharedKnowledge(graphs, repertoires) {
7649
7998
  const interventionMap = /* @__PURE__ */ new Map();
7650
7999
  const patternAgentMap = /* @__PURE__ */ new Map();
@@ -7741,15 +8090,15 @@ function discoverAgentData(baseDir) {
7741
8090
  if (mainRepertoire.interventions.some((i) => i.timesUsed > 0)) {
7742
8091
  repertoires.push(mainRepertoire);
7743
8092
  }
7744
- if (baseDir && existsSync13(baseDir)) {
8093
+ if (baseDir && existsSync15(baseDir)) {
7745
8094
  try {
7746
- const entries = readdirSync6(baseDir, { withFileTypes: true });
8095
+ const entries = readdirSync7(baseDir, { withFileTypes: true });
7747
8096
  for (const entry of entries) {
7748
8097
  if (!entry.isDirectory()) continue;
7749
- const agentDir = join14(baseDir, entry.name);
7750
- const agentGraphPath = join14(agentDir, ".holomime", "graph", "knowledge-graph.json");
7751
- const agentRepertoirePath = join14(agentDir, ".holomime", "interventions", "repertoire.json");
7752
- if (existsSync13(agentGraphPath)) {
8098
+ const agentDir = join16(baseDir, entry.name);
8099
+ const agentGraphPath = join16(agentDir, ".holomime", "graph", "knowledge-graph.json");
8100
+ const agentRepertoirePath = join16(agentDir, ".holomime", "interventions", "repertoire.json");
8101
+ if (existsSync15(agentGraphPath)) {
7753
8102
  try {
7754
8103
  const graph = JSON.parse(
7755
8104
  __require("fs").readFileSync(agentGraphPath, "utf-8")
@@ -7758,7 +8107,7 @@ function discoverAgentData(baseDir) {
7758
8107
  } catch {
7759
8108
  }
7760
8109
  }
7761
- if (existsSync13(agentRepertoirePath)) {
8110
+ if (existsSync15(agentRepertoirePath)) {
7762
8111
  try {
7763
8112
  const repertoire = JSON.parse(
7764
8113
  __require("fs").readFileSync(agentRepertoirePath, "utf-8")
@@ -7775,8 +8124,8 @@ function discoverAgentData(baseDir) {
7775
8124
  }
7776
8125
 
7777
8126
  // src/analysis/network-core.ts
7778
- import { existsSync as existsSync14, readdirSync as readdirSync7, readFileSync as readFileSync14 } from "fs";
7779
- import { join as join15, resolve as resolve13 } from "path";
8127
+ import { existsSync as existsSync16, readdirSync as readdirSync8, readFileSync as readFileSync16 } from "fs";
8128
+ import { join as join17, resolve as resolve13 } from "path";
7780
8129
 
7781
8130
  // src/psychology/therapist-meta.ts
7782
8131
  var THERAPIST_META_SPEC = {
@@ -7912,21 +8261,21 @@ Your patient is another AI agent with its own personality spec:
7912
8261
  // src/analysis/network-core.ts
7913
8262
  function discoverNetworkAgents(dir) {
7914
8263
  const absDir = resolve13(dir);
7915
- if (!existsSync14(absDir)) {
8264
+ if (!existsSync16(absDir)) {
7916
8265
  throw new Error(`Directory not found: ${absDir}`);
7917
8266
  }
7918
8267
  const agents = [];
7919
- const entries = readdirSync7(absDir, { withFileTypes: true });
8268
+ const entries = readdirSync8(absDir, { withFileTypes: true });
7920
8269
  for (const entry of entries) {
7921
8270
  if (!entry.isDirectory()) continue;
7922
- const agentDir = join15(absDir, entry.name);
7923
- const specPath = join15(agentDir, ".personality.json");
7924
- const logDir = join15(agentDir, "logs");
7925
- if (existsSync14(specPath)) {
8271
+ const agentDir = join17(absDir, entry.name);
8272
+ const specPath = join17(agentDir, ".personality.json");
8273
+ const logDir = join17(agentDir, "logs");
8274
+ if (existsSync16(specPath)) {
7926
8275
  agents.push({
7927
8276
  name: entry.name,
7928
8277
  specPath,
7929
- logDir: existsSync14(logDir) ? logDir : agentDir,
8278
+ logDir: existsSync16(logDir) ? logDir : agentDir,
7930
8279
  role: "both"
7931
8280
  });
7932
8281
  }
@@ -7934,7 +8283,7 @@ function discoverNetworkAgents(dir) {
7934
8283
  return agents;
7935
8284
  }
7936
8285
  function loadNetworkConfig(configPath) {
7937
- const raw = JSON.parse(readFileSync14(configPath, "utf-8"));
8286
+ const raw = JSON.parse(readFileSync16(configPath, "utf-8"));
7938
8287
  if (!raw.agents || !Array.isArray(raw.agents)) {
7939
8288
  throw new Error("network.json must contain an 'agents' array");
7940
8289
  }
@@ -8120,7 +8469,7 @@ async function runNetwork(config, provider, callbacks) {
8120
8469
  const spec = loadSpec(agent.specPath);
8121
8470
  agentSpecs.set(agent.name, spec);
8122
8471
  let messages = [];
8123
- if (agent.logDir && existsSync14(agent.logDir)) {
8472
+ if (agent.logDir && existsSync16(agent.logDir)) {
8124
8473
  messages = loadAgentMessages(agent.logDir);
8125
8474
  }
8126
8475
  agentMessages.set(agent.name, messages);
@@ -8237,15 +8586,15 @@ async function runNetwork(config, provider, callbacks) {
8237
8586
  };
8238
8587
  }
8239
8588
  function loadAgentMessages(logDir) {
8240
- if (!existsSync14(logDir)) return [];
8589
+ if (!existsSync16(logDir)) return [];
8241
8590
  const messages = [];
8242
8591
  try {
8243
- const files = readdirSync7(logDir).filter(
8592
+ const files = readdirSync8(logDir).filter(
8244
8593
  (f) => f.endsWith(".json") || f.endsWith(".jsonl")
8245
8594
  );
8246
8595
  for (const file of files.slice(0, 10)) {
8247
8596
  try {
8248
- const raw = readFileSync14(join15(logDir, file), "utf-8");
8597
+ const raw = readFileSync16(join17(logDir, file), "utf-8");
8249
8598
  const data = JSON.parse(raw);
8250
8599
  const conversations = parseConversationLog(data);
8251
8600
  for (const conv of conversations) {
@@ -8306,6 +8655,8 @@ export {
8306
8655
  DIMENSIONS,
8307
8656
  Guard,
8308
8657
  LEARNING_ORIENTATIONS,
8658
+ LocalMarketplaceBackend,
8659
+ MarketplaceClient,
8309
8660
  OllamaProvider,
8310
8661
  OpenAIProvider,
8311
8662
  PROVIDER_PARAMS,
@@ -8404,6 +8755,7 @@ export {
8404
8755
  getEvolutionSummary,
8405
8756
  getInheritanceChain,
8406
8757
  getInterviewContext,
8758
+ getMarketplaceClient,
8407
8759
  getMemoryContext,
8408
8760
  getNeighbors,
8409
8761
  getScenarioById,
@@ -8462,6 +8814,7 @@ export {
8462
8814
  recordSessionOutcome,
8463
8815
  registerBuiltInDetectors,
8464
8816
  registerDetector,
8817
+ resetMarketplaceClient,
8465
8818
  resolveInheritance,
8466
8819
  resolveOversight,
8467
8820
  runAssessment,
@@ -8484,6 +8837,7 @@ export {
8484
8837
  saveTreatmentPlan,
8485
8838
  scoreLabel,
8486
8839
  scoreTraitsFromMessages,
8840
+ seedBuiltInPersonalities,
8487
8841
  selectIntervention,
8488
8842
  severityMeetsThreshold2 as severityMeetsThreshold,
8489
8843
  severitySchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "holomime",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Behavioral therapy infrastructure for AI agents — Big Five psychology, structured treatment, DPO training data",
5
5
  "type": "module",
6
6
  "bin": {