@c4t4/heyamigo 0.1.4 → 0.1.5
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/config/config.example.json +0 -1
- package/dist/ai/claude.js +0 -18
- package/dist/cli/setup.js +13 -7
- package/dist/config.js +0 -1
- package/dist/memory/digest.js +0 -11
- package/dist/memory/preamble.js +12 -0
- package/package.json +1 -1
package/dist/ai/claude.js
CHANGED
|
@@ -65,11 +65,6 @@ export async function askClaude(params) {
|
|
|
65
65
|
});
|
|
66
66
|
let stdout = '';
|
|
67
67
|
let stderr = '';
|
|
68
|
-
let timedOut = false;
|
|
69
|
-
const timer = setTimeout(() => {
|
|
70
|
-
timedOut = true;
|
|
71
|
-
child.kill('SIGTERM');
|
|
72
|
-
}, config.claude.timeoutMs);
|
|
73
68
|
child.stdout.on('data', (chunk) => {
|
|
74
69
|
stdout += chunk.toString('utf-8');
|
|
75
70
|
});
|
|
@@ -77,7 +72,6 @@ export async function askClaude(params) {
|
|
|
77
72
|
stderr += chunk.toString('utf-8');
|
|
78
73
|
});
|
|
79
74
|
child.on('error', (err) => {
|
|
80
|
-
clearTimeout(timer);
|
|
81
75
|
void logPrompt({
|
|
82
76
|
ts: Math.floor(startedAt / 1000),
|
|
83
77
|
caller: 'worker',
|
|
@@ -89,18 +83,6 @@ export async function askClaude(params) {
|
|
|
89
83
|
rejectPromise(new Error(`claude spawn failed: ${err.message}`));
|
|
90
84
|
});
|
|
91
85
|
child.on('close', (code) => {
|
|
92
|
-
clearTimeout(timer);
|
|
93
|
-
if (timedOut) {
|
|
94
|
-
void logPrompt({
|
|
95
|
-
ts: Math.floor(startedAt / 1000),
|
|
96
|
-
caller: 'worker',
|
|
97
|
-
args,
|
|
98
|
-
input: params.input,
|
|
99
|
-
error: 'timed out',
|
|
100
|
-
durationMs: Date.now() - startedAt,
|
|
101
|
-
});
|
|
102
|
-
return rejectPromise(new Error(`claude timed out after ${config.claude.timeoutMs}ms`));
|
|
103
|
-
}
|
|
104
86
|
if (code !== 0) {
|
|
105
87
|
void logPrompt({
|
|
106
88
|
ts: Math.floor(startedAt / 1000),
|
package/dist/cli/setup.js
CHANGED
|
@@ -679,12 +679,18 @@ export async function runSetup() {
|
|
|
679
679
|
' config/access.json — groups, DMs, roles',
|
|
680
680
|
].join('\n'), 'Setup complete!');
|
|
681
681
|
p.log.warning('IMPORTANT: The bot won\'t respond until you activate a group!\n\n' +
|
|
682
|
-
' 1
|
|
683
|
-
'
|
|
684
|
-
' 2
|
|
685
|
-
'
|
|
686
|
-
'
|
|
687
|
-
'
|
|
688
|
-
'
|
|
682
|
+
' Step 1 — Start the bot:\n' +
|
|
683
|
+
' npx @c4t4/heyamigo start\n\n' +
|
|
684
|
+
' Step 2 — Send a message in any WhatsApp group.\n' +
|
|
685
|
+
' The bot discovers the group and adds it to config/access.json.\n\n' +
|
|
686
|
+
' Step 3 — Open config/access.json and edit:\n' +
|
|
687
|
+
' nano config/access.json\n' +
|
|
688
|
+
' - Find the group, change mode from "off" to "active"\n' +
|
|
689
|
+
' - Set allowedSenders to "*" for everyone\n\n' +
|
|
690
|
+
' Step 4 — Restart the bot:\n' +
|
|
691
|
+
' npx @c4t4/heyamigo restart\n\n' +
|
|
692
|
+
' Step 5 — Mention the bot\'s name in the group to get a reply.\n\n' +
|
|
693
|
+
' Debugging:\n' +
|
|
694
|
+
' npx @c4t4/heyamigo logs');
|
|
689
695
|
p.outro('Happy chatting!');
|
|
690
696
|
}
|
package/dist/config.js
CHANGED
package/dist/memory/digest.js
CHANGED
|
@@ -24,11 +24,6 @@ async function spawnDigester(prompt) {
|
|
|
24
24
|
});
|
|
25
25
|
let stdout = '';
|
|
26
26
|
let stderr = '';
|
|
27
|
-
let timedOut = false;
|
|
28
|
-
const timer = setTimeout(() => {
|
|
29
|
-
timedOut = true;
|
|
30
|
-
child.kill('SIGTERM');
|
|
31
|
-
}, config.claude.timeoutMs);
|
|
32
27
|
child.stdout.on('data', (chunk) => {
|
|
33
28
|
stdout += chunk.toString('utf-8');
|
|
34
29
|
});
|
|
@@ -44,16 +39,10 @@ async function spawnDigester(prompt) {
|
|
|
44
39
|
durationMs: Date.now() - startedAt,
|
|
45
40
|
});
|
|
46
41
|
child.on('error', (err) => {
|
|
47
|
-
clearTimeout(timer);
|
|
48
42
|
logFail(`spawn failed: ${err.message}`);
|
|
49
43
|
rejectPromise(new Error(`digester spawn failed: ${err.message}`));
|
|
50
44
|
});
|
|
51
45
|
child.on('close', (code) => {
|
|
52
|
-
clearTimeout(timer);
|
|
53
|
-
if (timedOut) {
|
|
54
|
-
logFail('timed out');
|
|
55
|
-
return rejectPromise(new Error('digester timed out'));
|
|
56
|
-
}
|
|
57
46
|
if (code !== 0) {
|
|
58
47
|
logFail(`exit ${code}: ${stderr.slice(0, 300)}`);
|
|
59
48
|
return rejectPromise(new Error(`digester exit ${code}: ${stderr.slice(0, 300)}`));
|
package/dist/memory/preamble.js
CHANGED
|
@@ -38,6 +38,18 @@ export function buildMemoryPreamble(params) {
|
|
|
38
38
|
// Identity — tell Claude its name
|
|
39
39
|
const botName = config.triggers.aliases[0] ?? 'amigo';
|
|
40
40
|
sections.push(`[Identity]\nYour name is ${botName}. People call you ${botName} to get your attention.`);
|
|
41
|
+
// Capabilities
|
|
42
|
+
sections.push('[Capabilities]\n' +
|
|
43
|
+
'Sending files: include a tag in your reply to send files through WhatsApp:\n' +
|
|
44
|
+
' [IMAGE: /absolute/path/to/file.png]\n' +
|
|
45
|
+
' [VIDEO: /absolute/path/to/file.mp4]\n' +
|
|
46
|
+
' [AUDIO: /absolute/path/to/file.mp3]\n' +
|
|
47
|
+
' [DOCUMENT: /absolute/path/to/file.pdf]\n' +
|
|
48
|
+
'The tag will be stripped from the message. Use absolute paths only.\n\n' +
|
|
49
|
+
'Browser: you have a real Chrome browser available via Playwright.\n' +
|
|
50
|
+
'You can navigate to URLs, click, fill forms, take screenshots, and read page content.\n' +
|
|
51
|
+
'Use the browser tools (mcp__playwright__*) when asked to visit websites, look something up, or take a screenshot.\n' +
|
|
52
|
+
'To send a screenshot back, take one with the browser tool, then include [IMAGE: /path/to/screenshot.png] in your reply.');
|
|
41
53
|
// Critical section
|
|
42
54
|
sections.push(buildCriticalSection({
|
|
43
55
|
senderNumber: params.senderNumber,
|