@agentmemory/agentmemory 0.8.10 → 0.8.12
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/AGENTS.md +15 -9
- package/README.md +27 -9
- package/dist/cli.mjs +92 -5
- package/dist/cli.mjs.map +1 -1
- package/dist/iii-config.docker.yaml +26 -25
- package/dist/iii-config.yaml +26 -25
- package/dist/index.mjs +2661 -1056
- package/dist/index.mjs.map +1 -1
- package/dist/{src-65nK6f5B.mjs → src-68MXysnV.mjs} +2642 -1057
- package/dist/src-68MXysnV.mjs.map +1 -0
- package/dist/{standalone-CdWMLSak.mjs → standalone-c2xiEQJ9.mjs} +5 -4
- package/dist/{standalone-CdWMLSak.mjs.map → standalone-c2xiEQJ9.mjs.map} +1 -1
- package/dist/standalone.mjs +24 -3
- package/dist/standalone.mjs.map +1 -1
- package/dist/{tools-registry-DXnvw9ZI.mjs → tools-registry-D96ukJg4.mjs} +22 -2
- package/dist/tools-registry-D96ukJg4.mjs.map +1 -0
- package/dist/viewer/index.html +66 -17
- package/iii-config.docker.yaml +26 -25
- package/iii-config.yaml +26 -25
- package/package.json +2 -2
- package/plugin/.claude-plugin/plugin.json +2 -2
- package/plugin/scripts/diagnostics.mjs +2 -2
- package/dist/src-65nK6f5B.mjs.map +0 -1
- package/dist/tools-registry-DXnvw9ZI.mjs.map +0 -1
|
@@ -169,7 +169,7 @@ function loadFallbackConfig() {
|
|
|
169
169
|
|
|
170
170
|
//#endregion
|
|
171
171
|
//#region src/version.ts
|
|
172
|
-
const VERSION = "0.8.
|
|
172
|
+
const VERSION = "0.8.12";
|
|
173
173
|
|
|
174
174
|
//#endregion
|
|
175
175
|
//#region src/mcp/tools-registry.ts
|
|
@@ -187,11 +187,31 @@ const CORE_TOOLS = [
|
|
|
187
187
|
limit: {
|
|
188
188
|
type: "number",
|
|
189
189
|
description: "Max results to return (default 10)"
|
|
190
|
+
},
|
|
191
|
+
format: {
|
|
192
|
+
type: "string",
|
|
193
|
+
description: "Result format: full, compact, or narrative (default full)"
|
|
194
|
+
},
|
|
195
|
+
token_budget: {
|
|
196
|
+
type: "number",
|
|
197
|
+
description: "Optional token budget to trim returned results"
|
|
190
198
|
}
|
|
191
199
|
},
|
|
192
200
|
required: ["query"]
|
|
193
201
|
}
|
|
194
202
|
},
|
|
203
|
+
{
|
|
204
|
+
name: "memory_compress_file",
|
|
205
|
+
description: "Compress a markdown file to reduce token usage while preserving headings, URLs, and code blocks. Creates a .original.md backup before writing.",
|
|
206
|
+
inputSchema: {
|
|
207
|
+
type: "object",
|
|
208
|
+
properties: { filePath: {
|
|
209
|
+
type: "string",
|
|
210
|
+
description: "Path to the markdown file to compress"
|
|
211
|
+
} },
|
|
212
|
+
required: ["filePath"]
|
|
213
|
+
}
|
|
214
|
+
},
|
|
195
215
|
{
|
|
196
216
|
name: "memory_save",
|
|
197
217
|
description: "Explicitly save an important insight, decision, or pattern to long-term memory.",
|
|
@@ -1092,4 +1112,4 @@ function getVisibleTools() {
|
|
|
1092
1112
|
|
|
1093
1113
|
//#endregion
|
|
1094
1114
|
export { getEnvVar as a, isConsolidationEnabled as c, loadClaudeBridgeConfig as d, loadConfig as f, loadTeamConfig as g, loadSnapshotConfig as h, getConsolidationDecayDays as i, isContextInjectionEnabled as l, loadFallbackConfig as m, VERSION as n, getStandalonePersistPath as o, loadEmbeddingConfig as p, detectEmbeddingProvider as r, isAutoCompressEnabled as s, getVisibleTools as t, isGraphExtractionEnabled as u };
|
|
1095
|
-
//# sourceMappingURL=tools-registry-
|
|
1115
|
+
//# sourceMappingURL=tools-registry-D96ukJg4.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools-registry-D96ukJg4.mjs","names":[],"sources":["../src/config.ts","../src/version.ts","../src/mcp/tools-registry.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport type {\n AgentMemoryConfig,\n ProviderConfig,\n EmbeddingConfig,\n FallbackConfig,\n ClaudeBridgeConfig,\n TeamConfig,\n} from \"./types.js\";\n\nfunction safeParseInt(value: string | undefined, fallback: number): number {\n if (!value) return fallback;\n const parsed = parseInt(value, 10);\n return Number.isNaN(parsed) ? fallback : parsed;\n}\n\nconst DATA_DIR = join(homedir(), \".agentmemory\");\nconst ENV_FILE = join(DATA_DIR, \".env\");\n\nfunction loadEnvFile(): Record<string, string> {\n if (!existsSync(ENV_FILE)) return {};\n const content = readFileSync(ENV_FILE, \"utf-8\");\n const vars: Record<string, string> = {};\n for (const line of content.split(\"\\n\")) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith(\"#\")) continue;\n const eqIdx = trimmed.indexOf(\"=\");\n if (eqIdx === -1) continue;\n const key = trimmed.slice(0, eqIdx).trim();\n let val = trimmed.slice(eqIdx + 1).trim();\n if (\n (val.startsWith('\"') && val.endsWith('\"')) ||\n (val.startsWith(\"'\") && val.endsWith(\"'\"))\n ) {\n val = val.slice(1, -1);\n }\n vars[key] = val;\n }\n return vars;\n}\n\nfunction detectProvider(env: Record<string, string>): ProviderConfig {\n const maxTokens = parseInt(env[\"MAX_TOKENS\"] || \"4096\", 10);\n\n // MiniMax: Anthropic-compatible API, requires raw fetch to avoid SDK stainless headers\n if (env[\"MINIMAX_API_KEY\"]) {\n return {\n provider: \"minimax\",\n model: env[\"MINIMAX_MODEL\"] || \"MiniMax-M2.7\",\n maxTokens,\n };\n }\n\n if (env[\"ANTHROPIC_API_KEY\"]) {\n return {\n provider: \"anthropic\",\n model: env[\"ANTHROPIC_MODEL\"] || \"claude-sonnet-4-20250514\",\n maxTokens,\n baseURL: env[\"ANTHROPIC_BASE_URL\"],\n };\n }\n if (env[\"GEMINI_API_KEY\"]) {\n return {\n provider: \"gemini\",\n model: env[\"GEMINI_MODEL\"] || \"gemini-2.0-flash\",\n maxTokens,\n };\n }\n if (env[\"OPENROUTER_API_KEY\"]) {\n return {\n provider: \"openrouter\",\n model: env[\"OPENROUTER_MODEL\"] || \"anthropic/claude-sonnet-4-20250514\",\n maxTokens,\n };\n }\n return {\n provider: \"agent-sdk\",\n model: \"claude-sonnet-4-20250514\",\n maxTokens: 4096,\n };\n}\n\nexport function loadConfig(): AgentMemoryConfig {\n const env = getMergedEnv();\n\n const provider = detectProvider(env);\n\n return {\n engineUrl: env[\"III_ENGINE_URL\"] || \"ws://localhost:49134\",\n restPort: parseInt(env[\"III_REST_PORT\"] || \"3111\", 10) || 3111,\n streamsPort: parseInt(env[\"III_STREAMS_PORT\"] || \"3112\", 10) || 3112,\n provider,\n tokenBudget: safeParseInt(env[\"TOKEN_BUDGET\"], 2000),\n maxObservationsPerSession: safeParseInt(env[\"MAX_OBS_PER_SESSION\"], 500),\n compressionModel: provider.model,\n dataDir: DATA_DIR,\n };\n}\n\nfunction getMergedEnv(\n overrides?: Record<string, string>,\n): Record<string, string> {\n const fileEnv = loadEnvFile();\n return { ...fileEnv, ...process.env, ...overrides } as Record<string, string>;\n}\n\nexport function getEnvVar(key: string): string | undefined {\n return getMergedEnv()[key];\n}\n\nexport function loadEmbeddingConfig(): EmbeddingConfig {\n const env = getMergedEnv();\n let bm25Weight = parseFloat(env[\"BM25_WEIGHT\"] || \"0.4\");\n let vectorWeight = parseFloat(env[\"VECTOR_WEIGHT\"] || \"0.6\");\n bm25Weight =\n isNaN(bm25Weight) || bm25Weight < 0 ? 0.4 : Math.min(bm25Weight, 1);\n vectorWeight =\n isNaN(vectorWeight) || vectorWeight < 0 ? 0.6 : Math.min(vectorWeight, 1);\n return {\n provider: env[\"EMBEDDING_PROVIDER\"] || undefined,\n bm25Weight,\n vectorWeight,\n };\n}\n\nexport function detectEmbeddingProvider(\n env?: Record<string, string>,\n): string | null {\n const source = env ?? getMergedEnv();\n const forced = source[\"EMBEDDING_PROVIDER\"];\n if (forced) return forced;\n\n if (source[\"GEMINI_API_KEY\"]) return \"gemini\";\n if (source[\"OPENAI_API_KEY\"]) return \"openai\";\n if (source[\"VOYAGE_API_KEY\"]) return \"voyage\";\n if (source[\"COHERE_API_KEY\"]) return \"cohere\";\n if (source[\"OPENROUTER_API_KEY\"]) return \"openrouter\";\n return null;\n}\n\nexport function loadClaudeBridgeConfig(): ClaudeBridgeConfig {\n const env = getMergedEnv();\n const enabled = env[\"CLAUDE_MEMORY_BRIDGE\"] === \"true\";\n const projectPath = env[\"CLAUDE_PROJECT_PATH\"] || \"\";\n const lineBudget = safeParseInt(env[\"CLAUDE_MEMORY_LINE_BUDGET\"], 200);\n let memoryFilePath = \"\";\n if (enabled && projectPath) {\n const safePath = projectPath.replace(/[/\\\\]/g, \"-\").replace(/^-/, \"\");\n memoryFilePath = join(\n homedir(),\n \".claude\",\n \"projects\",\n safePath,\n \"memory\",\n \"MEMORY.md\",\n );\n }\n return { enabled, projectPath, memoryFilePath, lineBudget };\n}\n\nexport function loadTeamConfig(): TeamConfig | null {\n const env = getMergedEnv();\n const teamId = env[\"TEAM_ID\"];\n const userId = env[\"USER_ID\"];\n if (!teamId || !userId) return null;\n const mode = env[\"TEAM_MODE\"] === \"shared\" ? \"shared\" : \"private\";\n return { teamId, userId, mode };\n}\n\nexport function loadSnapshotConfig(): {\n enabled: boolean;\n interval: number;\n dir: string;\n} {\n const env = getMergedEnv();\n return {\n enabled: env[\"SNAPSHOT_ENABLED\"] === \"true\",\n interval: safeParseInt(env[\"SNAPSHOT_INTERVAL\"], 3600),\n dir: env[\"SNAPSHOT_DIR\"] || join(homedir(), \".agentmemory\", \"snapshots\"),\n };\n}\n\nexport function isGraphExtractionEnabled(): boolean {\n return getMergedEnv()[\"GRAPH_EXTRACTION_ENABLED\"] === \"true\";\n}\n\nexport function getGraphBatchSize(): number {\n return safeParseInt(getMergedEnv()[\"GRAPH_EXTRACTION_BATCH_SIZE\"], 10);\n}\n\nexport function isConsolidationEnabled(): boolean {\n return getMergedEnv()[\"CONSOLIDATION_ENABLED\"] === \"true\";\n}\n\n// Per-observation LLM compression is OFF by default as of 0.8.8 (see #138).\n// When disabled, observations are captured and indexed via a synthetic\n// (zero-LLM) compression path so recall/search still works. Users who want\n// richer LLM-generated summaries can set AGENTMEMORY_AUTO_COMPRESS=true in\n// ~/.agentmemory/.env — but should expect their Claude API token usage to\n// climb proportionally with session tool-use frequency.\nexport function isAutoCompressEnabled(): boolean {\n return getMergedEnv()[\"AGENTMEMORY_AUTO_COMPRESS\"] === \"true\";\n}\n\n// Hook-level context injection into Claude Code's conversation is OFF by\n// default as of 0.8.10 (see #143). When disabled, pre-tool-use and\n// session-start hooks still POST observations for background capture, but\n// never write context to stdout — so Claude Code doesn't inject an extra\n// ~4000-char blob into every tool turn. 0.8.8 stopped the agentmemory-side\n// Claude calls (via ANTHROPIC_API_KEY); this stops the Claude Code-side\n// token burn where every tool call silently grew the model input window.\n// Users who want the in-conversation context injection explicitly opt in\n// with AGENTMEMORY_INJECT_CONTEXT=true and get a loud startup warning.\nexport function isContextInjectionEnabled(): boolean {\n return getMergedEnv()[\"AGENTMEMORY_INJECT_CONTEXT\"] === \"true\";\n}\n\nexport function getConsolidationDecayDays(): number {\n return safeParseInt(getMergedEnv()[\"CONSOLIDATION_DECAY_DAYS\"], 30);\n}\n\nexport function isStandaloneMcp(): boolean {\n return getMergedEnv()[\"STANDALONE_MCP\"] === \"true\";\n}\n\nexport function getStandalonePersistPath(): string {\n const env = getMergedEnv();\n return (\n env[\"STANDALONE_PERSIST_PATH\"] ||\n join(homedir(), \".agentmemory\", \"standalone.json\")\n );\n}\n\nconst VALID_PROVIDERS = new Set([\n \"anthropic\",\n \"gemini\",\n \"openrouter\",\n \"agent-sdk\",\n \"minimax\",\n]);\n\nexport function loadFallbackConfig(): FallbackConfig {\n const env = getMergedEnv();\n const raw = env[\"FALLBACK_PROVIDERS\"] || \"\";\n const providers = raw\n .split(\",\")\n .map((p) => p.trim())\n .filter(\n (p): p is FallbackConfig[\"providers\"][number] =>\n Boolean(p) && VALID_PROVIDERS.has(p),\n );\n return { providers };\n}\n","export const VERSION: \"0.3.0\" | \"0.4.0\" | \"0.5.0\" | \"0.6.0\" | \"0.6.1\" | \"0.7.0\" | \"0.7.2\" | \"0.7.3\" | \"0.7.4\" | \"0.7.5\" | \"0.7.6\" | \"0.8.1\" | \"0.8.2\" | \"0.8.3\" | \"0.8.4\" | \"0.8.5\" | \"0.8.6\" | \"0.8.7\" | \"0.8.8\" | \"0.8.9\" | \"0.8.10\" | \"0.8.11\" | \"0.8.12\" = \"0.8.12\";\n","export type McpToolDef = {\n name: string;\n description: string;\n inputSchema: {\n type: \"object\";\n properties: Record<string, { type: string; description: string }>;\n required?: string[];\n };\n};\n\nexport const CORE_TOOLS: McpToolDef[] = [\n {\n name: \"memory_recall\",\n description:\n \"Search past session observations for relevant context. Use when you need to recall what happened in previous sessions, find past decisions, or look up how a file was modified before.\",\n inputSchema: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description: \"Search query (keywords, file names, concepts)\",\n },\n limit: {\n type: \"number\",\n description: \"Max results to return (default 10)\",\n },\n format: {\n type: \"string\",\n description: \"Result format: full, compact, or narrative (default full)\",\n },\n token_budget: {\n type: \"number\",\n description: \"Optional token budget to trim returned results\",\n },\n },\n required: [\"query\"],\n },\n },\n {\n name: \"memory_compress_file\",\n description:\n \"Compress a markdown file to reduce token usage while preserving headings, URLs, and code blocks. Creates a .original.md backup before writing.\",\n inputSchema: {\n type: \"object\",\n properties: {\n filePath: {\n type: \"string\",\n description: \"Path to the markdown file to compress\",\n },\n },\n required: [\"filePath\"],\n },\n },\n {\n name: \"memory_save\",\n description:\n \"Explicitly save an important insight, decision, or pattern to long-term memory.\",\n inputSchema: {\n type: \"object\",\n properties: {\n content: {\n type: \"string\",\n description: \"The insight or decision to remember\",\n },\n type: {\n type: \"string\",\n description:\n \"Memory type: pattern, preference, architecture, bug, workflow, or fact\",\n },\n concepts: {\n type: \"string\",\n description: \"Comma-separated key concepts\",\n },\n files: {\n type: \"string\",\n description: \"Comma-separated relevant file paths\",\n },\n },\n required: [\"content\"],\n },\n },\n {\n name: \"memory_file_history\",\n description: \"Get past observations about specific files.\",\n inputSchema: {\n type: \"object\",\n properties: {\n files: { type: \"string\", description: \"Comma-separated file paths\" },\n sessionId: {\n type: \"string\",\n description: \"Current session ID to exclude\",\n },\n },\n required: [\"files\"],\n },\n },\n {\n name: \"memory_patterns\",\n description: \"Detect recurring patterns across sessions.\",\n inputSchema: {\n type: \"object\",\n properties: {\n project: { type: \"string\", description: \"Project path to analyze\" },\n },\n },\n },\n {\n name: \"memory_sessions\",\n description:\n \"List recent sessions with their status and observation counts.\",\n inputSchema: { type: \"object\", properties: {} },\n },\n {\n name: \"memory_smart_search\",\n description: \"Hybrid semantic+keyword search with progressive disclosure.\",\n inputSchema: {\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"Search query\" },\n expandIds: {\n type: \"string\",\n description: \"Comma-separated observation IDs to expand\",\n },\n limit: { type: \"number\", description: \"Max results (default 10)\" },\n },\n required: [\"query\"],\n },\n },\n {\n name: \"memory_timeline\",\n description: \"Chronological observations around an anchor point.\",\n inputSchema: {\n type: \"object\",\n properties: {\n anchor: {\n type: \"string\",\n description: \"Anchor point: ISO date or keyword\",\n },\n project: { type: \"string\", description: \"Filter by project path\" },\n before: {\n type: \"number\",\n description: \"Observations before anchor (default 5)\",\n },\n after: {\n type: \"number\",\n description: \"Observations after anchor (default 5)\",\n },\n },\n required: [\"anchor\"],\n },\n },\n {\n name: \"memory_profile\",\n description: \"User/project profile with top concepts and file patterns.\",\n inputSchema: {\n type: \"object\",\n properties: {\n project: { type: \"string\", description: \"Project path\" },\n refresh: {\n type: \"string\",\n description: \"Set to 'true' to force rebuild\",\n },\n },\n required: [\"project\"],\n },\n },\n {\n name: \"memory_export\",\n description: \"Export all memory data as JSON.\",\n inputSchema: { type: \"object\", properties: {} },\n },\n {\n name: \"memory_relations\",\n description: \"Query the memory relationship graph.\",\n inputSchema: {\n type: \"object\",\n properties: {\n memoryId: {\n type: \"string\",\n description: \"Memory ID to find relations for\",\n },\n maxHops: {\n type: \"number\",\n description: \"Max traversal depth (default 2)\",\n },\n minConfidence: {\n type: \"number\",\n description: \"Min confidence (0-1, default 0)\",\n },\n },\n required: [\"memoryId\"],\n },\n },\n];\n\nexport const V040_TOOLS: McpToolDef[] = [\n {\n name: \"memory_claude_bridge_sync\",\n description:\n \"Sync memory state to/from Claude Code's native MEMORY.md file.\",\n inputSchema: {\n type: \"object\",\n properties: {\n direction: {\n type: \"string\",\n description:\n \"'read' to import from MEMORY.md, 'write' to export to MEMORY.md\",\n },\n },\n required: [\"direction\"],\n },\n },\n {\n name: \"memory_graph_query\",\n description: \"Query the knowledge graph for entities and relationships.\",\n inputSchema: {\n type: \"object\",\n properties: {\n startNodeId: {\n type: \"string\",\n description: \"Starting node ID for traversal\",\n },\n nodeType: { type: \"string\", description: \"Filter by node type\" },\n maxDepth: {\n type: \"number\",\n description: \"Max BFS depth (default 3, max 5)\",\n },\n query: { type: \"string\", description: \"Search nodes by name\" },\n },\n },\n },\n {\n name: \"memory_consolidate\",\n description:\n \"Run the 4-tier memory consolidation pipeline (working -> episodic -> semantic -> procedural).\",\n inputSchema: {\n type: \"object\",\n properties: {\n tier: {\n type: \"string\",\n description: \"Target tier: episodic, semantic, or procedural\",\n },\n },\n },\n },\n {\n name: \"memory_team_share\",\n description: \"Share a memory or observation with team members.\",\n inputSchema: {\n type: \"object\",\n properties: {\n itemId: {\n type: \"string\",\n description: \"ID of memory or observation to share\",\n },\n itemType: {\n type: \"string\",\n description: \"Type: observation, memory, or pattern\",\n },\n },\n required: [\"itemId\", \"itemType\"],\n },\n },\n {\n name: \"memory_team_feed\",\n description: \"Get recent shared items from all team members.\",\n inputSchema: {\n type: \"object\",\n properties: {\n limit: { type: \"number\", description: \"Max items (default 20)\" },\n },\n },\n },\n {\n name: \"memory_audit\",\n description: \"View the audit trail of memory operations.\",\n inputSchema: {\n type: \"object\",\n properties: {\n operation: { type: \"string\", description: \"Filter by operation type\" },\n limit: { type: \"number\", description: \"Max entries (default 50)\" },\n },\n },\n },\n {\n name: \"memory_governance_delete\",\n description: \"Delete specific memories with audit trail.\",\n inputSchema: {\n type: \"object\",\n properties: {\n memoryIds: {\n type: \"string\",\n description: \"Comma-separated memory IDs to delete\",\n },\n reason: { type: \"string\", description: \"Reason for deletion\" },\n },\n required: [\"memoryIds\"],\n },\n },\n {\n name: \"memory_snapshot_create\",\n description: \"Create a git-versioned snapshot of current memory state.\",\n inputSchema: {\n type: \"object\",\n properties: {\n message: { type: \"string\", description: \"Snapshot description\" },\n },\n },\n },\n];\n\nexport const V050_TOOLS: McpToolDef[] = [\n {\n name: \"memory_action_create\",\n description:\n \"Create an actionable work item with typed dependencies. Actions track what agents need to do and how work items relate to each other.\",\n inputSchema: {\n type: \"object\",\n properties: {\n title: { type: \"string\", description: \"Action title\" },\n description: {\n type: \"string\",\n description: \"Detailed description of the work\",\n },\n priority: {\n type: \"number\",\n description: \"Priority 1-10 (10 highest)\",\n },\n project: { type: \"string\", description: \"Project path\" },\n tags: {\n type: \"string\",\n description: \"Comma-separated tags\",\n },\n parentId: {\n type: \"string\",\n description: \"Parent action ID for hierarchical actions\",\n },\n requires: {\n type: \"string\",\n description:\n \"Comma-separated action IDs that must complete before this\",\n },\n },\n required: [\"title\"],\n },\n },\n {\n name: \"memory_action_update\",\n description:\n \"Update an action's status, priority, or details. Set status to 'done' to complete it and unblock dependent actions.\",\n inputSchema: {\n type: \"object\",\n properties: {\n actionId: { type: \"string\", description: \"Action ID to update\" },\n status: {\n type: \"string\",\n description: \"New status: pending, active, done, blocked, cancelled\",\n },\n result: {\n type: \"string\",\n description: \"Outcome description (when completing)\",\n },\n priority: { type: \"number\", description: \"New priority 1-10\" },\n },\n required: [\"actionId\"],\n },\n },\n {\n name: \"memory_frontier\",\n description:\n \"Get all unblocked actions ranked by priority and urgency. Returns the frontier of actionable work with no unsatisfied dependencies.\",\n inputSchema: {\n type: \"object\",\n properties: {\n project: { type: \"string\", description: \"Filter by project\" },\n agentId: {\n type: \"string\",\n description: \"Agent ID to check lease conflicts\",\n },\n limit: { type: \"number\", description: \"Max results (default 20)\" },\n },\n },\n },\n {\n name: \"memory_next\",\n description:\n \"Get the single most important next action to work on. Combines dependency resolution, priority, and recency into a score.\",\n inputSchema: {\n type: \"object\",\n properties: {\n project: { type: \"string\", description: \"Filter by project\" },\n agentId: { type: \"string\", description: \"Current agent ID\" },\n },\n },\n },\n {\n name: \"memory_lease\",\n description:\n \"Acquire, release, or renew an exclusive lease on an action. Prevents multiple agents from working on the same thing.\",\n inputSchema: {\n type: \"object\",\n properties: {\n actionId: { type: \"string\", description: \"Action ID\" },\n agentId: { type: \"string\", description: \"Agent claiming the action\" },\n operation: {\n type: \"string\",\n description: \"acquire, release, or renew\",\n },\n result: {\n type: \"string\",\n description: \"Result when releasing (marks action done)\",\n },\n ttlMs: {\n type: \"number\",\n description: \"Lease duration in ms (default 10min, max 1hr)\",\n },\n },\n required: [\"actionId\", \"agentId\", \"operation\"],\n },\n },\n {\n name: \"memory_routine_run\",\n description:\n \"Instantiate a frozen workflow routine, creating actions for each step with proper dependencies.\",\n inputSchema: {\n type: \"object\",\n properties: {\n routineId: { type: \"string\", description: \"Routine template ID\" },\n project: { type: \"string\", description: \"Project context\" },\n initiatedBy: { type: \"string\", description: \"Agent starting the run\" },\n },\n required: [\"routineId\"],\n },\n },\n {\n name: \"memory_signal_send\",\n description:\n \"Send a message to another agent or broadcast. Supports threading, typed messages, and TTL expiration.\",\n inputSchema: {\n type: \"object\",\n properties: {\n from: { type: \"string\", description: \"Sender agent ID\" },\n to: {\n type: \"string\",\n description: \"Recipient agent ID (omit for broadcast)\",\n },\n content: { type: \"string\", description: \"Message content\" },\n type: {\n type: \"string\",\n description: \"Message type: info, request, response, alert, handoff\",\n },\n replyTo: {\n type: \"string\",\n description: \"Signal ID to reply to (auto-threads)\",\n },\n },\n required: [\"from\", \"content\"],\n },\n },\n {\n name: \"memory_signal_read\",\n description:\n \"Read messages for an agent. Marks delivered messages as read.\",\n inputSchema: {\n type: \"object\",\n properties: {\n agentId: { type: \"string\", description: \"Agent to read messages for\" },\n unreadOnly: {\n type: \"string\",\n description: \"Set to 'true' for unread only\",\n },\n threadId: {\n type: \"string\",\n description: \"Filter by conversation thread\",\n },\n limit: { type: \"number\", description: \"Max messages (default 50)\" },\n },\n required: [\"agentId\"],\n },\n },\n {\n name: \"memory_checkpoint\",\n description:\n \"Create or resolve an external checkpoint (CI result, approval, deploy status) that gates action progress.\",\n inputSchema: {\n type: \"object\",\n properties: {\n operation: {\n type: \"string\",\n description: \"create, resolve, or list\",\n },\n name: { type: \"string\", description: \"Checkpoint name (for create)\" },\n checkpointId: {\n type: \"string\",\n description: \"Checkpoint ID (for resolve)\",\n },\n status: {\n type: \"string\",\n description: \"passed or failed (for resolve)\",\n },\n type: {\n type: \"string\",\n description: \"Checkpoint type: ci, approval, deploy, external, timer\",\n },\n linkedActionIds: {\n type: \"string\",\n description:\n \"Comma-separated action IDs this checkpoint gates (for create)\",\n },\n },\n required: [\"operation\"],\n },\n },\n {\n name: \"memory_mesh_sync\",\n description:\n \"Sync memories and actions with peer agentmemory instances for multi-agent collaboration.\",\n inputSchema: {\n type: \"object\",\n properties: {\n peerId: {\n type: \"string\",\n description: \"Specific peer ID (omit for all)\",\n },\n direction: {\n type: \"string\",\n description: \"push, pull, or both (default both)\",\n },\n },\n },\n },\n];\n\nexport const V051_TOOLS: McpToolDef[] = [\n {\n name: \"memory_sentinel_create\",\n description:\n \"Create an event-driven sentinel that watches for conditions (webhook, timer, threshold, pattern, approval) and auto-unblocks gated actions when triggered.\",\n inputSchema: {\n type: \"object\",\n properties: {\n name: { type: \"string\", description: \"Sentinel name\" },\n type: {\n type: \"string\",\n description: \"Type: webhook, timer, threshold, pattern, approval, custom\",\n },\n config: {\n type: \"string\",\n description: \"JSON config (timer: {durationMs}, threshold: {metric,operator,value}, pattern: {pattern}, webhook: {path})\",\n },\n linkedActionIds: {\n type: \"string\",\n description: \"Comma-separated action IDs to gate\",\n },\n expiresInMs: { type: \"number\", description: \"Auto-expire after ms\" },\n },\n required: [\"name\", \"type\"],\n },\n },\n {\n name: \"memory_sentinel_trigger\",\n description:\n \"Externally fire a sentinel, providing an optional result payload. Unblocks any gated actions.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sentinelId: { type: \"string\", description: \"Sentinel ID to trigger\" },\n result: { type: \"string\", description: \"JSON result payload\" },\n },\n required: [\"sentinelId\"],\n },\n },\n {\n name: \"memory_sketch_create\",\n description:\n \"Create an ephemeral action graph for exploratory work. Auto-expires after TTL. Can be promoted to permanent actions or discarded.\",\n inputSchema: {\n type: \"object\",\n properties: {\n title: { type: \"string\", description: \"Sketch title\" },\n description: { type: \"string\", description: \"What this sketch explores\" },\n expiresInMs: { type: \"number\", description: \"TTL in ms (default 1 hour)\" },\n project: { type: \"string\", description: \"Project context\" },\n },\n required: [\"title\"],\n },\n },\n {\n name: \"memory_sketch_promote\",\n description:\n \"Promote a sketch's ephemeral actions to permanent actions. Makes the exploratory work official.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sketchId: { type: \"string\", description: \"Sketch ID to promote\" },\n project: { type: \"string\", description: \"Override project for promoted actions\" },\n },\n required: [\"sketchId\"],\n },\n },\n {\n name: \"memory_crystallize\",\n description:\n \"Compress completed action chains into compact crystal digests using LLM summarization. Extracts narrative, key outcomes, files affected, and lessons.\",\n inputSchema: {\n type: \"object\",\n properties: {\n actionIds: {\n type: \"string\",\n description: \"Comma-separated completed action IDs to crystallize\",\n },\n project: { type: \"string\", description: \"Project context\" },\n sessionId: { type: \"string\", description: \"Session context\" },\n },\n required: [\"actionIds\"],\n },\n },\n {\n name: \"memory_diagnose\",\n description:\n \"Run health checks across all subsystems (actions, leases, sentinels, sketches, signals, sessions, memories, mesh). Identifies stuck, orphaned, and inconsistent state.\",\n inputSchema: {\n type: \"object\",\n properties: {\n categories: {\n type: \"string\",\n description: \"Comma-separated categories to check (default all)\",\n },\n },\n },\n },\n {\n name: \"memory_heal\",\n description:\n \"Auto-fix all fixable issues found by diagnostics. Unblocks stuck actions, expires stale leases, cleans up orphaned data.\",\n inputSchema: {\n type: \"object\",\n properties: {\n categories: {\n type: \"string\",\n description: \"Comma-separated categories to heal (default all)\",\n },\n dryRun: {\n type: \"string\",\n description: \"Set to 'true' for dry run (report but don't fix)\",\n },\n },\n },\n },\n {\n name: \"memory_facet_tag\",\n description:\n \"Attach a structured tag (dimension:value) to an action, memory, or observation for multi-dimensional categorization.\",\n inputSchema: {\n type: \"object\",\n properties: {\n targetId: { type: \"string\", description: \"ID of the target to tag\" },\n targetType: {\n type: \"string\",\n description: \"Type: action, memory, or observation\",\n },\n dimension: { type: \"string\", description: \"Tag dimension (e.g., priority, team, status)\" },\n value: { type: \"string\", description: \"Tag value (e.g., urgent, backend, reviewed)\" },\n },\n required: [\"targetId\", \"targetType\", \"dimension\", \"value\"],\n },\n },\n {\n name: \"memory_facet_query\",\n description:\n \"Query targets by facet tags with AND/OR logic. Find all actions tagged priority:urgent AND team:backend.\",\n inputSchema: {\n type: \"object\",\n properties: {\n matchAll: {\n type: \"string\",\n description: \"Comma-separated dimension:value pairs (AND logic)\",\n },\n matchAny: {\n type: \"string\",\n description: \"Comma-separated dimension:value pairs (OR logic)\",\n },\n targetType: {\n type: \"string\",\n description: \"Filter by type: action, memory, or observation\",\n },\n },\n },\n },\n];\n\nexport const V061_TOOLS: McpToolDef[] = [\n {\n name: \"memory_verify\",\n description:\n \"Verify a memory or observation by tracing its citation chain back to source observations and session context. Returns provenance information including confidence scores.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n description: \"Memory ID or observation ID to verify\",\n },\n },\n required: [\"id\"],\n },\n },\n];\n\nexport const V070_TOOLS: McpToolDef[] = [\n {\n name: \"memory_lesson_save\",\n description:\n \"Save a lesson learned from this session. Lessons have confidence scores that strengthen when reinforced and decay when not used. Duplicate content auto-strengthens the existing lesson.\",\n inputSchema: {\n type: \"object\",\n properties: {\n content: {\n type: \"string\",\n description: \"The lesson learned (what worked, what to avoid, when to use X approach)\",\n },\n context: {\n type: \"string\",\n description: \"When/where this lesson applies\",\n },\n confidence: {\n type: \"number\",\n description: \"Initial confidence 0.0-1.0 (default 0.5)\",\n },\n project: { type: \"string\", description: \"Project this lesson is about\" },\n tags: { type: \"string\", description: \"Comma-separated tags\" },\n },\n required: [\"content\"],\n },\n },\n {\n name: \"memory_lesson_recall\",\n description:\n \"Search lessons by query. Returns lessons sorted by confidence and recency. Use to check what the agent has learned before making decisions.\",\n inputSchema: {\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"Search query\" },\n project: { type: \"string\", description: \"Filter by project\" },\n minConfidence: {\n type: \"number\",\n description: \"Minimum confidence threshold (default 0.1)\",\n },\n limit: { type: \"number\", description: \"Max results (default 10)\" },\n },\n required: [\"query\"],\n },\n },\n {\n name: \"memory_obsidian_export\",\n description:\n \"Export memories, lessons, and crystals as Obsidian-compatible Markdown files with YAML frontmatter and wikilinks for graph view.\",\n inputSchema: {\n type: \"object\",\n properties: {\n vaultDir: {\n type: \"string\",\n description: \"Output directory (default ~/.agentmemory/vault/)\",\n },\n types: {\n type: \"string\",\n description: \"Comma-separated types to export: memories,lessons,crystals,sessions (default all)\",\n },\n },\n },\n },\n];\n\nexport const V073_TOOLS: McpToolDef[] = [\n {\n name: \"memory_reflect\",\n description:\n \"Traverse the knowledge graph, group related memories by concept clusters, and synthesize higher-order insights via LLM. Returns new and reinforced insights.\",\n inputSchema: {\n type: \"object\",\n properties: {\n project: { type: \"string\", description: \"Filter by project\" },\n maxClusters: {\n type: \"number\",\n description: \"Max concept clusters to process (default 10, max 20)\",\n },\n },\n },\n },\n {\n name: \"memory_insight_list\",\n description:\n \"List synthesized insights — higher-order observations derived from patterns across memories, lessons, and crystals.\",\n inputSchema: {\n type: \"object\",\n properties: {\n project: { type: \"string\", description: \"Filter by project\" },\n minConfidence: {\n type: \"number\",\n description: \"Minimum confidence threshold (default 0)\",\n },\n limit: { type: \"number\", description: \"Max results (default 50)\" },\n },\n },\n },\n];\n\nconst ESSENTIAL_TOOLS = new Set([\n \"memory_save\",\n \"memory_recall\",\n \"memory_consolidate\",\n \"memory_smart_search\",\n \"memory_sessions\",\n \"memory_diagnose\",\n \"memory_lesson_save\",\n \"memory_reflect\",\n]);\n\nexport function getAllTools(): McpToolDef[] {\n return [...CORE_TOOLS, ...V040_TOOLS, ...V050_TOOLS, ...V051_TOOLS, ...V061_TOOLS, ...V070_TOOLS, ...V073_TOOLS];\n}\n\nexport function getVisibleTools(): McpToolDef[] {\n const mode = process.env[\"AGENTMEMORY_TOOLS\"] || \"core\";\n if (mode === \"all\") return getAllTools();\n return getAllTools().filter((t) => ESSENTIAL_TOOLS.has(t.name));\n}\n"],"mappings":";;;;;AAYA,SAAS,aAAa,OAA2B,UAA0B;AACzE,KAAI,CAAC,MAAO,QAAO;CACnB,MAAM,SAAS,SAAS,OAAO,GAAG;AAClC,QAAO,OAAO,MAAM,OAAO,GAAG,WAAW;;AAG3C,MAAM,WAAW,KAAK,SAAS,EAAE,eAAe;AAChD,MAAM,WAAW,KAAK,UAAU,OAAO;AAEvC,SAAS,cAAsC;AAC7C,KAAI,CAAC,WAAW,SAAS,CAAE,QAAO,EAAE;CACpC,MAAM,UAAU,aAAa,UAAU,QAAQ;CAC/C,MAAM,OAA+B,EAAE;AACvC,MAAK,MAAM,QAAQ,QAAQ,MAAM,KAAK,EAAE;EACtC,MAAM,UAAU,KAAK,MAAM;AAC3B,MAAI,CAAC,WAAW,QAAQ,WAAW,IAAI,CAAE;EACzC,MAAM,QAAQ,QAAQ,QAAQ,IAAI;AAClC,MAAI,UAAU,GAAI;EAClB,MAAM,MAAM,QAAQ,MAAM,GAAG,MAAM,CAAC,MAAM;EAC1C,IAAI,MAAM,QAAQ,MAAM,QAAQ,EAAE,CAAC,MAAM;AACzC,MACG,IAAI,WAAW,KAAI,IAAI,IAAI,SAAS,KAAI,IACxC,IAAI,WAAW,IAAI,IAAI,IAAI,SAAS,IAAI,CAEzC,OAAM,IAA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AM;KACN,aAAa;KACd;IACD,eAAe;KACb,MAAM;KACN,aAAa;KACd;IACF;GACD,UAAU,CAAC,WAAW;GACvB;EACF;CACF;AAED,MAAa,aAA2B;CACtC;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY,EACV,WAAW;IACT,MAAM;IACN,aACE;IACH,EACF;GACD,UAAU,CAAC,YAAY;GACxB;EACF;CACD;EACE,MAAM;EACN,aAAa;EACb,aAAa;GACX,MAAM;GACN,YAAY;IACV,aAAa;KACX,MAAM;KACN,aAAa;KACd;IACD,UAAU;KAAE,MAAM;KAAU,aAAa;KAAuB;IAChE,UAAU;KACR,MAAM;KACN,aAAa;KACd;IACD,OAAO;KAAE,MAAM;KAAU,aAAa;KAAwB;IAC/D;GACF;EACF;CACD;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY,EACV,MAAM;IACJ,MAAM;IACN,aAAa;IACd,EACF;GACF;EACF;CACD;EACE,MAAM;EACN,aAAa;EACb,aAAa;GACX,MAAM;GACN,YAAY;IACV,QAAQ;KACN,MAAM;KACN,aAAa;KACd;IACD,UAAU;KACR,MAAM;KACN,aAAa;KACd;IACF;GACD,UAAU,CAAC,UAAU,WAAW;GACjC;EACF;CACD;EACE,MAAM;EACN,aAAa;EACb,aAAa;GACX,MAAM;GACN,YAAY,EACV,OAAO;IAAE,MAAM;IAAU,aAAa;IAA0B,EACjE;GACF;EACF;CACD;EACE,MAAM;EACN,aAAa;EACb,aAAa;GACX,MAAM;GACN,YAAY;IACV,WAAW;KAAE,MAAM;KAAU,aAAa;KAA4B;IACtE,OAAO;KAAE,MAAM;KAAU,aAAa;KAA4B;IACnE;GACF;EACF;CACD;EACE,MAAM;EACN,aAAa;EACb,aAAa;GACX,MAAM;GACN,YAAY;IACV,WAAW;KACT,MAAM;KACN,aAAa;KACd;IACD,QAAQ;KAAE,MAAM;KAAU,aAAa;KAAuB;IAC/D;GACD,UAAU,CAAC,YAAY;GACxB;EAC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AM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,WAAW;KACT,MAAM;KACN,aAAa;KACd;IACD,SAAS;KAAE,MAAM;KAAU,aAAa;KAAmB;IAC3D,WAAW;KAAE,MAAM;KAAU,aAAa;KAAmB;IAC9D;GACD,UAAU,CAAC,YAAY;GACxB;EACF;CACD;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY,EACV,YAAY;IACV,MAAM;IACN,aAAa;IACd,EACF;GACF;EACF;CACD;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,YAAY;KACV,MAAM;KACN,aAAa;KACd;IACD,QAAQ;KACN,MAAM;KACN,aAAa;KACd;IACF;GACF;EACF;CACD;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,UAAU;KAAE,MAAM;KAAU,aAAa;KAA2B;IACpE,YAAY;KACV,MAAM;KACN,aAAa;KACd;IACD,WAAW;KAAE,MAAM;KAAU,aAAa;KAAgD;IAC1F,OAAO;KAAE,MAAM;KAAU,aAAa;KAA+C;IACtF;GACD,UAAU;IAAC;IAAY;IAAc;IAAa;IAAQ;GAC3D;EACF;CACD;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,UAAU;KACR,MAAM;KACN,aAAa;KACd;IACD,UAAU;KACR,MAAM;KACN,aAAa;KACd;IACD,YAAY;KACV,MAAM;KACN,aAAa;KACd;IACF;GACF;EACF;CACF;AAED,MAAa,aAA2B,CACtC;CACE,MAAM;CACN,aACE;CACF,aAAa;EACX,MAAM;EACN,YAAY,EACV,IAAI;GACF,MAAM;GACN,aAAa;GACd,EACF;EACD,UAAU,CAAC,KAAK;EACjB;CACF,CACF;AAED,MAAa,aAA2B;CACtC;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY;IACV,SAAS;KACP,MAAM;KACN,aAAa;KACd;IACD,SAAS;KACP,MA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wBAAwB,YACpC,MAAO,QAAO,aAAa;AACxC,QAAO,aAAa,CAAC,QAAQ,MAAM,gBAAgB,IAAI,EAAE,KAAK,CAAC"}
|
package/dist/viewer/index.html
CHANGED
|
@@ -809,6 +809,7 @@
|
|
|
809
809
|
var wsProto = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
810
810
|
var wsPort = params.get('wsPort') || String(parseInt(viewerPort) - 1);
|
|
811
811
|
var WS_URL = wsProto + '//' + window.location.hostname + ':' + wsPort;
|
|
812
|
+
var WS_DIRECT_URL = wsProto + '//' + window.location.hostname + ':' + wsPort + '/stream/mem-live/viewer';
|
|
812
813
|
|
|
813
814
|
var dateEl = document.getElementById('dateline');
|
|
814
815
|
if (dateEl) dateEl.textContent = new Date().toLocaleDateString('en-US', { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric' });
|
|
@@ -2789,33 +2790,61 @@
|
|
|
2789
2790
|
var wsReconnectTimer = null;
|
|
2790
2791
|
var wsRetries = 0;
|
|
2791
2792
|
var WS_MAX_RETRIES = 10;
|
|
2793
|
+
var directFailed = false;
|
|
2794
|
+
var directFailures = 0;
|
|
2795
|
+
var DIRECT_FAILURE_THRESHOLD = 2;
|
|
2792
2796
|
|
|
2793
2797
|
function connectWs() {
|
|
2794
2798
|
if (wsRetries >= WS_MAX_RETRIES) return;
|
|
2799
|
+
var useDirect = !directFailed;
|
|
2800
|
+
var ws;
|
|
2795
2801
|
try {
|
|
2796
|
-
|
|
2797
|
-
|
|
2802
|
+
ws = new WebSocket(useDirect ? WS_DIRECT_URL : WS_URL);
|
|
2803
|
+
ws.__direct = useDirect;
|
|
2804
|
+
} catch (_) {
|
|
2805
|
+
ws = new WebSocket(WS_URL);
|
|
2806
|
+
ws.__direct = false;
|
|
2807
|
+
}
|
|
2808
|
+
try {
|
|
2809
|
+
ws.onopen = function() {
|
|
2810
|
+
if (state.ws !== ws) return;
|
|
2798
2811
|
wsRetries = 0;
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2812
|
+
if (ws.__direct) {
|
|
2813
|
+
directFailures = 0;
|
|
2814
|
+
directFailed = false;
|
|
2815
|
+
}
|
|
2816
|
+
if (!ws.__direct) {
|
|
2817
|
+
ws.send(JSON.stringify({
|
|
2818
|
+
type: 'join',
|
|
2819
|
+
data: {
|
|
2820
|
+
subscriptionId: 'viewer-' + Date.now(),
|
|
2821
|
+
streamName: 'mem-live',
|
|
2822
|
+
groupId: 'viewer'
|
|
2823
|
+
}
|
|
2824
|
+
}));
|
|
2825
|
+
}
|
|
2807
2826
|
document.getElementById('ws-status').textContent = 'live';
|
|
2808
2827
|
document.getElementById('ws-status').className = 'ws-status connected';
|
|
2809
2828
|
};
|
|
2810
|
-
|
|
2829
|
+
ws.onmessage = function(e) {
|
|
2830
|
+
if (state.ws !== ws) return;
|
|
2811
2831
|
try {
|
|
2812
2832
|
var msg = JSON.parse(e.data);
|
|
2813
2833
|
if (msg.type === 'stream' && msg.event) {
|
|
2814
2834
|
handleStreamEvent(msg);
|
|
2835
|
+
} else if (msg.event_type && msg.data) {
|
|
2836
|
+
handleStreamEvent({ event: { type: 'create', data: msg.data, event_type: msg.event_type } });
|
|
2815
2837
|
}
|
|
2816
2838
|
} catch {}
|
|
2817
2839
|
};
|
|
2818
|
-
|
|
2840
|
+
ws.onclose = function() {
|
|
2841
|
+
if (state.ws !== ws) return;
|
|
2842
|
+
if (ws.__direct) {
|
|
2843
|
+
directFailures += 1;
|
|
2844
|
+
if (directFailures >= DIRECT_FAILURE_THRESHOLD) {
|
|
2845
|
+
directFailed = true;
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2819
2848
|
document.getElementById('ws-status').textContent = 'reconnecting...';
|
|
2820
2849
|
document.getElementById('ws-status').className = 'ws-status disconnected';
|
|
2821
2850
|
wsRetries++;
|
|
@@ -2825,7 +2854,11 @@
|
|
|
2825
2854
|
document.getElementById('ws-status').textContent = 'disconnected';
|
|
2826
2855
|
}
|
|
2827
2856
|
};
|
|
2828
|
-
|
|
2857
|
+
ws.onerror = function() {
|
|
2858
|
+
if (state.ws !== ws) return;
|
|
2859
|
+
try { ws.close(); } catch {}
|
|
2860
|
+
};
|
|
2861
|
+
state.ws = ws;
|
|
2829
2862
|
} catch {
|
|
2830
2863
|
wsRetries++;
|
|
2831
2864
|
if (wsRetries < WS_MAX_RETRIES) {
|
|
@@ -2834,20 +2867,36 @@
|
|
|
2834
2867
|
}
|
|
2835
2868
|
}
|
|
2836
2869
|
|
|
2870
|
+
function looksLikeObservation(obj) {
|
|
2871
|
+
return !!(obj && typeof obj === 'object' && obj.id && obj.timestamp);
|
|
2872
|
+
}
|
|
2873
|
+
|
|
2837
2874
|
function handleStreamEvent(msg) {
|
|
2838
2875
|
var evt = msg.event;
|
|
2876
|
+
var observation;
|
|
2877
|
+
if (!evt) return;
|
|
2878
|
+
if (evt.event_type && evt.event_type !== 'observation' && evt.event_type !== 'create' && evt.event_type !== 'update') {
|
|
2879
|
+
return;
|
|
2880
|
+
}
|
|
2881
|
+
if (evt.type === 'event' && evt.data) {
|
|
2882
|
+
observation = evt.data.observation || evt.data;
|
|
2883
|
+
if (looksLikeObservation(observation)) {
|
|
2884
|
+
routeWsMessage({ observation: observation });
|
|
2885
|
+
}
|
|
2886
|
+
return;
|
|
2887
|
+
}
|
|
2839
2888
|
if ((evt.type === 'create' || evt.type === 'update') && evt.data) {
|
|
2840
2889
|
var payload = evt.data;
|
|
2841
|
-
|
|
2842
|
-
if (observation) {
|
|
2890
|
+
observation = payload.observation || payload;
|
|
2891
|
+
if (looksLikeObservation(observation)) {
|
|
2843
2892
|
routeWsMessage({ observation: observation });
|
|
2844
2893
|
}
|
|
2845
2894
|
} else if (evt.type === 'sync') {
|
|
2846
2895
|
var items = Array.isArray(evt.data) ? evt.data : [];
|
|
2847
2896
|
items.forEach(function(item) {
|
|
2848
2897
|
var payload = item.data || item;
|
|
2849
|
-
|
|
2850
|
-
if (observation) {
|
|
2898
|
+
observation = payload.observation || payload;
|
|
2899
|
+
if (looksLikeObservation(observation)) {
|
|
2851
2900
|
routeWsMessage({ observation: observation });
|
|
2852
2901
|
}
|
|
2853
2902
|
});
|
package/iii-config.docker.yaml
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
-
|
|
3
|
-
config:
|
|
4
|
-
adapter:
|
|
5
|
-
class: modules::state::adapters::KvStore
|
|
6
|
-
config:
|
|
7
|
-
store_method: file_based
|
|
8
|
-
file_path: ./data/state_store.db
|
|
9
|
-
|
|
10
|
-
- class: modules::api::RestApiModule
|
|
1
|
+
workers:
|
|
2
|
+
- name: iii-http
|
|
11
3
|
config:
|
|
12
4
|
port: 3111
|
|
13
5
|
host: 0.0.0.0
|
|
@@ -15,35 +7,44 @@ modules:
|
|
|
15
7
|
cors:
|
|
16
8
|
allowed_origins: ["http://localhost:3111", "http://localhost:3113", "http://127.0.0.1:3111", "http://127.0.0.1:3113"]
|
|
17
9
|
allowed_methods: [GET, POST, PUT, DELETE, OPTIONS]
|
|
18
|
-
|
|
19
|
-
- class: modules::queue::QueueModule
|
|
10
|
+
- name: iii-state
|
|
20
11
|
config:
|
|
21
12
|
adapter:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
name: kv
|
|
14
|
+
config:
|
|
15
|
+
store_method: file_based
|
|
16
|
+
file_path: ./data/state_store.db
|
|
17
|
+
- name: iii-queue
|
|
18
|
+
config:
|
|
19
|
+
adapter:
|
|
20
|
+
name: builtin
|
|
21
|
+
- name: iii-pubsub
|
|
25
22
|
config:
|
|
26
23
|
adapter:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- class: modules::cron::CronModule
|
|
24
|
+
name: local
|
|
25
|
+
- name: iii-cron
|
|
30
26
|
config:
|
|
31
27
|
adapter:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- class: modules::stream::StreamModule
|
|
28
|
+
name: kv
|
|
29
|
+
- name: iii-stream
|
|
35
30
|
config:
|
|
36
31
|
port: 3112
|
|
37
32
|
host: 0.0.0.0
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
adapter:
|
|
34
|
+
name: kv
|
|
35
|
+
config:
|
|
36
|
+
store_method: file_based
|
|
37
|
+
file_path: ./data/stream_store
|
|
38
|
+
- name: iii-observability
|
|
40
39
|
config:
|
|
41
40
|
enabled: true
|
|
42
41
|
service_name: agentmemory
|
|
43
42
|
exporter: memory
|
|
43
|
+
sampling_ratio: 1.0
|
|
44
|
+
metrics_enabled: true
|
|
44
45
|
logs_enabled: true
|
|
45
|
-
|
|
46
|
-
-
|
|
46
|
+
logs_console_output: true
|
|
47
|
+
- name: iii-exec
|
|
47
48
|
config:
|
|
48
49
|
watch:
|
|
49
50
|
- src/**/*.ts
|
package/iii-config.yaml
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
-
|
|
3
|
-
config:
|
|
4
|
-
adapter:
|
|
5
|
-
class: modules::state::adapters::KvStore
|
|
6
|
-
config:
|
|
7
|
-
store_method: file_based
|
|
8
|
-
file_path: ./data/state_store.db
|
|
9
|
-
|
|
10
|
-
- class: modules::api::RestApiModule
|
|
1
|
+
workers:
|
|
2
|
+
- name: iii-http
|
|
11
3
|
config:
|
|
12
4
|
port: 3111
|
|
13
5
|
host: 127.0.0.1
|
|
@@ -15,35 +7,44 @@ modules:
|
|
|
15
7
|
cors:
|
|
16
8
|
allowed_origins: ["http://localhost:3111", "http://localhost:3113", "http://127.0.0.1:3111", "http://127.0.0.1:3113"]
|
|
17
9
|
allowed_methods: [GET, POST, PUT, DELETE, OPTIONS]
|
|
18
|
-
|
|
19
|
-
- class: modules::queue::QueueModule
|
|
10
|
+
- name: iii-state
|
|
20
11
|
config:
|
|
21
12
|
adapter:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
name: kv
|
|
14
|
+
config:
|
|
15
|
+
store_method: file_based
|
|
16
|
+
file_path: ./data/state_store.db
|
|
17
|
+
- name: iii-queue
|
|
18
|
+
config:
|
|
19
|
+
adapter:
|
|
20
|
+
name: builtin
|
|
21
|
+
- name: iii-pubsub
|
|
25
22
|
config:
|
|
26
23
|
adapter:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- class: modules::cron::CronModule
|
|
24
|
+
name: local
|
|
25
|
+
- name: iii-cron
|
|
30
26
|
config:
|
|
31
27
|
adapter:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- class: modules::stream::StreamModule
|
|
28
|
+
name: kv
|
|
29
|
+
- name: iii-stream
|
|
35
30
|
config:
|
|
36
31
|
port: 3112
|
|
37
32
|
host: 127.0.0.1
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
adapter:
|
|
34
|
+
name: kv
|
|
35
|
+
config:
|
|
36
|
+
store_method: file_based
|
|
37
|
+
file_path: ./data/stream_store
|
|
38
|
+
- name: iii-observability
|
|
40
39
|
config:
|
|
41
40
|
enabled: true
|
|
42
41
|
service_name: agentmemory
|
|
43
42
|
exporter: memory
|
|
43
|
+
sampling_ratio: 1.0
|
|
44
|
+
metrics_enabled: true
|
|
44
45
|
logs_enabled: true
|
|
45
|
-
|
|
46
|
-
-
|
|
46
|
+
logs_console_output: true
|
|
47
|
+
- name: iii-exec
|
|
47
48
|
config:
|
|
48
49
|
watch:
|
|
49
50
|
- src/**/*.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentmemory/agentmemory",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.12",
|
|
4
4
|
"description": "Persistent memory for AI coding agents, powered by iii-engine's three primitives",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@anthropic-ai/sdk": "^0.39.0",
|
|
59
59
|
"@clack/prompts": "^1.2.0",
|
|
60
60
|
"dotenv": "^16.4.7",
|
|
61
|
-
"iii-sdk": "^0.
|
|
61
|
+
"iii-sdk": "^0.11.0",
|
|
62
62
|
"zod": "^4.0.0"
|
|
63
63
|
},
|
|
64
64
|
"optionalDependencies": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentmemory",
|
|
3
|
-
"version": "0.8.
|
|
4
|
-
"description": "Persistent memory for AI coding agents -- captures tool usage, compresses via LLM, injects context into future sessions. 12 hooks,
|
|
3
|
+
"version": "0.8.12",
|
|
4
|
+
"description": "Persistent memory for AI coding agents -- captures tool usage, compresses via LLM, injects context into future sessions. 12 hooks, 44 MCP tools, 4 skills, real-time viewer.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Rohit Ghumare",
|
|
7
7
|
"url": "https://github.com/rohitg00"
|
|
@@ -62,7 +62,7 @@ const ALL_CATEGORIES = [
|
|
|
62
62
|
const TWENTY_FOUR_HOURS_MS = 1440 * 60 * 1e3;
|
|
63
63
|
const ONE_HOUR_MS = 3600 * 1e3;
|
|
64
64
|
function registerDiagnosticsFunction(sdk, kv) {
|
|
65
|
-
sdk.registerFunction(
|
|
65
|
+
sdk.registerFunction("mem::diagnose", async (data) => {
|
|
66
66
|
const categories = data.categories && data.categories.length > 0 ? data.categories.filter((c) => ALL_CATEGORIES.includes(c)) : ALL_CATEGORIES;
|
|
67
67
|
const checks = [];
|
|
68
68
|
const now = Date.now();
|
|
@@ -333,7 +333,7 @@ function registerDiagnosticsFunction(sdk, kv) {
|
|
|
333
333
|
}
|
|
334
334
|
};
|
|
335
335
|
});
|
|
336
|
-
sdk.registerFunction(
|
|
336
|
+
sdk.registerFunction("mem::heal", async (data) => {
|
|
337
337
|
const dryRun = data.dryRun ?? false;
|
|
338
338
|
const categories = data.categories && data.categories.length > 0 ? data.categories.filter((c) => ALL_CATEGORIES.includes(c)) : ALL_CATEGORIES;
|
|
339
339
|
let fixed = 0;
|