@c4t4/heyamigo 0.7.1 → 0.7.2

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.
@@ -10,6 +10,7 @@ import { ensureScaffold } from './store.js';
10
10
  import { getRoleForContext } from '../wa/whitelist.js';
11
11
  const DIGEST_REMINDER = `When something worth remembering happens (new preference, key fact, life event, changed plan), append [DIGEST: <one-line reason>] to the END of your reply. It will be stripped before sending. Flag sparingly.`;
12
12
  const JOURNAL_REMINDER = `When a message contains info for one of the journals above, append [JOURNAL:<slug> — <one-line note>] to the END of your reply. Multiple tags OK. Only use slugs listed; never invent. Full rules are in your memory instructions.`;
13
+ const ASYNC_REMINDER = `BROWSER / SCRAPE / MULTI-STEP RESEARCH = always async. Never call browser tools (browser_navigate, browser_click, browser_take_screenshot, browser_evaluate, any mcp__*playwright*) inline — they block this chat for minutes when pages hang. Instead: send a short ack ("On it, will report back.") AND append [ASYNC: <self-sufficient task description>] at the END of your reply. The async worker has full browser access and will report back here. Even for "just one URL" — always async.`;
13
14
  function buildCriticalSection(params) {
14
15
  const { senderNumber, roleName, role, userName } = params;
15
16
  const who = userName
@@ -58,10 +59,9 @@ export function buildMemoryPreamble(params) {
58
59
  ' [AUDIO: /absolute/path/to/file.mp3]\n' +
59
60
  ' [DOCUMENT: /absolute/path/to/file.pdf]\n' +
60
61
  'The tag will be stripped from the message. Use absolute paths only.\n\n' +
61
- 'Browser: you have a real Chrome browser available via Playwright.\n' +
62
- 'You can navigate to URLs, click, fill forms, take screenshots, and read page content.\n' +
63
- 'Use the browser tools (mcp__playwright__*) when asked to visit websites, look something up, or take a screenshot.\n' +
64
- 'To send a screenshot back, take one with the browser tool, then include [IMAGE: /path/to/screenshot.png] in your reply.\n\n' +
62
+ 'Browser (Playwright MCP): a real Chrome browser is available for navigation, clicks, forms, screenshots, page content. ' +
63
+ 'DO NOT call browser tools inline from this main chat lane — they block the chat queue for minutes when pages stall (login walls, anti-bot, rate limits). ' +
64
+ 'ALL browser work goes through the async lane. When a request needs browser: send a short ack AND append [ASYNC: <self-sufficient task description>] at the END of your reply. The async worker has full browser access; it will send the result back to this chat as a new message. Even a single URL check goes async. No exceptions.\n\n' +
65
65
  'File storage: if you need to save any files (screenshots, research, notes), always save them to storage/temp/. Never save files to the project root.');
66
66
  // Critical section
67
67
  sections.push(buildCriticalSection({
@@ -124,7 +124,10 @@ export function buildMemoryPreamble(params) {
124
124
  // Journals — owner-scoped, shown globally across all chats.
125
125
  const isOwner = !!config.owner.number && params.senderNumber === config.owner.number;
126
126
  const journalsBlock = isOwner ? buildJournalsPreambleBlock() : null;
127
- const instructions = [DIGEST_REMINDER];
127
+ // ASYNC reminder goes first so it's the most prominent rule — it's the
128
+ // one that prevents the main chat queue from jamming on browser work.
129
+ // The preamble's Capabilities section also reinforces it.
130
+ const instructions = [ASYNC_REMINDER, DIGEST_REMINDER];
128
131
  if (journalsBlock) {
129
132
  sections.push(`[Journals: active]\n${journalsBlock}`);
130
133
  instructions.push(JOURNAL_REMINDER);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4t4/heyamigo",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "WhatsApp AI bot powered by Claude with long-term memory, browser control, and role-based access",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",