@teamvibe/poller 0.1.49 → 0.1.52
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/claude-spawner.js +19 -4
- package/dist/types.d.ts +9 -1
- package/package.json +1 -1
package/dist/claude-spawner.js
CHANGED
|
@@ -104,13 +104,19 @@ function buildPrompt(msg, resumeHint) {
|
|
|
104
104
|
if (msg.source === 'heartbeat') {
|
|
105
105
|
return 'heartbeat';
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
const isEmail = msg.source === 'email';
|
|
108
|
+
let prompt = isEmail ? '## Incoming Email\n\n' : '## Incoming Slack Message\n\n';
|
|
108
109
|
prompt += `**From:** ${msg.sender.name}`;
|
|
109
110
|
if (msg.sender.id && msg.sender.id !== msg.sender.name) {
|
|
110
111
|
prompt += ` (${msg.sender.id})`;
|
|
111
112
|
}
|
|
112
113
|
prompt += '\n';
|
|
113
|
-
if (msg.response_context.
|
|
114
|
+
if (msg.response_context.email) {
|
|
115
|
+
const email = msg.response_context.email;
|
|
116
|
+
prompt += `**Subject:** ${email.subject}\n`;
|
|
117
|
+
prompt += `**To:** ${email.to}\n`;
|
|
118
|
+
}
|
|
119
|
+
else if (msg.response_context.slack) {
|
|
114
120
|
const slack = msg.response_context.slack;
|
|
115
121
|
const channelType = slack.channel.startsWith('D')
|
|
116
122
|
? 'Direct Message'
|
|
@@ -130,10 +136,18 @@ function buildPrompt(msg, resumeHint) {
|
|
|
130
136
|
if (msg.type === 'button_click' && msg.button) {
|
|
131
137
|
prompt += `\n\n**Button Click:** User clicked button \`${msg.button.action_id}\` with value \`${msg.button.value}\``;
|
|
132
138
|
}
|
|
139
|
+
if (msg.teamvibe.emailChannelPrompt) {
|
|
140
|
+
prompt += '\n\n**Channel Instructions:**\n' + msg.teamvibe.emailChannelPrompt + '\n';
|
|
141
|
+
}
|
|
133
142
|
if (resumeHint) {
|
|
134
143
|
prompt += `\n\n${resumeHint}`;
|
|
135
144
|
}
|
|
136
|
-
|
|
145
|
+
if (isEmail) {
|
|
146
|
+
prompt += `\n\n---\n\nProcess this email and respond appropriately using available tools.`;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
prompt += `\n\n---\n\nRespond to this user NOW using the send_message tool.`;
|
|
150
|
+
}
|
|
137
151
|
return prompt;
|
|
138
152
|
}
|
|
139
153
|
function truncateOutput(output, maxLen = 200) {
|
|
@@ -196,7 +210,8 @@ async function runClaudeCode(msg, sessionLog, cwd, sessionId, isFirstMessage = t
|
|
|
196
210
|
const slackContext = msg.response_context.slack;
|
|
197
211
|
const isCronMessage = msg.source === 'cron';
|
|
198
212
|
const isHeartbeat = msg.source === 'heartbeat';
|
|
199
|
-
|
|
213
|
+
const isEmailMessage = msg.source === 'email';
|
|
214
|
+
if (!slackContext && !isCronMessage && !isHeartbeat && !isEmailMessage) {
|
|
200
215
|
throw new Error('No Slack context in message');
|
|
201
216
|
}
|
|
202
217
|
// Build resume hint
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface TeamVibeQueueMessage {
|
|
2
2
|
id: string;
|
|
3
|
-
source: 'slack' | 'cron' | 'heartbeat';
|
|
3
|
+
source: 'slack' | 'email' | 'cron' | 'heartbeat';
|
|
4
4
|
thread_id: string;
|
|
5
5
|
sender: {
|
|
6
6
|
id: string;
|
|
@@ -18,6 +18,13 @@ export interface TeamVibeQueueMessage {
|
|
|
18
18
|
thread_ts: string;
|
|
19
19
|
message_ts: string;
|
|
20
20
|
};
|
|
21
|
+
email?: {
|
|
22
|
+
from: string;
|
|
23
|
+
to: string;
|
|
24
|
+
subject: string;
|
|
25
|
+
messageId: string;
|
|
26
|
+
inReplyTo?: string;
|
|
27
|
+
};
|
|
21
28
|
};
|
|
22
29
|
type: 'message' | 'approval_response' | 'button_click';
|
|
23
30
|
approval?: {
|
|
@@ -38,6 +45,7 @@ export interface TeamVibeQueueMessage {
|
|
|
38
45
|
gitRepoUrl: string;
|
|
39
46
|
branch: string;
|
|
40
47
|
};
|
|
48
|
+
emailChannelPrompt?: string;
|
|
41
49
|
};
|
|
42
50
|
}
|
|
43
51
|
export interface SessionRecord {
|