opcode-pg-memory 2.2.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/.env.example +42 -0
- package/README.md +132 -0
- package/dist/cli.js +165 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20938 -0
- package/dist/mcp-server.d.ts +8 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +24047 -0
- package/dist/src/cache/semantic-cache.d.ts +120 -0
- package/dist/src/cache/semantic-cache.d.ts.map +1 -0
- package/dist/src/cli.d.ts +3 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/config.d.ts +39 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/db/init-db.d.ts +45 -0
- package/dist/src/db/init-db.d.ts.map +1 -0
- package/dist/src/hooks/message-part-updated.d.ts +24 -0
- package/dist/src/hooks/message-part-updated.d.ts.map +1 -0
- package/dist/src/hooks/message-updated.d.ts +24 -0
- package/dist/src/hooks/message-updated.d.ts.map +1 -0
- package/dist/src/hooks/session-compacting.d.ts +50 -0
- package/dist/src/hooks/session-compacting.d.ts.map +1 -0
- package/dist/src/hooks/session-completed.d.ts +36 -0
- package/dist/src/hooks/session-completed.d.ts.map +1 -0
- package/dist/src/hooks/session-created.d.ts +23 -0
- package/dist/src/hooks/session-created.d.ts.map +1 -0
- package/dist/src/hooks/tool-execute.d.ts +32 -0
- package/dist/src/hooks/tool-execute.d.ts.map +1 -0
- package/dist/src/index.d.ts +64 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/mcp/hindsight-reflect-omo.d.ts +64 -0
- package/dist/src/mcp/hindsight-reflect-omo.d.ts.map +1 -0
- package/dist/src/mcp/hindsight-reflect.d.ts +75 -0
- package/dist/src/mcp/hindsight-reflect.d.ts.map +1 -0
- package/dist/src/mcp/recall-memory-omo.d.ts +47 -0
- package/dist/src/mcp/recall-memory-omo.d.ts.map +1 -0
- package/dist/src/mcp/recall-memory.d.ts +89 -0
- package/dist/src/mcp/recall-memory.d.ts.map +1 -0
- package/dist/src/omo/adapter.d.ts +144 -0
- package/dist/src/omo/adapter.d.ts.map +1 -0
- package/dist/src/omo/types.d.ts +132 -0
- package/dist/src/omo/types.d.ts.map +1 -0
- package/dist/src/services/keyword.d.ts +4 -0
- package/dist/src/services/keyword.d.ts.map +1 -0
- package/dist/src/services/logger.d.ts +8 -0
- package/dist/src/services/logger.d.ts.map +1 -0
- package/dist/src/services/privacy.d.ts +4 -0
- package/dist/src/services/privacy.d.ts.map +1 -0
- package/dist/src/topic/segment-manager.d.ts +165 -0
- package/dist/src/topic/segment-manager.d.ts.map +1 -0
- package/dist/src/types.d.ts +405 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/utils/embedding.d.ts +44 -0
- package/dist/src/utils/embedding.d.ts.map +1 -0
- package/dist/src/utils/token-budget.d.ts +68 -0
- package/dist/src/utils/token-budget.d.ts.map +1 -0
- package/package.json +68 -0
- package/scripts/migration-v2.sql +187 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Pool } from 'pg';
|
|
2
|
+
import type { Reflection } from '../types';
|
|
3
|
+
export interface HindsightReflectInput {
|
|
4
|
+
session_id?: string;
|
|
5
|
+
omo_task_id?: string;
|
|
6
|
+
topic_segment_id?: string;
|
|
7
|
+
trigger_type?: 'manual' | 'threshold' | 'scheduled';
|
|
8
|
+
model_size?: '7b' | '14b' | 'full';
|
|
9
|
+
aggregate?: boolean;
|
|
10
|
+
/** @deprecated Backward compat — threshold is now in HindsightReflectConfig */
|
|
11
|
+
observation_threshold?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface HindsightReflectOutput {
|
|
14
|
+
generated_reflections: Reflection[];
|
|
15
|
+
token_usage: {
|
|
16
|
+
input: number;
|
|
17
|
+
output: number;
|
|
18
|
+
total: number;
|
|
19
|
+
};
|
|
20
|
+
duration_ms: number;
|
|
21
|
+
}
|
|
22
|
+
export interface HindsightReflectConfig {
|
|
23
|
+
observationThreshold: number;
|
|
24
|
+
segmentThreshold: number;
|
|
25
|
+
minThreshold: number;
|
|
26
|
+
maxThreshold: number;
|
|
27
|
+
modelSize: '7b' | '14b' | 'full';
|
|
28
|
+
offPeakHours: number[];
|
|
29
|
+
minConfidence: number;
|
|
30
|
+
/** Max observations to fetch per segment */
|
|
31
|
+
maxObservationsPerSegment: number;
|
|
32
|
+
/** Max observations to fetch in aggregate mode */
|
|
33
|
+
maxObservationsAggregate: number;
|
|
34
|
+
/** Batch size for LLM reflection calls */
|
|
35
|
+
reflectionBatchSize: number;
|
|
36
|
+
/** Prompts used for LLM reflection — configurable to avoid hardcoding */
|
|
37
|
+
prompts: {
|
|
38
|
+
systemPrompt: string;
|
|
39
|
+
perSegmentUserPrompt: string;
|
|
40
|
+
aggregateUserPrompt: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export declare const DEFAULT_REFLECTION_SYSTEM_PROMPT = "You are a reflection engine that analyzes coding session observations to extract reusable patterns and insights.\n\n## Task\nAnalyze the provided observations from a coding session and generate structured reflections that capture:\n1. Error patterns and their root causes\n2. Successful approaches and best practices\n3. User preferences and coding style\n4. Technical stack patterns\n5. Cross-session applicable insights\n\n## Input Format\nObservations will be provided as a JSON array with fields:\n- id: Observation identifier\n- tool_name: The tool that was used\n- tool_input_summary: Summary of inputs\n- tool_output_summary: Summary of outputs\n- importance: Importance rating (1-5)\n- created_at: Timestamp\n- metadata: Additional metadata\n\n## Output Format\nRespond with a JSON object containing:\n{\n \"summary\": \"High-level summary of the session insights (2-3 sentences)\",\n \"patterns\": [\n {\n \"pattern_type\": \"error_pattern|success_pattern|preference|technical_stack|workflow|tool_preference|insight\",\n \"description\": \"Detailed description of the pattern (1-2 sentences)\",\n \"confidence\": 0.0-1.0,\n \"source_observation_ids\": [\"id1\", \"id2\"],\n \"applicability\": \"When this pattern applies\"\n }\n ],\n \"recommendations\": [\n \"Actionable recommendation based on patterns\"\n ],\n \"technical_stack\": {\n \"languages\": [\"detected languages\"],\n \"frameworks\": [\"detected frameworks\"],\n \"tools\": [\"frequently used tools\"]\n }\n}\n\n## Rules\n- Only include patterns with confidence >= 0.6\n- Focus on cross-session applicable insights\n- Be specific about technical details (file names, function names, etc.)\n- Avoid generic advice like \"write clean code\"\n- Consider the sequence of observations for causal relationships\n- Identify recurring errors and their solutions\n- Note user preferences (indentation style, naming conventions, etc.)\n\n## Pattern Types\n- error_pattern: Recurring errors and how they were resolved\n- success_pattern: Approaches that worked well\n- preference: User's coding style and preferences\n- technical_stack: Technologies and tools used\n- workflow: Development workflow patterns\n- tool_preference: Frequently used tools and preferences\n- insight: Notable technical discoveries or lessons";
|
|
44
|
+
export declare const DEFAULT_PER_SEGMENT_USER_PROMPT = "You are a technical retrospective assistant. Analyze the following tool execution records from topic: \"{topic_summary}\", and summarize:\n1. Recurring patterns or workflows\n2. Notable technical discoveries or lessons\n3. Recommendations for future similar tasks\n\nSession context: {session_context}\n\nObservations:\n{observations_json}";
|
|
45
|
+
export declare const DEFAULT_AGGREGATE_USER_PROMPT = "You are a technical retrospective assistant. Analyze the following tool execution records across multiple topics and sessions, and summarize:\n1. Cross-topic recurring patterns or workflows\n2. Notable technical discoveries or lessons that span topics\n3. Recommendations for future similar tasks\n\nTopics covered: {topics_summary}\n\nObservations:\n{observations_json}";
|
|
46
|
+
/**
|
|
47
|
+
* Enhanced hindsight_reflect with topic_segment-based reflection,
|
|
48
|
+
* omo_task_id support, and aggregate mode.
|
|
49
|
+
*
|
|
50
|
+
* Scope resolution:
|
|
51
|
+
* 1. topic_segment_id → reflect on that single segment
|
|
52
|
+
* 2. session_id + aggregate=false → group by topic_segment, reflect per segment
|
|
53
|
+
* 3. session_id + aggregate=true → reflect on all observations across all segments
|
|
54
|
+
* 4. omo_task_id → find all session_map entries for this task, reflect across their segments
|
|
55
|
+
*
|
|
56
|
+
* Backward compatible: session_id-only input falls back to legacy path
|
|
57
|
+
* (sessions table + session-scoped reflection).
|
|
58
|
+
*/
|
|
59
|
+
export declare function hindsightReflect(input: HindsightReflectInput, pool: Pool, config?: Partial<HindsightReflectConfig>): Promise<HindsightReflectOutput>;
|
|
60
|
+
/**
|
|
61
|
+
* 检查是否是低峰期
|
|
62
|
+
*/
|
|
63
|
+
export declare function isOffPeakHour(config?: {
|
|
64
|
+
offPeakHours: number[];
|
|
65
|
+
}): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* 获取反思统计
|
|
68
|
+
*/
|
|
69
|
+
export declare function getReflectionStats(sessionId: string, pool: Pool): Promise<{
|
|
70
|
+
totalReflections: number;
|
|
71
|
+
patternTypes: Record<string, number>;
|
|
72
|
+
averageConfidence: number;
|
|
73
|
+
lastReflectionAt: Date | null;
|
|
74
|
+
}>;
|
|
75
|
+
//# sourceMappingURL=hindsight-reflect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hindsight-reflect.d.ts","sourceRoot":"","sources":["../../../src/mcp/hindsight-reflect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAM3C,MAAM,WAAW,qBAAqB;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAC;IACpD,UAAU,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,+EAA+E;IAC/E,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,sBAAsB;IACrC,qBAAqB,EAAE,UAAU,EAAE,CAAC;IACpC,WAAW,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,C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,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC;CAC/B,CAAC,CAwCD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* recall_memory MCP 工具 - OmO 适配版本
|
|
3
|
+
*
|
|
4
|
+
* 针对 Oh My OpenAgent 多 Agent 环境优化的记忆检索工具
|
|
5
|
+
* 支持 Agent 隔离、父子 Agent 继承、OmO Wisdom 集成
|
|
6
|
+
*/
|
|
7
|
+
import { Pool } from 'pg';
|
|
8
|
+
import { RecallMemoryInput, RecallMemoryOutput } from './recall-memory';
|
|
9
|
+
export interface RecallMemoryOmOInput extends RecallMemoryInput {
|
|
10
|
+
agent_id: string;
|
|
11
|
+
task_id?: string;
|
|
12
|
+
parent_agent_id?: string;
|
|
13
|
+
agent_scope?: 'self' | 'siblings' | 'parent' | 'children' | 'all';
|
|
14
|
+
include_omo_wisdom?: boolean;
|
|
15
|
+
omo_context_budget?: number;
|
|
16
|
+
coordination_mode?: 'omo-first' | 'equal' | 'memory-first';
|
|
17
|
+
}
|
|
18
|
+
export interface RecallMemoryOmOOutput extends RecallMemoryOutput {
|
|
19
|
+
agent_id: string;
|
|
20
|
+
task_id?: string;
|
|
21
|
+
source_distribution: {
|
|
22
|
+
own_agent: number;
|
|
23
|
+
sibling_agents: number;
|
|
24
|
+
parent_agent: number;
|
|
25
|
+
child_agents: number;
|
|
26
|
+
shared_knowledge: number;
|
|
27
|
+
omo_wisdom?: number;
|
|
28
|
+
};
|
|
29
|
+
token_budget_usage: {
|
|
30
|
+
allocated: number;
|
|
31
|
+
used: number;
|
|
32
|
+
omo_reserved: number;
|
|
33
|
+
remaining: number;
|
|
34
|
+
};
|
|
35
|
+
coordination_applied: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* OmO 版本的 recall_memory 工具
|
|
39
|
+
*
|
|
40
|
+
* 主要差异:
|
|
41
|
+
* 1. 支持 Agent 隔离和范围过滤
|
|
42
|
+
* 2. 与 OmO Token 预算协调
|
|
43
|
+
* 3. 可选集成 OmO Wisdom
|
|
44
|
+
* 4. 详细的来源分布统计
|
|
45
|
+
*/
|
|
46
|
+
export declare function recallMemoryOmO(input: RecallMemoryOmOInput, pool: Pool): Promise<RecallMemoryOmOOutput>;
|
|
47
|
+
//# sourceMappingURL=recall-memory-omo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recall-memory-omo.d.ts","sourceRoot":"","sources":["../../../src/mcp/recall-memory-omo.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAgB,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEtF,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAE7D,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IAGzB,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,KAAK,CAAC;IAGlE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAG7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,WAAW,GAAG,OAAO,GAAG,cAAc,CAAC;CAC5D;AAED,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAE/D,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,mBAAmB,EAAE;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,gBAAgB,EAAE,MAAM,CAAC;QACzB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IAGF,kBAAkB,EAAE;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IAGF,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,oBAAoB,EAC3B,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,qBAAqB,CAAC,CAmFhC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Pool } from 'pg';
|
|
2
|
+
export interface RecallMemoryInput {
|
|
3
|
+
/** The search query text */
|
|
4
|
+
query: string;
|
|
5
|
+
/** OpenCode session external ID. Auto-detected as most recent active session if omitted. */
|
|
6
|
+
session_id?: string;
|
|
7
|
+
/** OmO task ID for agent-scoped retrieval */
|
|
8
|
+
omo_task_id?: string;
|
|
9
|
+
/** Specific topic segment to bias toward (ignored if caller_context.current_session_id is set) */
|
|
10
|
+
topic_segment_id?: string;
|
|
11
|
+
/** Caller metadata for topic-context fusion and agent-aware retrieval */
|
|
12
|
+
caller_context?: {
|
|
13
|
+
type: 'user' | 'omo_agent';
|
|
14
|
+
current_goal?: string;
|
|
15
|
+
current_session_id?: string;
|
|
16
|
+
};
|
|
17
|
+
/** Retrieval strategies to execute in parallel. Default: ['semantic', 'bm25', 'graph'] */
|
|
18
|
+
retrieval_strategies?: Array<'semantic' | 'bm25' | 'graph' | 'keyword' | 'temporal'>;
|
|
19
|
+
/** Max results to return. Default: 10 */
|
|
20
|
+
max_results?: number;
|
|
21
|
+
/** Filters applied post-retrieval */
|
|
22
|
+
filters?: {
|
|
23
|
+
min_confidence?: number;
|
|
24
|
+
min_importance?: number;
|
|
25
|
+
/** Single tier filter */
|
|
26
|
+
tier?: 'permanent' | 'project' | 'session';
|
|
27
|
+
/** Backward compat: array of tier levels (maps to tier for single value) */
|
|
28
|
+
tier_levels?: Array<'permanent' | 'project' | 'session'>;
|
|
29
|
+
entity_types?: string[];
|
|
30
|
+
exclude_topic_segment_ids?: string[];
|
|
31
|
+
/** Time range in days (backward compat) */
|
|
32
|
+
time_range_days?: number;
|
|
33
|
+
};
|
|
34
|
+
/** Cross-encoder rerank (backward compat). Default: true */
|
|
35
|
+
rerank?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface MemoryResult {
|
|
38
|
+
id: string;
|
|
39
|
+
type: 'entity' | 'observation' | 'reflection' | 'relation';
|
|
40
|
+
/** Structured data payload for the new interface */
|
|
41
|
+
data: Record<string, any>;
|
|
42
|
+
relevance_score: number;
|
|
43
|
+
/** Full context metadata */
|
|
44
|
+
context: {
|
|
45
|
+
session_id: string;
|
|
46
|
+
omo_task_id?: string;
|
|
47
|
+
topic_segment_id: string;
|
|
48
|
+
topic_summary?: string;
|
|
49
|
+
timestamp: string;
|
|
50
|
+
};
|
|
51
|
+
content: string;
|
|
52
|
+
metadata: Record<string, any>;
|
|
53
|
+
}
|
|
54
|
+
export interface RecallMemoryOutput {
|
|
55
|
+
query: string;
|
|
56
|
+
context_used?: {
|
|
57
|
+
topic_segment_id: string;
|
|
58
|
+
topic_summary: string;
|
|
59
|
+
};
|
|
60
|
+
success: boolean;
|
|
61
|
+
results: MemoryResult[];
|
|
62
|
+
total_found: number;
|
|
63
|
+
retrieval_time_ms: number;
|
|
64
|
+
strategies_used: string[];
|
|
65
|
+
session_id: string;
|
|
66
|
+
error?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface RecallMemoryConfig {
|
|
69
|
+
weights: {
|
|
70
|
+
semantic: number;
|
|
71
|
+
recency: number;
|
|
72
|
+
importance: number;
|
|
73
|
+
};
|
|
74
|
+
maxResults: number;
|
|
75
|
+
rerankEnabled: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Enhanced recall_memory MCP tool.
|
|
79
|
+
*
|
|
80
|
+
* Innovations:
|
|
81
|
+
* 1. Topic context fusion — blends query embedding with current topic embedding
|
|
82
|
+
* 2. Structured output — every result carries full context metadata
|
|
83
|
+
* 3. Agent-friendly — OmO agents pass caller_context for better retrieval
|
|
84
|
+
* 4. Enhanced filters — min_importance, tier, exclude_topic_segment_ids
|
|
85
|
+
*
|
|
86
|
+
* Backward compatible with simple { query: "..." } calls.
|
|
87
|
+
*/
|
|
88
|
+
export declare function recallMemory(input: RecallMemoryInput, pool: Pool, config?: Partial<RecallMemoryConfig>): Promise<RecallMemoryOutput>;
|
|
89
|
+
//# sourceMappingURL=recall-memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recall-memory.d.ts","sourceRoot":"","sources":["../../../src/mcp/recall-memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAO1B,MAAM,WAAW,iBAAiB;IAChC,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,4FAA4F;IAC5F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kGAAkG;IAClG,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yEAAyE;IACzE,cAAc,CAAC,EAAE;QACf,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;QAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,0FAA0F;IAC1F,oBAAoB,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;IACrF,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,OAAO,CAAC,EAAE;QACR,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,yBAAyB;QACzB,IAAI,CAAC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IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;CACxB;AA0BD;;;;;;;;;;GAUG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,IAAI,EACV,MAAM,GAAE,OAAO,CAAC,kBAAkB,CAAM,GACvC,OAAO,CAAC,kBAAkB,CAAC,CAsI7B"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Oh My OpenAgent (OmO) 适配器
|
|
3
|
+
*
|
|
4
|
+
* 将 PG Memory 插件升格为 OmO 基础设施的核心适配层
|
|
5
|
+
* 处理多 Agent 环境下的记忆隔离、注入和反思
|
|
6
|
+
*/
|
|
7
|
+
import { Pool } from 'pg';
|
|
8
|
+
import { OmOConfig, OmOMemoryInjection, OmOReflectionResult, OmOTaskCreatedEvent, OmOTaskCompletedEvent, OmOAgentSpawnedEvent, OmODCPCoordination } from './types';
|
|
9
|
+
export interface OmOAdapterOptions {
|
|
10
|
+
config?: Partial<OmOConfig>;
|
|
11
|
+
pool: Pool;
|
|
12
|
+
omOCallbacks?: {
|
|
13
|
+
onWisdomCreated?: (wisdom: any) => Promise<void>;
|
|
14
|
+
onContextInjected?: (injection: OmOMemoryInjection) => Promise<void>;
|
|
15
|
+
getOmOContextBudget?: (agentId: string) => Promise<number>;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* OmO 适配器主类
|
|
20
|
+
*/
|
|
21
|
+
export declare class OmOAdapter {
|
|
22
|
+
private config;
|
|
23
|
+
private pool;
|
|
24
|
+
private callbacks;
|
|
25
|
+
private agentContexts;
|
|
26
|
+
private dcpCoordination;
|
|
27
|
+
constructor(options: OmOAdapterOptions);
|
|
28
|
+
/**
|
|
29
|
+
* 初始化 OmO 适配器
|
|
30
|
+
*/
|
|
31
|
+
initialize(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* 检测 OmO 环境
|
|
34
|
+
*/
|
|
35
|
+
private detectOmOEnvironment;
|
|
36
|
+
/**
|
|
37
|
+
* 初始化 OmO 相关的数据库 Schema
|
|
38
|
+
*/
|
|
39
|
+
private initializeOmOSchema;
|
|
40
|
+
/**
|
|
41
|
+
* 处理 omo.task.created
|
|
42
|
+
* 在任务创建时注入相关记忆
|
|
43
|
+
*/
|
|
44
|
+
onTaskCreated(event: OmOTaskCreatedEvent): Promise<OmOMemoryInjection>;
|
|
45
|
+
/**
|
|
46
|
+
* 处理 omo.task.completed
|
|
47
|
+
* 触发反思任务
|
|
48
|
+
*/
|
|
49
|
+
onTaskCompleted(event: OmOTaskCompletedEvent): Promise<OmOReflectionResult | null>;
|
|
50
|
+
/**
|
|
51
|
+
* 处理 omo.agent.spawned
|
|
52
|
+
* 初始化子 Agent 的上下文
|
|
53
|
+
*/
|
|
54
|
+
onAgentSpawned(event: OmOAgentSpawnedEvent): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* 处理 omo.context.injection
|
|
57
|
+
* OmO 的上下文注入钩子(如果启用)
|
|
58
|
+
*/
|
|
59
|
+
onContextInjection(agentId: string, taskContext: any): Promise<OmOMemoryInjection>;
|
|
60
|
+
/**
|
|
61
|
+
* 为任务注入记忆
|
|
62
|
+
*/
|
|
63
|
+
private injectMemoryForTask;
|
|
64
|
+
/**
|
|
65
|
+
* 为 Agent 注入记忆
|
|
66
|
+
*/
|
|
67
|
+
private injectMemoryForAgent;
|
|
68
|
+
/**
|
|
69
|
+
* 执行记忆注入
|
|
70
|
+
*/
|
|
71
|
+
private executeMemoryInjection;
|
|
72
|
+
/**
|
|
73
|
+
* 按 Agent 范围过滤结果
|
|
74
|
+
*/
|
|
75
|
+
private filterByAgentScope;
|
|
76
|
+
/**
|
|
77
|
+
* 计算与 OmO 协调的 Token 预算
|
|
78
|
+
*/
|
|
79
|
+
private calculateCoordinatedBudget;
|
|
80
|
+
/**
|
|
81
|
+
* 执行反思任务
|
|
82
|
+
*/
|
|
83
|
+
private performReflection;
|
|
84
|
+
/**
|
|
85
|
+
* 继承父 Agent 的上下文
|
|
86
|
+
*/
|
|
87
|
+
private inheritParentContext;
|
|
88
|
+
/**
|
|
89
|
+
* 设置 DCP 协调模式
|
|
90
|
+
*/
|
|
91
|
+
setDCPCoordination(coordination: Partial<OmODCPCoordination>): void;
|
|
92
|
+
/**
|
|
93
|
+
* 获取 DCP 协调状态
|
|
94
|
+
*/
|
|
95
|
+
getDCPCoordination(): OmODCPCoordination;
|
|
96
|
+
/**
|
|
97
|
+
* 获取 Agent 统计信息
|
|
98
|
+
*/
|
|
99
|
+
getAgentStats(agentId: string): Promise<{
|
|
100
|
+
observationCount: number;
|
|
101
|
+
cacheHitRate: number;
|
|
102
|
+
reflectionCount: number;
|
|
103
|
+
activeTasks: number;
|
|
104
|
+
}>;
|
|
105
|
+
/**
|
|
106
|
+
* 获取配置
|
|
107
|
+
*/
|
|
108
|
+
getConfig(): OmOConfig;
|
|
109
|
+
/**
|
|
110
|
+
* 更新配置
|
|
111
|
+
*/
|
|
112
|
+
updateConfig(config: Partial<OmOConfig>): void;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* 将 MemoryResult 格式化为 Agent 可解析的结构化文本
|
|
116
|
+
*
|
|
117
|
+
* 用于 OmO Agent 的系统提示词注入,使 Agent 能够消费记忆结果
|
|
118
|
+
* 并融入决策链条。
|
|
119
|
+
*
|
|
120
|
+
* @param results - recall_memory 返回的结果列表
|
|
121
|
+
* @param maxPerType - 每种类型最多输出的条数 (默认: 5)
|
|
122
|
+
* @returns 格式化后的 Markdown 字符串
|
|
123
|
+
*/
|
|
124
|
+
export declare function formatMemoriesForAgent(results: Array<{
|
|
125
|
+
id: string;
|
|
126
|
+
type: string;
|
|
127
|
+
data: Record<string, any>;
|
|
128
|
+
relevance_score: number;
|
|
129
|
+
context: string;
|
|
130
|
+
}>, maxPerType?: number): string;
|
|
131
|
+
/**
|
|
132
|
+
* 为 Agent 系统提示词生成记忆使用指南
|
|
133
|
+
*
|
|
134
|
+
* 将此函数的输出注入到 OmO Agent 的系统提示词中,
|
|
135
|
+
* 以便 Agent 知道如何自主调用 recall_memory 和 hindsight_reflect。
|
|
136
|
+
*
|
|
137
|
+
* @returns Agent 系统提示词片段
|
|
138
|
+
*/
|
|
139
|
+
export declare function getMemoryAgentInstructions(): string;
|
|
140
|
+
/**
|
|
141
|
+
* 创建 OmO 适配器实例
|
|
142
|
+
*/
|
|
143
|
+
export declare function createOmOAdapter(options: OmOAdapterOptions): OmOAdapter;
|
|
144
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/omo/adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EACL,SAAS,EAKT,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAEnB,MAAM,SAAS,CAAC;AAKjB,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5B,IAAI,EAAE,IAAI,CAAC;IAEX,YAAY,CAAC,EAAE;QACb,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QACjD,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QACrE,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC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QACxB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IA2BF;;OAEG;IACH,SAAS,IAAI,SAAS;IAItB;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI;CAG/C;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,KAAK,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC,EACF,UAAU,GAAE,MAAU,GACrB,MAAM,CAkDR;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAkBnD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,UAAU,CAEvE"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Oh My OpenAgent (OmO) 适配层类型定义
|
|
3
|
+
*
|
|
4
|
+
* 定义 OmO 特有的类型和接口,用于多 Agent 环境下的记忆管理
|
|
5
|
+
*/
|
|
6
|
+
export interface OmOAgent {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
role: 'orchestrator' | 'worker' | 'specialist' | 'infrastructure';
|
|
10
|
+
parentAgentId?: string;
|
|
11
|
+
taskId?: string;
|
|
12
|
+
metadata?: Record<string, any>;
|
|
13
|
+
}
|
|
14
|
+
export interface OmOTaskContext {
|
|
15
|
+
taskId: string;
|
|
16
|
+
sessionId: string;
|
|
17
|
+
agentId: string;
|
|
18
|
+
parentTaskId?: string;
|
|
19
|
+
taskType: string;
|
|
20
|
+
priority: number;
|
|
21
|
+
deadline?: Date;
|
|
22
|
+
}
|
|
23
|
+
export type OmOHookType = 'omo.task.created' | 'omo.task.assigned' | 'omo.task.started' | 'omo.task.completed' | 'omo.task.failed' | 'omo.agent.spawned' | 'omo.agent.terminated' | 'omo.context.injection' | 'omo.wisdom.accumulation' | 'omo.session.init' | 'omo.session.cleanup';
|
|
24
|
+
export interface OmOConfig {
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
integrationMode: 'skill' | 'infrastructure' | 'hybrid';
|
|
27
|
+
infrastructureMode?: {
|
|
28
|
+
priority: 'high' | 'normal' | 'low';
|
|
29
|
+
reservedForAgents: string[];
|
|
30
|
+
disabledOmOHooks: OmOHookType[];
|
|
31
|
+
observationThreshold?: number;
|
|
32
|
+
};
|
|
33
|
+
skillMode?: {
|
|
34
|
+
skillName: string;
|
|
35
|
+
autoInject: boolean;
|
|
36
|
+
injectTiming: 'pre-task' | 'on-demand';
|
|
37
|
+
};
|
|
38
|
+
agentIsolation: {
|
|
39
|
+
enabled: boolean;
|
|
40
|
+
sharedTiers: ('permanent' | 'project')[];
|
|
41
|
+
isolatedTiers: ('session' | 'agent')[];
|
|
42
|
+
};
|
|
43
|
+
wisdomIntegration: {
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
syncToOmO: boolean;
|
|
46
|
+
useOmOWisdom: boolean;
|
|
47
|
+
conflictResolution: 'omo-priority' | 'pg-memory-priority' | 'merge';
|
|
48
|
+
};
|
|
49
|
+
tokenBudgetCoordination: {
|
|
50
|
+
enabled: boolean;
|
|
51
|
+
respectOmOBudget: boolean;
|
|
52
|
+
budgetAllocation: 'omo-first' | 'equal' | 'memory-first';
|
|
53
|
+
maxOmOContextRatio: number;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export declare const DEFAULT_OMO_CONFIG: OmOConfig;
|
|
57
|
+
export interface OmOMemoryQuery {
|
|
58
|
+
query: string;
|
|
59
|
+
sessionId: string;
|
|
60
|
+
agentId: string;
|
|
61
|
+
taskId?: string;
|
|
62
|
+
agentScope: 'self' | 'siblings' | 'parent' | 'children' | 'all';
|
|
63
|
+
tierFilter?: ('permanent' | 'project' | 'session' | 'agent')[];
|
|
64
|
+
includeOmOWisdom?: boolean;
|
|
65
|
+
strategies?: ('semantic' | 'bm25' | 'graph' | 'temporal')[];
|
|
66
|
+
}
|
|
67
|
+
export interface OmOMemoryInjection {
|
|
68
|
+
agentId: string;
|
|
69
|
+
taskId?: string;
|
|
70
|
+
injectedMemories: string[];
|
|
71
|
+
tokenCount: number;
|
|
72
|
+
sourceTiers: Record<string, number>;
|
|
73
|
+
omOBudgetReserved: number;
|
|
74
|
+
coordinationApplied: boolean;
|
|
75
|
+
}
|
|
76
|
+
export interface OmOReflectionResult {
|
|
77
|
+
reflectionId: string;
|
|
78
|
+
agentId: string;
|
|
79
|
+
sessionId: string;
|
|
80
|
+
patterns: Array<{
|
|
81
|
+
patternType: string;
|
|
82
|
+
description: string;
|
|
83
|
+
confidence: number;
|
|
84
|
+
sourceObservationIds: string[];
|
|
85
|
+
}>;
|
|
86
|
+
wisdomEntry?: {
|
|
87
|
+
id: string;
|
|
88
|
+
type: 'pattern' | 'insight' | 'lesson';
|
|
89
|
+
content: string;
|
|
90
|
+
metadata: {
|
|
91
|
+
source: 'pg-memory-hindsight';
|
|
92
|
+
agentId: string;
|
|
93
|
+
timestamp: string;
|
|
94
|
+
confidence: number;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export interface OmOTaskCreatedEvent {
|
|
99
|
+
taskId: string;
|
|
100
|
+
sessionId: string;
|
|
101
|
+
agentId: string;
|
|
102
|
+
taskType: string;
|
|
103
|
+
parentTaskId?: string;
|
|
104
|
+
contextSnapshot?: any;
|
|
105
|
+
}
|
|
106
|
+
export interface OmOTaskCompletedEvent {
|
|
107
|
+
taskId: string;
|
|
108
|
+
sessionId: string;
|
|
109
|
+
agentId: string;
|
|
110
|
+
result: any;
|
|
111
|
+
durationMs: number;
|
|
112
|
+
observationsCount: number;
|
|
113
|
+
}
|
|
114
|
+
export interface OmOAgentSpawnedEvent {
|
|
115
|
+
agentId: string;
|
|
116
|
+
parentAgentId?: string;
|
|
117
|
+
sessionId: string;
|
|
118
|
+
role: string;
|
|
119
|
+
initialContext?: any;
|
|
120
|
+
}
|
|
121
|
+
export interface OmODCPCoordination {
|
|
122
|
+
omODCPEnabled: boolean;
|
|
123
|
+
pgMemoryDCPEnabled: boolean;
|
|
124
|
+
coordinationMode: 'omo-only' | 'pg-memory-only' | 'coordinated';
|
|
125
|
+
activeDCPProvider: 'omo' | 'pg-memory' | 'none';
|
|
126
|
+
sharedCompactionState?: {
|
|
127
|
+
compactedMessageIds: string[];
|
|
128
|
+
preservedMessageIds: string[];
|
|
129
|
+
timestamp: Date;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/omo/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,cAAc,GAAG,QAAQ,GAAG,YAAY,GAAG,gBAAgB,CAAC;IAClE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAGD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,IAAI,CAAC;CACjB;AAGD,MAAM,MAAM,WAAW,GACnB,kBAAkB,GAClB,mBAAmB,GACnB,kBAAkB,GAClB,oBAAoB,GACpB,iBAAiB,GACj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AU,EAAE,MAAM,CAAC;SACpB,CAAC;KACH,CAAC;CACH;AAGD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,GAAG,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,GAAG,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,GAAG,CAAC;CACtB;AAGD,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,gBAAgB,EAAE,UAAU,GAAG,gBAAgB,GAAG,aAAa,CAAC;IAGhE,iBAAiB,EAAE,KAAK,GAAG,WAAW,GAAG,MAAM,CAAC;IAGhD,qBAAqB,CAAC,EAAE;QACtB,mBAAmB,EAAE,MAAM,EAAE,CAAC;QAC9B,mBAAmB,EAAE,MAAM,EAAE,CAAC;QAC9B,SAAS,EAAE,IAAI,CAAC;KACjB,CAAC;CACH"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function removeCodeBlocks(text: string): string;
|
|
2
|
+
export declare function detectMemoryKeyword(text: string): boolean;
|
|
3
|
+
export declare const MEMORY_NUDGE_MESSAGE = "[MEMORY TRIGGER DETECTED]\nThe user wants you to remember something important.\nConsider using the following tools to persist this knowledge:\n- recall_memory: to retrieve related context\n- The pg-memory plugin will automatically record this session's observations for future use.";
|
|
4
|
+
//# sourceMappingURL=keyword.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyword.d.ts","sourceRoot":"","sources":["../../../src/services/keyword.ts"],"names":[],"mappings":"AAeA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGzD;AAED,eAAO,MAAM,oBAAoB,8RAI4D,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface Logger {
|
|
2
|
+
debug(msg: string, data?: unknown): void;
|
|
3
|
+
info(msg: string, data?: unknown): void;
|
|
4
|
+
warn(msg: string, data?: unknown): void;
|
|
5
|
+
error(msg: string, data?: unknown): void;
|
|
6
|
+
}
|
|
7
|
+
export declare function createLogger(module: string): Logger;
|
|
8
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/services/logger.ts"],"names":[],"mappings":"AA2BA,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACzC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACxC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACxC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC1C;AAcD,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAOnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"privacy.d.ts","sourceRoot":"","sources":["../../../src/services/privacy.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAG3D;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG3D;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAIvD"}
|