clementine-agent 1.0.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 +44 -0
- package/LICENSE +21 -0
- package/README.md +795 -0
- package/dist/agent/agent-manager.d.ts +69 -0
- package/dist/agent/agent-manager.js +441 -0
- package/dist/agent/assistant.d.ts +225 -0
- package/dist/agent/assistant.js +3888 -0
- package/dist/agent/auto-update.d.ts +32 -0
- package/dist/agent/auto-update.js +186 -0
- package/dist/agent/daily-planner.d.ts +24 -0
- package/dist/agent/daily-planner.js +379 -0
- package/dist/agent/execution-advisor.d.ts +10 -0
- package/dist/agent/execution-advisor.js +272 -0
- package/dist/agent/hooks.d.ts +45 -0
- package/dist/agent/hooks.js +564 -0
- package/dist/agent/insight-engine.d.ts +66 -0
- package/dist/agent/insight-engine.js +225 -0
- package/dist/agent/intent-classifier.d.ts +48 -0
- package/dist/agent/intent-classifier.js +214 -0
- package/dist/agent/link-extractor.d.ts +19 -0
- package/dist/agent/link-extractor.js +90 -0
- package/dist/agent/mcp-bridge.d.ts +62 -0
- package/dist/agent/mcp-bridge.js +435 -0
- package/dist/agent/metacognition.d.ts +66 -0
- package/dist/agent/metacognition.js +221 -0
- package/dist/agent/orchestrator.d.ts +81 -0
- package/dist/agent/orchestrator.js +790 -0
- package/dist/agent/profiles.d.ts +22 -0
- package/dist/agent/profiles.js +91 -0
- package/dist/agent/prompt-cache.d.ts +24 -0
- package/dist/agent/prompt-cache.js +68 -0
- package/dist/agent/prompt-evolver.d.ts +28 -0
- package/dist/agent/prompt-evolver.js +279 -0
- package/dist/agent/role-scaffolds.d.ts +28 -0
- package/dist/agent/role-scaffolds.js +433 -0
- package/dist/agent/safe-restart.d.ts +41 -0
- package/dist/agent/safe-restart.js +150 -0
- package/dist/agent/self-improve.d.ts +66 -0
- package/dist/agent/self-improve.js +1706 -0
- package/dist/agent/session-event-log.d.ts +114 -0
- package/dist/agent/session-event-log.js +233 -0
- package/dist/agent/skill-extractor.d.ts +72 -0
- package/dist/agent/skill-extractor.js +435 -0
- package/dist/agent/source-mods.d.ts +61 -0
- package/dist/agent/source-mods.js +230 -0
- package/dist/agent/source-preflight.d.ts +25 -0
- package/dist/agent/source-preflight.js +100 -0
- package/dist/agent/stall-guard.d.ts +62 -0
- package/dist/agent/stall-guard.js +109 -0
- package/dist/agent/strategic-planner.d.ts +60 -0
- package/dist/agent/strategic-planner.js +352 -0
- package/dist/agent/team-bus.d.ts +89 -0
- package/dist/agent/team-bus.js +556 -0
- package/dist/agent/team-router.d.ts +26 -0
- package/dist/agent/team-router.js +37 -0
- package/dist/agent/tool-loop-detector.d.ts +59 -0
- package/dist/agent/tool-loop-detector.js +242 -0
- package/dist/agent/workflow-runner.d.ts +36 -0
- package/dist/agent/workflow-runner.js +317 -0
- package/dist/agent/workflow-variables.d.ts +16 -0
- package/dist/agent/workflow-variables.js +62 -0
- package/dist/channels/discord-agent-bot.d.ts +101 -0
- package/dist/channels/discord-agent-bot.js +881 -0
- package/dist/channels/discord-bot-manager.d.ts +80 -0
- package/dist/channels/discord-bot-manager.js +262 -0
- package/dist/channels/discord-utils.d.ts +51 -0
- package/dist/channels/discord-utils.js +293 -0
- package/dist/channels/discord.d.ts +12 -0
- package/dist/channels/discord.js +1832 -0
- package/dist/channels/slack-agent-bot.d.ts +73 -0
- package/dist/channels/slack-agent-bot.js +320 -0
- package/dist/channels/slack-bot-manager.d.ts +66 -0
- package/dist/channels/slack-bot-manager.js +236 -0
- package/dist/channels/slack-utils.d.ts +39 -0
- package/dist/channels/slack-utils.js +189 -0
- package/dist/channels/slack.d.ts +11 -0
- package/dist/channels/slack.js +196 -0
- package/dist/channels/telegram.d.ts +10 -0
- package/dist/channels/telegram.js +235 -0
- package/dist/channels/webhook.d.ts +9 -0
- package/dist/channels/webhook.js +78 -0
- package/dist/channels/whatsapp.d.ts +11 -0
- package/dist/channels/whatsapp.js +181 -0
- package/dist/cli/chat.d.ts +14 -0
- package/dist/cli/chat.js +220 -0
- package/dist/cli/cron.d.ts +17 -0
- package/dist/cli/cron.js +552 -0
- package/dist/cli/dashboard.d.ts +15 -0
- package/dist/cli/dashboard.js +17677 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +2474 -0
- package/dist/cli/routes/delegations.d.ts +19 -0
- package/dist/cli/routes/delegations.js +154 -0
- package/dist/cli/routes/digest.d.ts +17 -0
- package/dist/cli/routes/digest.js +375 -0
- package/dist/cli/routes/goals.d.ts +14 -0
- package/dist/cli/routes/goals.js +258 -0
- package/dist/cli/routes/workflows.d.ts +18 -0
- package/dist/cli/routes/workflows.js +97 -0
- package/dist/cli/setup.d.ts +8 -0
- package/dist/cli/setup.js +619 -0
- package/dist/cli/tunnel.d.ts +35 -0
- package/dist/cli/tunnel.js +141 -0
- package/dist/config.d.ts +145 -0
- package/dist/config.js +278 -0
- package/dist/events/bus.d.ts +43 -0
- package/dist/events/bus.js +136 -0
- package/dist/gateway/cron-scheduler.d.ts +166 -0
- package/dist/gateway/cron-scheduler.js +1767 -0
- package/dist/gateway/delivery-queue.d.ts +30 -0
- package/dist/gateway/delivery-queue.js +110 -0
- package/dist/gateway/heartbeat-scheduler.d.ts +99 -0
- package/dist/gateway/heartbeat-scheduler.js +1298 -0
- package/dist/gateway/heartbeat.d.ts +3 -0
- package/dist/gateway/heartbeat.js +3 -0
- package/dist/gateway/lanes.d.ts +24 -0
- package/dist/gateway/lanes.js +76 -0
- package/dist/gateway/notifications.d.ts +29 -0
- package/dist/gateway/notifications.js +75 -0
- package/dist/gateway/router.d.ts +210 -0
- package/dist/gateway/router.js +1330 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1015 -0
- package/dist/memory/chunker.d.ts +28 -0
- package/dist/memory/chunker.js +226 -0
- package/dist/memory/consolidation.d.ts +44 -0
- package/dist/memory/consolidation.js +171 -0
- package/dist/memory/context-assembler.d.ts +50 -0
- package/dist/memory/context-assembler.js +149 -0
- package/dist/memory/embeddings.d.ts +38 -0
- package/dist/memory/embeddings.js +180 -0
- package/dist/memory/graph-store.d.ts +66 -0
- package/dist/memory/graph-store.js +613 -0
- package/dist/memory/mmr.d.ts +21 -0
- package/dist/memory/mmr.js +75 -0
- package/dist/memory/search.d.ts +26 -0
- package/dist/memory/search.js +67 -0
- package/dist/memory/store.d.ts +530 -0
- package/dist/memory/store.js +2022 -0
- package/dist/security/integrity.d.ts +24 -0
- package/dist/security/integrity.js +58 -0
- package/dist/security/patterns.d.ts +34 -0
- package/dist/security/patterns.js +110 -0
- package/dist/security/scanner.d.ts +32 -0
- package/dist/security/scanner.js +263 -0
- package/dist/tools/admin-tools.d.ts +12 -0
- package/dist/tools/admin-tools.js +1278 -0
- package/dist/tools/external-tools.d.ts +11 -0
- package/dist/tools/external-tools.js +1327 -0
- package/dist/tools/goal-tools.d.ts +9 -0
- package/dist/tools/goal-tools.js +159 -0
- package/dist/tools/mcp-server.d.ts +13 -0
- package/dist/tools/mcp-server.js +141 -0
- package/dist/tools/memory-tools.d.ts +10 -0
- package/dist/tools/memory-tools.js +568 -0
- package/dist/tools/session-tools.d.ts +6 -0
- package/dist/tools/session-tools.js +146 -0
- package/dist/tools/shared.d.ts +216 -0
- package/dist/tools/shared.js +340 -0
- package/dist/tools/team-tools.d.ts +6 -0
- package/dist/tools/team-tools.js +447 -0
- package/dist/tools/tool-meta.d.ts +34 -0
- package/dist/tools/tool-meta.js +133 -0
- package/dist/tools/vault-tools.d.ts +8 -0
- package/dist/tools/vault-tools.js +457 -0
- package/dist/types.d.ts +716 -0
- package/dist/types.js +16 -0
- package/dist/vault-migrations/0001-add-execution-framework.d.ts +10 -0
- package/dist/vault-migrations/0001-add-execution-framework.js +47 -0
- package/dist/vault-migrations/0002-add-agentic-communication.d.ts +12 -0
- package/dist/vault-migrations/0002-add-agentic-communication.js +79 -0
- package/dist/vault-migrations/0003-update-execution-pipeline-narration.d.ts +11 -0
- package/dist/vault-migrations/0003-update-execution-pipeline-narration.js +73 -0
- package/dist/vault-migrations/helpers.d.ts +14 -0
- package/dist/vault-migrations/helpers.js +44 -0
- package/dist/vault-migrations/runner.d.ts +14 -0
- package/dist/vault-migrations/runner.js +139 -0
- package/dist/vault-migrations/types.d.ts +42 -0
- package/dist/vault-migrations/types.js +9 -0
- package/install.sh +320 -0
- package/package.json +84 -0
- package/scripts/postinstall.js +125 -0
- package/vault/00-System/AGENTS.md +66 -0
- package/vault/00-System/CRON.md +71 -0
- package/vault/00-System/HEARTBEAT.md +58 -0
- package/vault/00-System/MEMORY.md +16 -0
- package/vault/00-System/SOUL.md +96 -0
- package/vault/05-Tasks/TASKS.md +19 -0
- package/vault/06-Templates/_Daily-Template.md +28 -0
- package/vault/06-Templates/_People-Template.md +22 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clementine TypeScript — Session & Work Discovery MCP tools.
|
|
3
|
+
*/
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { BASE_DIR, HANDOFFS_DIR, INBOX_DIR, TASKS_FILE, logger, textResult, todayStr, } from './shared.js';
|
|
8
|
+
function ensureHandoffsDir() {
|
|
9
|
+
if (!existsSync(HANDOFFS_DIR))
|
|
10
|
+
mkdirSync(HANDOFFS_DIR, { recursive: true });
|
|
11
|
+
}
|
|
12
|
+
function safeSessionName(key) {
|
|
13
|
+
return key.replace(/[^a-zA-Z0-9_-]/g, '_');
|
|
14
|
+
}
|
|
15
|
+
export function registerSessionTools(server) {
|
|
16
|
+
server.tool('session_pause', 'Save a structured handoff file for the current session so work can be resumed later — even after context reset.', {
|
|
17
|
+
session_key: z.string().describe('Session key (e.g., "discord:user:123")'),
|
|
18
|
+
completed: z.array(z.string()).describe('What was accomplished in this session'),
|
|
19
|
+
remaining: z.array(z.string()).describe('What still needs to be done'),
|
|
20
|
+
decisions: z.array(z.string()).optional().describe('Key decisions made during this session'),
|
|
21
|
+
blockers: z.array(z.string()).optional().describe('Current blockers or open questions'),
|
|
22
|
+
context: z.string().optional().describe('Mental context — anything the resuming agent needs to know'),
|
|
23
|
+
}, async ({ session_key, completed, remaining, decisions, blockers, context }) => {
|
|
24
|
+
ensureHandoffsDir();
|
|
25
|
+
const handoff = {
|
|
26
|
+
sessionKey: session_key,
|
|
27
|
+
pausedAt: new Date().toISOString(),
|
|
28
|
+
completed, remaining,
|
|
29
|
+
decisions: decisions || [], blockers: blockers || [],
|
|
30
|
+
context: context || '',
|
|
31
|
+
};
|
|
32
|
+
const fileName = `${safeSessionName(session_key)}.json`;
|
|
33
|
+
writeFileSync(path.join(HANDOFFS_DIR, fileName), JSON.stringify(handoff, null, 2));
|
|
34
|
+
logger.info({ sessionKey: session_key, completed: completed.length, remaining: remaining.length }, 'Session handoff saved');
|
|
35
|
+
return textResult(`Handoff saved. ${completed.length} items completed, ${remaining.length} remaining.\n` +
|
|
36
|
+
`Resume with session_resume when you're ready to continue.`);
|
|
37
|
+
});
|
|
38
|
+
server.tool('session_resume', 'Load a previously saved session handoff to restore context from a paused conversation.', { session_key: z.string().describe('Session key to resume') }, async ({ session_key }) => {
|
|
39
|
+
ensureHandoffsDir();
|
|
40
|
+
const fileName = `${safeSessionName(session_key)}.json`;
|
|
41
|
+
const filePath = path.join(HANDOFFS_DIR, fileName);
|
|
42
|
+
if (!existsSync(filePath))
|
|
43
|
+
return textResult(`No handoff found for session "${session_key}". Starting fresh.`);
|
|
44
|
+
try {
|
|
45
|
+
const handoff = JSON.parse(readFileSync(filePath, 'utf-8'));
|
|
46
|
+
const sections = [`## Session Handoff (paused at ${handoff.pausedAt})`];
|
|
47
|
+
if (handoff.completed?.length > 0)
|
|
48
|
+
sections.push(`### Completed\n${handoff.completed.map((c) => `- ✓ ${c}`).join('\n')}`);
|
|
49
|
+
if (handoff.remaining?.length > 0)
|
|
50
|
+
sections.push(`### Remaining\n${handoff.remaining.map((r) => `- [ ] ${r}`).join('\n')}`);
|
|
51
|
+
if (handoff.decisions?.length > 0)
|
|
52
|
+
sections.push(`### Decisions Made\n${handoff.decisions.map((d) => `- ${d}`).join('\n')}`);
|
|
53
|
+
if (handoff.blockers?.length > 0)
|
|
54
|
+
sections.push(`### Blockers\n${handoff.blockers.map((b) => `- ⚠ ${b}`).join('\n')}`);
|
|
55
|
+
if (handoff.context)
|
|
56
|
+
sections.push(`### Context\n${handoff.context}`);
|
|
57
|
+
return textResult(sections.join('\n\n'));
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return textResult(`Error reading handoff for "${session_key}".`);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
server.tool('discover_work', 'Scan goals, tasks, inbox, and recent failures to find prioritized work items.', {
|
|
64
|
+
agent_slug: z.string().optional().describe('Filter work items for a specific agent (omit for all)'),
|
|
65
|
+
limit: z.number().optional().describe('Max items to return (default: 10)'),
|
|
66
|
+
}, async ({ agent_slug, limit }) => {
|
|
67
|
+
const maxItems = Math.min(limit ?? 10, 30);
|
|
68
|
+
const items = [];
|
|
69
|
+
// 1. Stale goals
|
|
70
|
+
const goalsDir = path.join(BASE_DIR, 'goals');
|
|
71
|
+
if (existsSync(goalsDir)) {
|
|
72
|
+
for (const f of readdirSync(goalsDir).filter(f => f.endsWith('.json'))) {
|
|
73
|
+
try {
|
|
74
|
+
const goal = JSON.parse(readFileSync(path.join(goalsDir, f), 'utf-8'));
|
|
75
|
+
if (goal.status !== 'active')
|
|
76
|
+
continue;
|
|
77
|
+
if (agent_slug && goal.owner !== agent_slug)
|
|
78
|
+
continue;
|
|
79
|
+
const daysSinceUpdate = Math.floor((Date.now() - new Date(goal.updatedAt).getTime()) / 86400000);
|
|
80
|
+
const staleThreshold = goal.reviewFrequency === 'daily' ? 1 : goal.reviewFrequency === 'weekly' ? 7 : 30;
|
|
81
|
+
if (daysSinceUpdate > staleThreshold) {
|
|
82
|
+
const urgency = Math.min(5, Math.floor(daysSinceUpdate / staleThreshold) + (goal.priority === 'high' ? 2 : goal.priority === 'medium' ? 1 : 0));
|
|
83
|
+
items.push({ type: 'stale-goal', urgency, description: `Goal "${goal.title}" stale for ${daysSinceUpdate}d (${goal.priority} priority)` });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// 2. Failing cron jobs
|
|
92
|
+
const runDir = path.join(BASE_DIR, 'cron', 'runs');
|
|
93
|
+
if (existsSync(runDir)) {
|
|
94
|
+
for (const f of readdirSync(runDir).filter(f => f.endsWith('.jsonl'))) {
|
|
95
|
+
try {
|
|
96
|
+
const lines = readFileSync(path.join(runDir, f), 'utf-8').trim().split('\n').filter(Boolean);
|
|
97
|
+
const recent = lines.slice(-5).map(l => JSON.parse(l));
|
|
98
|
+
const consecutiveErrors = recent.reverse().findIndex(r => r.status === 'ok');
|
|
99
|
+
const errCount = consecutiveErrors === -1 ? recent.length : consecutiveErrors;
|
|
100
|
+
if (errCount >= 2) {
|
|
101
|
+
const jobName = recent[0]?.jobName ?? f.replace('.jsonl', '');
|
|
102
|
+
items.push({ type: 'cron-failure', urgency: Math.min(5, errCount), description: `Job "${jobName}" has ${errCount} consecutive failures` });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// 3. Pending tasks
|
|
111
|
+
if (existsSync(TASKS_FILE)) {
|
|
112
|
+
const content = readFileSync(TASKS_FILE, 'utf-8');
|
|
113
|
+
const today = todayStr();
|
|
114
|
+
const overdue = (content.match(/- \[ \].*?📅\s*(\d{4}-\d{2}-\d{2})/g) ?? [])
|
|
115
|
+
.filter(line => { const m = line.match(/📅\s*(\d{4}-\d{2}-\d{2})/); return m && m[1] < today; });
|
|
116
|
+
if (overdue.length > 0)
|
|
117
|
+
items.push({ type: 'overdue-tasks', urgency: 4, description: `${overdue.length} overdue task(s) in TASKS.md` });
|
|
118
|
+
}
|
|
119
|
+
// 4. Inbox items
|
|
120
|
+
if (existsSync(INBOX_DIR)) {
|
|
121
|
+
const inboxFiles = readdirSync(INBOX_DIR).filter(f => f.endsWith('.md') && !f.startsWith('_'));
|
|
122
|
+
if (inboxFiles.length > 0)
|
|
123
|
+
items.push({ type: 'inbox', urgency: 2, description: `${inboxFiles.length} unprocessed inbox item(s)` });
|
|
124
|
+
}
|
|
125
|
+
// 5. Daily plan priorities
|
|
126
|
+
const planFile = path.join(BASE_DIR, 'plans', 'daily', `${todayStr()}.json`);
|
|
127
|
+
if (existsSync(planFile)) {
|
|
128
|
+
try {
|
|
129
|
+
const plan = JSON.parse(readFileSync(planFile, 'utf-8'));
|
|
130
|
+
for (const p of (plan.priorities ?? []).slice(0, 5)) {
|
|
131
|
+
const alreadyListed = items.some(i => i.description.includes(p.id) || i.description.includes(p.action?.slice(0, 20)));
|
|
132
|
+
if (!alreadyListed)
|
|
133
|
+
items.push({ type: `plan-${p.type}`, urgency: p.urgency ?? 3, description: `[From daily plan] ${p.action}` });
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch { /* non-fatal */ }
|
|
137
|
+
}
|
|
138
|
+
items.sort((a, b) => b.urgency - a.urgency);
|
|
139
|
+
const topItems = items.slice(0, maxItems);
|
|
140
|
+
if (topItems.length === 0)
|
|
141
|
+
return textResult('No work items discovered. All goals on track, no failures, inbox clear.');
|
|
142
|
+
const lines = topItems.map(i => `- [${i.type}] Urgency ${i.urgency}/5: ${i.description}`);
|
|
143
|
+
return textResult(`## Discovered Work Items (${topItems.length})\n${lines.join('\n')}`);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=session-tools.js.map
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clementine TypeScript — Shared MCP tool utilities.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from mcp-server.ts so tool modules can import what they need.
|
|
5
|
+
* All constants, helpers, types, and lazy singletons live here.
|
|
6
|
+
*/
|
|
7
|
+
import pino from 'pino';
|
|
8
|
+
export declare const BASE_DIR: string;
|
|
9
|
+
export declare const env: Record<string, string>;
|
|
10
|
+
export declare const VAULT_DIR: string;
|
|
11
|
+
export declare const SYSTEM_DIR: string;
|
|
12
|
+
export declare const DAILY_NOTES_DIR: string;
|
|
13
|
+
export declare const PEOPLE_DIR: string;
|
|
14
|
+
export declare const PROJECTS_DIR: string;
|
|
15
|
+
export declare const TOPICS_DIR: string;
|
|
16
|
+
export declare const TASKS_DIR: string;
|
|
17
|
+
export declare const TEMPLATES_DIR: string;
|
|
18
|
+
export declare const INBOX_DIR: string;
|
|
19
|
+
export declare const MEMORY_FILE: string;
|
|
20
|
+
export declare const WORKING_MEMORY_FILE: string;
|
|
21
|
+
export declare const WORKING_MEMORY_MAX_LINES = 75;
|
|
22
|
+
export declare const TASKS_FILE: string;
|
|
23
|
+
export declare const SOUL_FILE: string;
|
|
24
|
+
export declare const IDENTITY_FILE: string;
|
|
25
|
+
export declare const HEARTBEAT_FILE: string;
|
|
26
|
+
export declare const CRON_FILE: string;
|
|
27
|
+
export declare const PROFILES_DIR: string;
|
|
28
|
+
export declare const AGENTS_DIR: string;
|
|
29
|
+
export declare const TEAM_COMMS_LOG: string;
|
|
30
|
+
export declare const HANDOFFS_DIR: string;
|
|
31
|
+
export declare const DELEGATIONS_BASE: string;
|
|
32
|
+
export declare const logger: pino.Logger<never, boolean>;
|
|
33
|
+
export type MemoryStoreType = {
|
|
34
|
+
searchFts(query: string, limit: number, filters?: {
|
|
35
|
+
category?: string;
|
|
36
|
+
topic?: string;
|
|
37
|
+
}): Array<{
|
|
38
|
+
sourceFile: string;
|
|
39
|
+
section: string;
|
|
40
|
+
content: string;
|
|
41
|
+
score: number;
|
|
42
|
+
chunkType: string;
|
|
43
|
+
matchType: string;
|
|
44
|
+
lastUpdated: string;
|
|
45
|
+
chunkId: number;
|
|
46
|
+
salience: number;
|
|
47
|
+
agentSlug?: string | null;
|
|
48
|
+
category?: string | null;
|
|
49
|
+
topic?: string | null;
|
|
50
|
+
}>;
|
|
51
|
+
getRecentChunks(limit: number, agentSlug?: string, filters?: {
|
|
52
|
+
category?: string;
|
|
53
|
+
topic?: string;
|
|
54
|
+
}): unknown[];
|
|
55
|
+
searchContext(query: string, limitOrOpts?: number | {
|
|
56
|
+
limit?: number;
|
|
57
|
+
recencyLimit?: number;
|
|
58
|
+
agentSlug?: string;
|
|
59
|
+
category?: string;
|
|
60
|
+
topic?: string;
|
|
61
|
+
}, recencyLimit?: number): unknown[];
|
|
62
|
+
getConnections(noteName: string): Array<{
|
|
63
|
+
direction: string;
|
|
64
|
+
file: string;
|
|
65
|
+
context: string;
|
|
66
|
+
}>;
|
|
67
|
+
getTimeline(startDate: string, endDate: string, limit?: number): unknown[];
|
|
68
|
+
searchTranscripts(query: string, limit?: number, sessionKey?: string): Array<{
|
|
69
|
+
sessionKey: string;
|
|
70
|
+
role: string;
|
|
71
|
+
content: string;
|
|
72
|
+
model: string;
|
|
73
|
+
createdAt: string;
|
|
74
|
+
}>;
|
|
75
|
+
fullSync(): {
|
|
76
|
+
filesScanned: number;
|
|
77
|
+
filesUpdated: number;
|
|
78
|
+
filesDeleted: number;
|
|
79
|
+
chunksTotal: number;
|
|
80
|
+
};
|
|
81
|
+
updateFile(relPath: string, agentSlug?: string): void;
|
|
82
|
+
recordAccess(chunkIds: number[]): void;
|
|
83
|
+
decaySalience(halfLifeDays?: number): number;
|
|
84
|
+
pruneStaleData(opts?: {
|
|
85
|
+
maxAgeDays?: number;
|
|
86
|
+
salienceThreshold?: number;
|
|
87
|
+
accessLogRetentionDays?: number;
|
|
88
|
+
transcriptRetentionDays?: number;
|
|
89
|
+
}): {
|
|
90
|
+
episodicPruned: number;
|
|
91
|
+
accessLogPruned: number;
|
|
92
|
+
transcriptsPruned: number;
|
|
93
|
+
};
|
|
94
|
+
checkDuplicate(content: string, sourceFile?: string): {
|
|
95
|
+
isDuplicate: boolean;
|
|
96
|
+
matchType: 'exact' | 'near' | null;
|
|
97
|
+
matchId?: number;
|
|
98
|
+
};
|
|
99
|
+
logExtraction(extraction: {
|
|
100
|
+
sessionKey: string;
|
|
101
|
+
userMessage: string;
|
|
102
|
+
toolName: string;
|
|
103
|
+
toolInput: string;
|
|
104
|
+
extractedAt: string;
|
|
105
|
+
status: string;
|
|
106
|
+
agentSlug?: string;
|
|
107
|
+
}): void;
|
|
108
|
+
getRecentExtractions(limit?: number, status?: string): Array<{
|
|
109
|
+
id: number;
|
|
110
|
+
sessionKey: string;
|
|
111
|
+
userMessage: string;
|
|
112
|
+
toolName: string;
|
|
113
|
+
toolInput: string;
|
|
114
|
+
extractedAt: string;
|
|
115
|
+
status: string;
|
|
116
|
+
correction?: string;
|
|
117
|
+
}>;
|
|
118
|
+
correctExtraction(id: number, correction: string): void;
|
|
119
|
+
dismissExtraction(id: number): void;
|
|
120
|
+
bumpChunkSalience(chunkId: number, boost?: number): void;
|
|
121
|
+
getRecentCorrections(limit?: number): Array<{
|
|
122
|
+
toolInput: string;
|
|
123
|
+
correction: string;
|
|
124
|
+
}>;
|
|
125
|
+
getConsolidationCandidates(minAgeDays?: number): Array<{
|
|
126
|
+
topic: string;
|
|
127
|
+
chunkIds: number[];
|
|
128
|
+
contents: string[];
|
|
129
|
+
totalChars: number;
|
|
130
|
+
}>;
|
|
131
|
+
markConsolidated(chunkIds: number[]): void;
|
|
132
|
+
getConsolidationStats(): {
|
|
133
|
+
totalChunks: number;
|
|
134
|
+
consolidated: number;
|
|
135
|
+
unconsolidated: number;
|
|
136
|
+
};
|
|
137
|
+
logFeedback(feedback: {
|
|
138
|
+
sessionKey?: string;
|
|
139
|
+
channel: string;
|
|
140
|
+
messageSnippet?: string;
|
|
141
|
+
responseSnippet?: string;
|
|
142
|
+
rating: string;
|
|
143
|
+
comment?: string;
|
|
144
|
+
}): void;
|
|
145
|
+
getRecentFeedback(limit?: number): Array<{
|
|
146
|
+
id: number;
|
|
147
|
+
sessionKey?: string;
|
|
148
|
+
channel: string;
|
|
149
|
+
messageSnippet?: string;
|
|
150
|
+
responseSnippet?: string;
|
|
151
|
+
rating: string;
|
|
152
|
+
comment?: string;
|
|
153
|
+
createdAt: string;
|
|
154
|
+
}>;
|
|
155
|
+
getFeedbackStats(): {
|
|
156
|
+
positive: number;
|
|
157
|
+
negative: number;
|
|
158
|
+
mixed: number;
|
|
159
|
+
total: number;
|
|
160
|
+
};
|
|
161
|
+
promoteToGlobal(chunkId: number, promotedBy?: string): string;
|
|
162
|
+
db: unknown;
|
|
163
|
+
};
|
|
164
|
+
export declare function getStore(): Promise<MemoryStoreType>;
|
|
165
|
+
export declare function getStoreSync(): MemoryStoreType | null;
|
|
166
|
+
export declare const ACTIVE_AGENT_SLUG: string | null;
|
|
167
|
+
export declare const GOALS_DIR: string;
|
|
168
|
+
export declare function agentTasksFile(slug: string | null): string;
|
|
169
|
+
export declare function agentWorkingMemoryFile(slug: string | null): string;
|
|
170
|
+
export declare function agentGoalsDir(slug: string | null): string;
|
|
171
|
+
export declare function agentDailyNotesDir(slug: string | null): string;
|
|
172
|
+
export declare function todayStr(): string;
|
|
173
|
+
export declare function yesterdayStr(): string;
|
|
174
|
+
export declare function nowTime(): string;
|
|
175
|
+
export declare function timeOfDaySection(): string;
|
|
176
|
+
export declare function resolvePath(name: string): string;
|
|
177
|
+
export declare function validateVaultPath(relPath: string): string;
|
|
178
|
+
export declare function ensureDailyNote(dateStr?: string): string;
|
|
179
|
+
export declare function folderForType(noteType: string): string;
|
|
180
|
+
export declare function incrementalSync(relPath: string, agentSlug?: string): Promise<void>;
|
|
181
|
+
export declare function textResult(text: string): {
|
|
182
|
+
content: {
|
|
183
|
+
type: "text";
|
|
184
|
+
text: string;
|
|
185
|
+
}[];
|
|
186
|
+
};
|
|
187
|
+
export declare const EXTERNAL_CONTENT_TAG: string;
|
|
188
|
+
export declare function externalResult(text: string): {
|
|
189
|
+
content: {
|
|
190
|
+
type: "text";
|
|
191
|
+
text: string;
|
|
192
|
+
}[];
|
|
193
|
+
};
|
|
194
|
+
export declare const TASK_ID_RE: RegExp;
|
|
195
|
+
export declare const TASK_ID_RE_G: RegExp;
|
|
196
|
+
export declare const TASK_LINE_RE: RegExp;
|
|
197
|
+
export interface ParsedTask {
|
|
198
|
+
id: string;
|
|
199
|
+
text: string;
|
|
200
|
+
status: string;
|
|
201
|
+
priority: string;
|
|
202
|
+
due: string;
|
|
203
|
+
project: string;
|
|
204
|
+
assignee: string;
|
|
205
|
+
recurrence: string;
|
|
206
|
+
tags: string[];
|
|
207
|
+
checked: boolean;
|
|
208
|
+
indent: string;
|
|
209
|
+
rawLine: string;
|
|
210
|
+
isSubtask: boolean;
|
|
211
|
+
}
|
|
212
|
+
export declare function parseTasks(body: string): ParsedTask[];
|
|
213
|
+
export declare function nextTaskId(body: string): string;
|
|
214
|
+
export declare function nextDueDate(currentDue: string, recurrence: string): string;
|
|
215
|
+
export declare function globMd(dir: string): string[];
|
|
216
|
+
//# sourceMappingURL=shared.d.ts.map
|