@bubblelab/bubble-core 0.1.163 → 0.1.165
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/dist/bubble-bundle.d.ts +142 -142
- package/dist/bubbles/service-bubble/agent-memory.d.ts +104 -0
- package/dist/bubbles/service-bubble/agent-memory.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/agent-memory.js +626 -0
- package/dist/bubbles/service-bubble/agent-memory.js.map +1 -0
- package/dist/bubbles/service-bubble/agi-inc.d.ts +60 -60
- package/dist/bubbles/service-bubble/ai-agent.d.ts +20 -8
- package/dist/bubbles/service-bubble/ai-agent.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/ai-agent.js +129 -5
- package/dist/bubbles/service-bubble/ai-agent.js.map +1 -1
- package/dist/bubbles/service-bubble/airtable.d.ts +50 -50
- package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.d.ts +2 -2
- package/dist/bubbles/service-bubble/apify/actors/instagram-hashtag-scraper.d.ts +4 -4
- package/dist/bubbles/service-bubble/apify/actors/instagram-scraper.d.ts +12 -12
- package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.d.ts +2 -2
- package/dist/bubbles/service-bubble/apify/actors/linkedin-posts-search.d.ts +10 -10
- package/dist/bubbles/service-bubble/apify/actors/linkedin-profile-detail.d.ts +54 -54
- package/dist/bubbles/service-bubble/apify/actors/linkedin-profile-posts.d.ts +22 -22
- package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.d.ts +12 -12
- package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.d.ts +28 -28
- package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.d.ts +12 -12
- package/dist/bubbles/service-bubble/apify/apify-scraper.schema.d.ts +144 -144
- package/dist/bubbles/service-bubble/apify/apify.d.ts +12 -12
- package/dist/bubbles/service-bubble/ashby/ashby.d.ts +62 -62
- package/dist/bubbles/service-bubble/ashby/ashby.schema.d.ts +84 -84
- package/dist/bubbles/service-bubble/browserbase/browserbase.d.ts +28 -28
- package/dist/bubbles/service-bubble/browserbase/browserbase.schema.d.ts +30 -30
- package/dist/bubbles/service-bubble/capability-pipeline.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/capability-pipeline.js +2 -0
- package/dist/bubbles/service-bubble/capability-pipeline.js.map +1 -1
- package/dist/bubbles/service-bubble/confluence/confluence.d.ts +24 -24
- package/dist/bubbles/service-bubble/confluence/confluence.schema.d.ts +24 -24
- package/dist/bubbles/service-bubble/crustdata/crustdata.d.ts +126 -126
- package/dist/bubbles/service-bubble/crustdata/crustdata.schema.d.ts +158 -158
- package/dist/bubbles/service-bubble/eleven-labs.d.ts +28 -28
- package/dist/bubbles/service-bubble/firecrawl.d.ts +628 -628
- package/dist/bubbles/service-bubble/followupboss.d.ts +140 -140
- package/dist/bubbles/service-bubble/fullenrich/fullenrich.d.ts +68 -68
- package/dist/bubbles/service-bubble/fullenrich/fullenrich.schema.d.ts +108 -108
- package/dist/bubbles/service-bubble/github.d.ts +104 -104
- package/dist/bubbles/service-bubble/gmail.d.ts +92 -92
- package/dist/bubbles/service-bubble/google-calendar.d.ts +138 -138
- package/dist/bubbles/service-bubble/google-drive.d.ts +60 -60
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.d.ts +44 -44
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.d.ts +48 -48
- package/dist/bubbles/service-bubble/hello-world.d.ts +8 -8
- package/dist/bubbles/service-bubble/http.d.ts +16 -16
- package/dist/bubbles/service-bubble/insforge-db.d.ts +8 -8
- package/dist/bubbles/service-bubble/jira/jira.d.ts +86 -86
- package/dist/bubbles/service-bubble/jira/jira.schema.d.ts +94 -94
- package/dist/bubbles/service-bubble/notion/notion.d.ts +534 -534
- package/dist/bubbles/service-bubble/notion/property-schemas.d.ts +8 -8
- package/dist/bubbles/service-bubble/postgresql.d.ts +10 -10
- package/dist/bubbles/service-bubble/posthog/posthog.d.ts +22 -22
- package/dist/bubbles/service-bubble/posthog/posthog.schema.d.ts +26 -26
- package/dist/bubbles/service-bubble/resend.d.ts +32 -32
- package/dist/bubbles/service-bubble/sendsafely/sendsafely.d.ts +10 -10
- package/dist/bubbles/service-bubble/sendsafely/sendsafely.schema.d.ts +12 -12
- package/dist/bubbles/service-bubble/slack/slack.d.ts +316 -316
- package/dist/bubbles/service-bubble/storage.d.ts +20 -20
- package/dist/bubbles/service-bubble/stripe/stripe.d.ts +125 -125
- package/dist/bubbles/service-bubble/stripe/stripe.schema.d.ts +143 -143
- package/dist/bubbles/service-bubble/telegram.d.ts +1537 -1537
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.d.ts +13 -13
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.schema.d.ts +13 -13
- package/dist/bubbles/tool-bubble/browser-tools/_shared/schema.d.ts +2 -2
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-accept-invitations/schema.d.ts +2 -2
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-accept-invitations/tool.d.ts +2 -2
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-connection/schema.d.ts +2 -2
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-connection/tool.d.ts +2 -2
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-received-invitations/schema.d.ts +2 -2
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-received-invitations/tool.d.ts +2 -2
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-sent-invitations/schema.d.ts +2 -2
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-sent-invitations/tool.d.ts +2 -2
- package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +16 -16
- package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +26 -26
- package/dist/bubbles/tool-bubble/code-edit-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/company-enrichment-tool.d.ts +22 -22
- package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/get-trigger-detail-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/google-maps-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/instagram-tool.d.ts +14 -14
- package/dist/bubbles/tool-bubble/linkedin-tool.d.ts +212 -212
- package/dist/bubbles/tool-bubble/list-airtable-bases-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/list-airtable-tables-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/list-capabilities-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/people-search-tool.d.ts +14 -14
- package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +28 -28
- package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/sql-query-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/tiktok-tool.d.ts +36 -36
- package/dist/bubbles/tool-bubble/tool-template.d.ts +4 -4
- package/dist/bubbles/tool-bubble/twitter-tool.d.ts +64 -64
- package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +22 -22
- package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/web-search-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/yc-scraper-tool.d.ts +22 -22
- package/dist/bubbles/tool-bubble/youtube-tool.d.ts +28 -28
- package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts +4 -4
- package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +28 -28
- package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +8 -8
- package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +72 -72
- package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +32 -32
- package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +30 -30
- package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +90 -90
- package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +8 -8
- package/dist/bubbles.json +7 -2
- package/package.json +2 -2
|
@@ -0,0 +1,626 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// Constants
|
|
4
|
+
// ============================================================================
|
|
5
|
+
const CORE_FILES = ['soul.md', 'identity.md', 'agents.md'];
|
|
6
|
+
const TOPIC_INDEX = 'topics/_index.json';
|
|
7
|
+
const EVENT_INDEX = 'events/_index.json';
|
|
8
|
+
/** Maximum number of recent events to show in the auto-injected index */
|
|
9
|
+
const MAX_RECENT_EVENTS = 20;
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// System Prompt Formatting
|
|
12
|
+
// ============================================================================
|
|
13
|
+
/**
|
|
14
|
+
* Format the core memory files + indexes for injection into the system prompt.
|
|
15
|
+
* This is always injected — it's the agent's identity and awareness of what it knows.
|
|
16
|
+
*/
|
|
17
|
+
export function formatCoreMemoryForPrompt(memory) {
|
|
18
|
+
const sections = [];
|
|
19
|
+
// --- Topics and events FIRST — the agent needs awareness before anything else ---
|
|
20
|
+
// Topic index — what topics the bot knows about
|
|
21
|
+
const topicIndex = parseJsonSafe(memory[TOPIC_INDEX], []);
|
|
22
|
+
const topicHint = "_Call recall_memory with a name listed above to get full details. Use create_memory to save new people and topics. If someone isn't listed, create a topic for them now._";
|
|
23
|
+
if (topicIndex.length > 0) {
|
|
24
|
+
const topicList = topicIndex
|
|
25
|
+
.map((t) => {
|
|
26
|
+
const aliasStr = t.aliases.length > 0 ? ` (also: ${t.aliases.join(', ')})` : '';
|
|
27
|
+
return `- ${t.name}${aliasStr}`;
|
|
28
|
+
})
|
|
29
|
+
.join('\n');
|
|
30
|
+
sections.push(`## Known Topics\n\n${topicList}\n\n${topicHint}`);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
sections.push(`## Known Topics\n\n_(empty — you haven't met anyone yet.)_\n\n${topicHint}`);
|
|
34
|
+
}
|
|
35
|
+
// Event index — recent events (most recent first)
|
|
36
|
+
const eventIndex = parseJsonSafe(memory[EVENT_INDEX], []);
|
|
37
|
+
if (eventIndex.length > 0) {
|
|
38
|
+
const recentEvents = eventIndex.slice(-MAX_RECENT_EVENTS);
|
|
39
|
+
const eventList = recentEvents
|
|
40
|
+
.reverse()
|
|
41
|
+
.map((e) => `- ${e.date}: ${e.summary}`)
|
|
42
|
+
.join('\n');
|
|
43
|
+
sections.push(`## Recent Events\n\n${eventList}\n\n_Call recall_memory with a date listed above to get the full event log._`);
|
|
44
|
+
}
|
|
45
|
+
// --- Core identity files after indexes ---
|
|
46
|
+
for (const file of CORE_FILES) {
|
|
47
|
+
const content = memory[file];
|
|
48
|
+
if (content) {
|
|
49
|
+
sections.push(content);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return sections.join('\n\n---\n\n');
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Self-improvement prompt appended to the system prompt.
|
|
56
|
+
*/
|
|
57
|
+
export const MEMORY_SELF_IMPROVEMENT_PROMPT = `You have persistent memory across conversations. Your known topics, recent events, and core identity are above.
|
|
58
|
+
|
|
59
|
+
## Before You Respond
|
|
60
|
+
|
|
61
|
+
**Always recall first.** Before responding to the user or delegating to a capability, use recall_memory to retrieve full details about any people or topics mentioned in the conversation. The indexes above are summaries — the full context is in the topic files. Don't respond with partial knowledge when you could look it up.
|
|
62
|
+
|
|
63
|
+
## Remembering
|
|
64
|
+
|
|
65
|
+
You have two memory tools:
|
|
66
|
+
|
|
67
|
+
**create_memory** — Create a new memory file for someone or something you haven't seen before:
|
|
68
|
+
- People & topics: file="topics/{slug}.md", content="...", topicName="Sarah Chen", topicAliases=["Sarah"]
|
|
69
|
+
- Events: file="events/2025-02-15.md", content="...", eventSummary="Met Sarah, discussed Redis caching"
|
|
70
|
+
|
|
71
|
+
**update_memory** — Add new information to an existing memory file:
|
|
72
|
+
- file="topics/sarah-chen.md", content="Prefers bullet points over paragraphs"
|
|
73
|
+
|
|
74
|
+
When you meet someone new who isn't in your Known Topics, create a topic for them immediately with the specific date (e.g., "Met on 2025-02-15, PST timezone"). Always use the actual date, never say "today".
|
|
75
|
+
|
|
76
|
+
Your personality (soul.md) and identity (identity.md) evolve automatically after each conversation — you don't need to update those yourself.
|
|
77
|
+
|
|
78
|
+
## Delegating
|
|
79
|
+
|
|
80
|
+
When delegating to a capability, include relevant context from memory (timezone, preferences, prior decisions) in your task description. The capability agent doesn't have access to your memory.`;
|
|
81
|
+
// ============================================================================
|
|
82
|
+
// Auto-Recall Person Topics
|
|
83
|
+
// ============================================================================
|
|
84
|
+
/**
|
|
85
|
+
* Extracts person names from conversation history and returns matching topic content.
|
|
86
|
+
* Conversation history messages have the format: "[Name (timezone)]: message" or "[Name]: message"
|
|
87
|
+
*/
|
|
88
|
+
export function autoRecallPersonTopics(memory, conversationHistory) {
|
|
89
|
+
if (!conversationHistory.length)
|
|
90
|
+
return '';
|
|
91
|
+
const topicIndex = parseJsonSafe(memory[TOPIC_INDEX], []);
|
|
92
|
+
if (topicIndex.length === 0)
|
|
93
|
+
return '';
|
|
94
|
+
// Extract unique person names from conversation history
|
|
95
|
+
const namePattern = /^\[([^\]]+?)(?:\s*\([^)]*\))?\]:/;
|
|
96
|
+
const personNames = new Set();
|
|
97
|
+
for (const msg of conversationHistory) {
|
|
98
|
+
if (msg.role === 'user') {
|
|
99
|
+
const match = msg.content.match(namePattern);
|
|
100
|
+
if (match?.[1]) {
|
|
101
|
+
personNames.add(match[1].trim());
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (personNames.size === 0)
|
|
106
|
+
return '';
|
|
107
|
+
// Match names against topic index (name + aliases)
|
|
108
|
+
const matchedTopics = [];
|
|
109
|
+
const matchedSlugs = new Set();
|
|
110
|
+
for (const name of personNames) {
|
|
111
|
+
const nameLower = name.toLowerCase();
|
|
112
|
+
for (const topic of topicIndex) {
|
|
113
|
+
if (matchedSlugs.has(topic.slug))
|
|
114
|
+
continue;
|
|
115
|
+
const matchesName = topic.name.toLowerCase() === nameLower;
|
|
116
|
+
const matchesAlias = topic.aliases.some((a) => a.toLowerCase() === nameLower);
|
|
117
|
+
if (matchesName || matchesAlias) {
|
|
118
|
+
const filePath = `topics/${topic.slug}.md`;
|
|
119
|
+
const content = memory[filePath];
|
|
120
|
+
if (content) {
|
|
121
|
+
matchedTopics.push(`### ${topic.name}\n\n${content}`);
|
|
122
|
+
matchedSlugs.add(topic.slug);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (matchedTopics.length === 0)
|
|
128
|
+
return '';
|
|
129
|
+
return `## People in This Conversation\n\n${matchedTopics.join('\n\n')}`;
|
|
130
|
+
}
|
|
131
|
+
// ============================================================================
|
|
132
|
+
// recall_memory Tool
|
|
133
|
+
// ============================================================================
|
|
134
|
+
/**
|
|
135
|
+
* Build the recall_memory custom tool.
|
|
136
|
+
* Uses simple keyword/alias matching to find relevant files,
|
|
137
|
+
* then returns their combined content.
|
|
138
|
+
*/
|
|
139
|
+
export function buildMemoryRecallTool(memory) {
|
|
140
|
+
return {
|
|
141
|
+
name: 'recall_memory',
|
|
142
|
+
description: 'Look up details from your persistent memory — a person, topic, project, date, or concept. Returns the full content of matching memory files.',
|
|
143
|
+
schema: z.object({
|
|
144
|
+
query: z
|
|
145
|
+
.string()
|
|
146
|
+
.describe('What you want to remember — a person, topic, date, or concept'),
|
|
147
|
+
}),
|
|
148
|
+
func: async (input) => {
|
|
149
|
+
const query = input.query;
|
|
150
|
+
const results = [];
|
|
151
|
+
const queryLower = query.toLowerCase();
|
|
152
|
+
// 1. Check topic index for matching topics
|
|
153
|
+
const topicIndex = parseJsonSafe(memory[TOPIC_INDEX], []);
|
|
154
|
+
for (const topic of topicIndex) {
|
|
155
|
+
const matchesName = topic.name.toLowerCase().includes(queryLower);
|
|
156
|
+
const matchesSlug = topic.slug.includes(queryLower);
|
|
157
|
+
const matchesAlias = topic.aliases.some((a) => a.toLowerCase().includes(queryLower));
|
|
158
|
+
if (matchesName || matchesSlug || matchesAlias) {
|
|
159
|
+
const filePath = `topics/${topic.slug}.md`;
|
|
160
|
+
const content = memory[filePath];
|
|
161
|
+
if (content) {
|
|
162
|
+
results.push(`## ${topic.name}\n\n${content}`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// 2. Check event index for matching dates or summaries
|
|
167
|
+
const eventIndex = parseJsonSafe(memory[EVENT_INDEX], []);
|
|
168
|
+
// Try date-based matching (YYYY-MM-DD, "yesterday", "today", "last week", etc.)
|
|
169
|
+
const dateMatches = findMatchingDates(queryLower, eventIndex);
|
|
170
|
+
for (const date of dateMatches) {
|
|
171
|
+
const filePath = `events/${date}.md`;
|
|
172
|
+
const content = memory[filePath];
|
|
173
|
+
if (content) {
|
|
174
|
+
results.push(`## Events — ${date}\n\n${content}`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// Also check event summaries for keyword matches
|
|
178
|
+
for (const event of eventIndex) {
|
|
179
|
+
if (!dateMatches.includes(event.date) &&
|
|
180
|
+
event.summary.toLowerCase().includes(queryLower)) {
|
|
181
|
+
const filePath = `events/${event.date}.md`;
|
|
182
|
+
const content = memory[filePath];
|
|
183
|
+
if (content) {
|
|
184
|
+
results.push(`## Events — ${event.date}\n\n${content}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// 3. Search all topic files directly for keyword matches (fallback)
|
|
189
|
+
if (results.length === 0) {
|
|
190
|
+
for (const [path, content] of Object.entries(memory)) {
|
|
191
|
+
if (path.startsWith('topics/') &&
|
|
192
|
+
path !== TOPIC_INDEX &&
|
|
193
|
+
content.toLowerCase().includes(queryLower)) {
|
|
194
|
+
const slug = path.replace('topics/', '').replace('.md', '');
|
|
195
|
+
const topicEntry = topicIndex.find((t) => t.slug === slug);
|
|
196
|
+
const label = topicEntry?.name ?? slug;
|
|
197
|
+
results.push(`## ${label}\n\n${content}`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (results.length === 0) {
|
|
202
|
+
return `No memory found matching "${query}". You may not have saved anything about this yet.`;
|
|
203
|
+
}
|
|
204
|
+
return results.join('\n\n---\n\n');
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
// ============================================================================
|
|
209
|
+
// create_memory Tool
|
|
210
|
+
// ============================================================================
|
|
211
|
+
/**
|
|
212
|
+
* Build the create_memory custom tool.
|
|
213
|
+
* Creates new topic/event files and updates indexes.
|
|
214
|
+
* Zero LLM calls — direct file write + index update.
|
|
215
|
+
*/
|
|
216
|
+
export function buildMemoryCreateTool(memory, updateCallback) {
|
|
217
|
+
return {
|
|
218
|
+
name: 'create_memory',
|
|
219
|
+
description: "Create a new memory file for a person, topic, project, or event. Use this when someone or something isn't in your Known Topics or Recent Events yet.",
|
|
220
|
+
schema: z.object({
|
|
221
|
+
file: z
|
|
222
|
+
.string()
|
|
223
|
+
.describe('Path for the new file. ' +
|
|
224
|
+
'Topics: "topics/{slug}.md" (e.g., "topics/sarah-chen.md"). ' +
|
|
225
|
+
'Events: "events/{YYYY-MM-DD}.md" (e.g., "events/2025-02-15.md").'),
|
|
226
|
+
content: z.string().describe('Initial content for this memory file'),
|
|
227
|
+
topicName: z
|
|
228
|
+
.string()
|
|
229
|
+
.optional()
|
|
230
|
+
.describe('Required for new topics. Human-readable name (e.g., "Sarah Chen")'),
|
|
231
|
+
topicAliases: z
|
|
232
|
+
.array(z.string())
|
|
233
|
+
.optional()
|
|
234
|
+
.describe('Optional nicknames/short names for new topics (e.g., ["Sarah"])'),
|
|
235
|
+
eventSummary: z
|
|
236
|
+
.string()
|
|
237
|
+
.optional()
|
|
238
|
+
.describe('Required for new events. One-line summary for the event index (e.g., "Met Sarah, discussed Redis caching")'),
|
|
239
|
+
}),
|
|
240
|
+
func: async (input) => {
|
|
241
|
+
try {
|
|
242
|
+
const file = input.file;
|
|
243
|
+
const content = input.content;
|
|
244
|
+
const topicName = input.topicName;
|
|
245
|
+
const topicAliases = input.topicAliases ?? [];
|
|
246
|
+
const eventSummary = input.eventSummary;
|
|
247
|
+
// Reject core files
|
|
248
|
+
if (CORE_FILES.some((f) => file === f || file.endsWith(`/${f}`))) {
|
|
249
|
+
return 'Cannot create core files. soul.md, identity.md, and agents.md are updated automatically.';
|
|
250
|
+
}
|
|
251
|
+
// Validate path prefix
|
|
252
|
+
if (!file.startsWith('topics/') && !file.startsWith('events/')) {
|
|
253
|
+
return 'File path must start with "topics/" or "events/".';
|
|
254
|
+
}
|
|
255
|
+
// Check file doesn't already exist
|
|
256
|
+
if (file in memory) {
|
|
257
|
+
return 'File already exists. Use update_memory to add to it.';
|
|
258
|
+
}
|
|
259
|
+
if (file.startsWith('topics/')) {
|
|
260
|
+
// --- Create topic ---
|
|
261
|
+
if (!topicName) {
|
|
262
|
+
return 'topicName is required when creating a new topic.';
|
|
263
|
+
}
|
|
264
|
+
const slug = file.replace('topics/', '').replace('.md', '');
|
|
265
|
+
// Save content
|
|
266
|
+
memory[file] = content;
|
|
267
|
+
await updateCallback(file, content);
|
|
268
|
+
// Update topic index
|
|
269
|
+
const topicIndex = parseJsonSafe(memory[TOPIC_INDEX], []);
|
|
270
|
+
topicIndex.push({
|
|
271
|
+
name: topicName,
|
|
272
|
+
slug,
|
|
273
|
+
aliases: topicAliases,
|
|
274
|
+
});
|
|
275
|
+
const indexStr = JSON.stringify(topicIndex);
|
|
276
|
+
memory[TOPIC_INDEX] = indexStr;
|
|
277
|
+
await updateCallback(TOPIC_INDEX, indexStr);
|
|
278
|
+
console.log(`[agent-memory] Created topic: ${topicName} (${slug})`);
|
|
279
|
+
return `Created ${file}`;
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
// --- Create event ---
|
|
283
|
+
const date = file.replace('events/', '').replace('.md', '');
|
|
284
|
+
const summary = eventSummary ?? content.slice(0, 80);
|
|
285
|
+
// Save content
|
|
286
|
+
const formatted = `# ${date}\n\n- ${content}`;
|
|
287
|
+
memory[file] = formatted;
|
|
288
|
+
await updateCallback(file, formatted);
|
|
289
|
+
// Update event index
|
|
290
|
+
const eventIndex = parseJsonSafe(memory[EVENT_INDEX], []);
|
|
291
|
+
eventIndex.push({ date, summary });
|
|
292
|
+
const indexStr = JSON.stringify(eventIndex);
|
|
293
|
+
memory[EVENT_INDEX] = indexStr;
|
|
294
|
+
await updateCallback(EVENT_INDEX, indexStr);
|
|
295
|
+
console.log(`[agent-memory] Created event: ${date} — ${summary}`);
|
|
296
|
+
return `Created ${file}`;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
catch (err) {
|
|
300
|
+
console.error('[agent-memory] create_memory error:', err);
|
|
301
|
+
return `Failed to create memory: ${err instanceof Error ? err.message : 'Unknown error'}`;
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
// ============================================================================
|
|
307
|
+
// update_memory Tool
|
|
308
|
+
// ============================================================================
|
|
309
|
+
/**
|
|
310
|
+
* Build the update_memory custom tool.
|
|
311
|
+
* Updates existing topic/event files. Uses callLLM only for merging topic content.
|
|
312
|
+
* No routing LLM — the master agent decides which file to target.
|
|
313
|
+
*/
|
|
314
|
+
export function buildMemoryUpdateTool(memory, updateCallback, callLLM) {
|
|
315
|
+
return {
|
|
316
|
+
name: 'update_memory',
|
|
317
|
+
description: 'Update an existing memory file with new information. The new content will be intelligently merged with existing content. Also updates the index summary if the change is significant.',
|
|
318
|
+
schema: z.object({
|
|
319
|
+
file: z
|
|
320
|
+
.string()
|
|
321
|
+
.describe('Path to the existing file to update. ' +
|
|
322
|
+
'Topics: "topics/{slug}.md". Events: "events/{YYYY-MM-DD}.md".'),
|
|
323
|
+
content: z.string().describe('New information to merge into the file'),
|
|
324
|
+
}),
|
|
325
|
+
func: async (input) => {
|
|
326
|
+
try {
|
|
327
|
+
const file = input.file;
|
|
328
|
+
const content = input.content;
|
|
329
|
+
// Reject core files
|
|
330
|
+
if (CORE_FILES.some((f) => file === f || file.endsWith(`/${f}`))) {
|
|
331
|
+
return 'Core identity files (soul.md, identity.md, agents.md) are updated automatically after each conversation.';
|
|
332
|
+
}
|
|
333
|
+
// Check file exists
|
|
334
|
+
if (!(file in memory)) {
|
|
335
|
+
// Build helpful error with available files
|
|
336
|
+
const topicIndex = parseJsonSafe(memory[TOPIC_INDEX], []);
|
|
337
|
+
const eventIndex = parseJsonSafe(memory[EVENT_INDEX], []);
|
|
338
|
+
const topicSlugs = topicIndex.map((t) => t.slug).join(', ');
|
|
339
|
+
const eventDates = eventIndex.map((e) => e.date).join(', ');
|
|
340
|
+
return (`File "${file}" not found. Available memory files:\n` +
|
|
341
|
+
`Topics: ${topicSlugs || '(none)'}\n` +
|
|
342
|
+
`Events: ${eventDates || '(none)'}\n` +
|
|
343
|
+
'Use create_memory to create a new file, or check the slug.');
|
|
344
|
+
}
|
|
345
|
+
if (file.startsWith('topics/')) {
|
|
346
|
+
// --- Update topic: merge content via LLM ---
|
|
347
|
+
const existing = memory[file];
|
|
348
|
+
const updated = await mergeMemoryContent(existing, content, callLLM);
|
|
349
|
+
memory[file] = updated;
|
|
350
|
+
await updateCallback(file, updated);
|
|
351
|
+
console.log(`[agent-memory] Updated topic: ${file}`);
|
|
352
|
+
return `Updated ${file}`;
|
|
353
|
+
}
|
|
354
|
+
else if (file.startsWith('events/')) {
|
|
355
|
+
// --- Update event: append content ---
|
|
356
|
+
const existing = memory[file];
|
|
357
|
+
const updated = `${existing}\n\n- ${content}`;
|
|
358
|
+
memory[file] = updated;
|
|
359
|
+
await updateCallback(file, updated);
|
|
360
|
+
// Update event index summary
|
|
361
|
+
const date = file.replace('events/', '').replace('.md', '');
|
|
362
|
+
const eventIndex = parseJsonSafe(memory[EVENT_INDEX], []);
|
|
363
|
+
const existingIdx = eventIndex.findIndex((e) => e.date === date);
|
|
364
|
+
if (existingIdx >= 0) {
|
|
365
|
+
eventIndex[existingIdx].summary += `; ${content.slice(0, 60)}`;
|
|
366
|
+
const indexStr = JSON.stringify(eventIndex);
|
|
367
|
+
memory[EVENT_INDEX] = indexStr;
|
|
368
|
+
await updateCallback(EVENT_INDEX, indexStr);
|
|
369
|
+
}
|
|
370
|
+
console.log(`[agent-memory] Updated event: ${file}`);
|
|
371
|
+
return `Updated ${file}`;
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
return 'File path must start with "topics/" or "events/".';
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
catch (err) {
|
|
378
|
+
console.error('[agent-memory] update_memory error:', err);
|
|
379
|
+
return `Failed to update memory: ${err instanceof Error ? err.message : 'Unknown error'}`;
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Run a post-execution reflection over the conversation.
|
|
386
|
+
* Only updates soul.md and identity.md — implicit personality shaping.
|
|
387
|
+
* Topics and events are left for the agent to update explicitly via update_memory.
|
|
388
|
+
* Called after the agent finishes responding.
|
|
389
|
+
*/
|
|
390
|
+
export async function runMemoryReflection(conversationMessages, memory, updateCallback, callLLM) {
|
|
391
|
+
if (conversationMessages.length === 0)
|
|
392
|
+
return;
|
|
393
|
+
// Build conversation transcript
|
|
394
|
+
const transcript = conversationMessages
|
|
395
|
+
.map((m) => `[${m.role}]: ${m.content}`)
|
|
396
|
+
.join('\n');
|
|
397
|
+
const currentSoul = memory['soul.md'] ?? '';
|
|
398
|
+
const currentIdentity = memory['identity.md'] ?? '';
|
|
399
|
+
const reflectionPrompt = `You are a personality reflection system. Review this conversation and determine if anything should be added to the bot's core personality or identity files.
|
|
400
|
+
|
|
401
|
+
These files shape who the bot IS — not what it knows. They're updated implicitly based on how conversations go.
|
|
402
|
+
|
|
403
|
+
Current soul.md (personality, values, communication style):
|
|
404
|
+
---
|
|
405
|
+
${currentSoul || '(empty)'}
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
Current identity.md (name, role, workspace context):
|
|
409
|
+
---
|
|
410
|
+
${currentIdentity || '(empty)'}
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
Conversation:
|
|
414
|
+
${transcript}
|
|
415
|
+
|
|
416
|
+
What belongs in soul.md:
|
|
417
|
+
- Personality traits that develop from interactions — if users are playful, the bot can become more witty; if conversations are technical, the bot can lean into precision
|
|
418
|
+
- Communication style preferences revealed by user feedback ("be more concise", "use emoji", "be more casual")
|
|
419
|
+
- Corrections to the bot's tone or behavior ("don't be so formal", "stop apologizing")
|
|
420
|
+
- Values or principles that emerge from interactions
|
|
421
|
+
- The bot's evolving character — humor style, quirks, interests that make it feel like a real teammate
|
|
422
|
+
|
|
423
|
+
What belongs in identity.md:
|
|
424
|
+
- The bot's name if mentioned ("your name is X", "call yourself X")
|
|
425
|
+
- Its role in this workspace ("you help the engineering team", "you're our project manager")
|
|
426
|
+
- Workspace-specific context ("we're a startup", "we use Jira")
|
|
427
|
+
|
|
428
|
+
What does NOT belong here:
|
|
429
|
+
- Facts about people (those go in topics via create_memory / update_memory)
|
|
430
|
+
- Events or decisions (those go in events via create_memory / update_memory)
|
|
431
|
+
- Casual remarks, jokes, compliments, greetings
|
|
432
|
+
- Anything the bot already knows from current files
|
|
433
|
+
|
|
434
|
+
Respond in JSON:
|
|
435
|
+
{
|
|
436
|
+
"soul_update": "description of what to add/change in soul.md, or null if nothing",
|
|
437
|
+
"identity_update": "description of what to add/change in identity.md, or null if nothing"
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
Most conversations should return: { "soul_update": null, "identity_update": null }`;
|
|
441
|
+
try {
|
|
442
|
+
const result = await callLLM(reflectionPrompt);
|
|
443
|
+
const parsed = parseJsonFromLLM(result);
|
|
444
|
+
if (!parsed) {
|
|
445
|
+
console.log('[agent-memory] Reflection: could not parse result');
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
if (!parsed.soul_update && !parsed.identity_update) {
|
|
449
|
+
console.log('[agent-memory] Reflection: no personality updates needed');
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
// Apply soul.md update
|
|
453
|
+
if (parsed.soul_update) {
|
|
454
|
+
try {
|
|
455
|
+
const updated = await mergeMemoryContent(currentSoul, parsed.soul_update, callLLM);
|
|
456
|
+
memory['soul.md'] = updated;
|
|
457
|
+
await updateCallback('soul.md', updated);
|
|
458
|
+
console.log(`[agent-memory] Reflection updated soul.md: "${parsed.soul_update}"`);
|
|
459
|
+
}
|
|
460
|
+
catch (err) {
|
|
461
|
+
console.error('[agent-memory] Failed to update soul.md:', err);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
// Apply identity.md update
|
|
465
|
+
if (parsed.identity_update) {
|
|
466
|
+
try {
|
|
467
|
+
const updated = await mergeMemoryContent(currentIdentity, parsed.identity_update, callLLM);
|
|
468
|
+
memory['identity.md'] = updated;
|
|
469
|
+
await updateCallback('identity.md', updated);
|
|
470
|
+
console.log(`[agent-memory] Reflection updated identity.md: "${parsed.identity_update}"`);
|
|
471
|
+
}
|
|
472
|
+
catch (err) {
|
|
473
|
+
console.error('[agent-memory] Failed to update identity.md:', err);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
catch (err) {
|
|
478
|
+
console.error('[agent-memory] Reflection failed:', err);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
// ============================================================================
|
|
482
|
+
// LLM Content Merge
|
|
483
|
+
// ============================================================================
|
|
484
|
+
/**
|
|
485
|
+
* Merge a change into existing file content using an LLM call.
|
|
486
|
+
* If the existing content is empty, just returns the change formatted nicely.
|
|
487
|
+
*/
|
|
488
|
+
async function mergeMemoryContent(existing, change, callLLM) {
|
|
489
|
+
if (!existing.trim()) {
|
|
490
|
+
return change;
|
|
491
|
+
}
|
|
492
|
+
const mergePrompt = `You are a memory file editor. Merge the new information into the existing markdown content.
|
|
493
|
+
|
|
494
|
+
Existing content:
|
|
495
|
+
---
|
|
496
|
+
${existing}
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
New information to integrate: "${change}"
|
|
500
|
+
|
|
501
|
+
Rules:
|
|
502
|
+
- Preserve the existing markdown structure and formatting exactly
|
|
503
|
+
- Add new information in the appropriate place
|
|
504
|
+
- If the new info updates or contradicts existing content, replace the old info
|
|
505
|
+
- If the new info is already present, don't duplicate it
|
|
506
|
+
- Keep the content concise and well-organized
|
|
507
|
+
- Return ONLY the raw updated markdown content — no JSON, no wrapping, no explanations
|
|
508
|
+
- Do NOT wrap the output in a JSON object or any other structure
|
|
509
|
+
|
|
510
|
+
Updated markdown content:`;
|
|
511
|
+
const result = await callLLM(mergePrompt);
|
|
512
|
+
// Clean any code block wrappers
|
|
513
|
+
let cleaned = result
|
|
514
|
+
.replace(/^```(?:markdown|md)?\n?/gm, '')
|
|
515
|
+
.replace(/\n?```$/gm, '')
|
|
516
|
+
.trim();
|
|
517
|
+
// Safety: if the LLM returned JSON instead of markdown, try to extract the text content
|
|
518
|
+
if (cleaned.startsWith('{') && cleaned.endsWith('}')) {
|
|
519
|
+
try {
|
|
520
|
+
const parsed = JSON.parse(cleaned);
|
|
521
|
+
// Try common keys the LLM might use
|
|
522
|
+
const textValue = parsed.content ?? parsed.description ?? parsed.text ?? parsed.result;
|
|
523
|
+
if (typeof textValue === 'string') {
|
|
524
|
+
// Reconstruct: if there's a title field, prepend it
|
|
525
|
+
const title = parsed.title;
|
|
526
|
+
cleaned =
|
|
527
|
+
typeof title === 'string' ? `${title}\n\n${textValue}` : textValue;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
catch {
|
|
531
|
+
// Not valid JSON, keep as-is
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
return cleaned || existing;
|
|
535
|
+
}
|
|
536
|
+
// ============================================================================
|
|
537
|
+
// Utility Functions
|
|
538
|
+
// ============================================================================
|
|
539
|
+
function parseJsonSafe(raw, fallback) {
|
|
540
|
+
if (!raw)
|
|
541
|
+
return fallback;
|
|
542
|
+
try {
|
|
543
|
+
return JSON.parse(raw);
|
|
544
|
+
}
|
|
545
|
+
catch {
|
|
546
|
+
return fallback;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
function parseJsonFromLLM(raw) {
|
|
550
|
+
if (!raw)
|
|
551
|
+
return null;
|
|
552
|
+
// Try direct parse first
|
|
553
|
+
try {
|
|
554
|
+
return JSON.parse(raw);
|
|
555
|
+
}
|
|
556
|
+
catch {
|
|
557
|
+
// Try extracting JSON from markdown code blocks
|
|
558
|
+
const jsonMatch = raw.match(/```(?:json)?\s*\n?([\s\S]*?)\n?```/);
|
|
559
|
+
if (jsonMatch?.[1]) {
|
|
560
|
+
try {
|
|
561
|
+
return JSON.parse(jsonMatch[1]);
|
|
562
|
+
}
|
|
563
|
+
catch {
|
|
564
|
+
// fall through
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
// Try finding JSON object in the text
|
|
568
|
+
const objMatch = raw.match(/\{[\s\S]*\}/);
|
|
569
|
+
if (objMatch) {
|
|
570
|
+
try {
|
|
571
|
+
return JSON.parse(objMatch[0]);
|
|
572
|
+
}
|
|
573
|
+
catch {
|
|
574
|
+
// fall through
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
return null;
|
|
579
|
+
}
|
|
580
|
+
function getTodayDate() {
|
|
581
|
+
return new Date().toISOString().split('T')[0];
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Find matching dates from the event index based on a query.
|
|
585
|
+
* Handles YYYY-MM-DD format directly.
|
|
586
|
+
*/
|
|
587
|
+
function findMatchingDates(query, eventIndex) {
|
|
588
|
+
const matches = [];
|
|
589
|
+
// Direct date match (YYYY-MM-DD)
|
|
590
|
+
const datePattern = /\d{4}-\d{2}-\d{2}/;
|
|
591
|
+
const dateMatch = query.match(datePattern);
|
|
592
|
+
if (dateMatch) {
|
|
593
|
+
const date = dateMatch[0];
|
|
594
|
+
if (eventIndex.some((e) => e.date === date)) {
|
|
595
|
+
matches.push(date);
|
|
596
|
+
}
|
|
597
|
+
return matches;
|
|
598
|
+
}
|
|
599
|
+
// Relative date matching
|
|
600
|
+
const today = new Date();
|
|
601
|
+
const todayStr = getTodayDate();
|
|
602
|
+
if (query.includes('today')) {
|
|
603
|
+
if (eventIndex.some((e) => e.date === todayStr)) {
|
|
604
|
+
matches.push(todayStr);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
if (query.includes('yesterday')) {
|
|
608
|
+
const yesterday = new Date(today);
|
|
609
|
+
yesterday.setDate(yesterday.getDate() - 1);
|
|
610
|
+
const yesterdayStr = yesterday.toISOString().split('T')[0];
|
|
611
|
+
if (eventIndex.some((e) => e.date === yesterdayStr)) {
|
|
612
|
+
matches.push(yesterdayStr);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
if (query.includes('last week') || query.includes('this week')) {
|
|
616
|
+
const weekAgo = new Date(today);
|
|
617
|
+
weekAgo.setDate(weekAgo.getDate() - 7);
|
|
618
|
+
for (const event of eventIndex) {
|
|
619
|
+
if (event.date >= weekAgo.toISOString().split('T')[0]) {
|
|
620
|
+
matches.push(event.date);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
return [...new Set(matches)];
|
|
625
|
+
}
|
|
626
|
+
//# sourceMappingURL=agent-memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-memory.js","sourceRoot":"","sources":["../../../src/bubbles/service-bubble/agent-memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8BxB,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,aAAa,EAAE,WAAW,CAAU,CAAC;AACpE,MAAM,WAAW,GAAG,oBAAoB,CAAC;AACzC,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAEzC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