@lawrencehui/citio 0.2.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/.dockerignore +8 -0
- package/Dockerfile +47 -0
- package/LICENSE +21 -0
- package/README.md +305 -0
- package/citio.example.yaml +43 -0
- package/dist/adapters/slack.d.ts +22 -0
- package/dist/adapters/slack.d.ts.map +1 -0
- package/dist/adapters/slack.js +624 -0
- package/dist/adapters/slack.js.map +1 -0
- package/dist/cli/init.d.ts +3 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +1464 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/ops.d.ts +13 -0
- package/dist/cli/ops.d.ts.map +1 -0
- package/dist/cli/ops.js +167 -0
- package/dist/cli/ops.js.map +1 -0
- package/dist/config/schema.d.ts +81 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +65 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/core/agent-runner.d.ts +38 -0
- package/dist/core/agent-runner.d.ts.map +1 -0
- package/dist/core/agent-runner.js +531 -0
- package/dist/core/agent-runner.js.map +1 -0
- package/dist/core/mcp-entry.d.ts +7 -0
- package/dist/core/mcp-entry.d.ts.map +1 -0
- package/dist/core/mcp-entry.js +390 -0
- package/dist/core/mcp-entry.js.map +1 -0
- package/dist/core/provider-config.d.ts +2 -0
- package/dist/core/provider-config.d.ts.map +1 -0
- package/dist/core/provider-config.js +53 -0
- package/dist/core/provider-config.js.map +1 -0
- package/dist/core/session-manager.d.ts +15 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +78 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/skills.d.ts +24 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +111 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/workspace.d.ts +13 -0
- package/dist/core/workspace.d.ts.map +1 -0
- package/dist/core/workspace.js +238 -0
- package/dist/core/workspace.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +152 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/app-state.d.ts +5 -0
- package/dist/utils/app-state.d.ts.map +1 -0
- package/dist/utils/app-state.js +35 -0
- package/dist/utils/app-state.js.map +1 -0
- package/dist/utils/claude.d.ts +4 -0
- package/dist/utils/claude.d.ts.map +1 -0
- package/dist/utils/claude.js +65 -0
- package/dist/utils/claude.js.map +1 -0
- package/dist/utils/codex.d.ts +5 -0
- package/dist/utils/codex.d.ts.map +1 -0
- package/dist/utils/codex.js +17 -0
- package/dist/utils/codex.js.map +1 -0
- package/dist/utils/env.d.ts +2 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/env.js +16 -0
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/installer-state.d.ts +33 -0
- package/dist/utils/installer-state.d.ts.map +1 -0
- package/dist/utils/installer-state.js +152 -0
- package/dist/utils/installer-state.js.map +1 -0
- package/dist/utils/runtime-env.d.ts +3 -0
- package/dist/utils/runtime-env.d.ts.map +1 -0
- package/dist/utils/runtime-env.js +24 -0
- package/dist/utils/runtime-env.js.map +1 -0
- package/dist/utils/secret-store.d.ts +18 -0
- package/dist/utils/secret-store.d.ts.map +1 -0
- package/dist/utils/secret-store.js +78 -0
- package/dist/utils/secret-store.js.map +1 -0
- package/dist/utils/slack-onboarding.d.ts +22 -0
- package/dist/utils/slack-onboarding.d.ts.map +1 -0
- package/dist/utils/slack-onboarding.js +205 -0
- package/dist/utils/slack-onboarding.js.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,624 @@
|
|
|
1
|
+
import { App, Assistant } from "@slack/bolt";
|
|
2
|
+
import { existsSync, readFileSync } from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
const CREDENTIAL_PATTERNS = [
|
|
5
|
+
/sk-ant-[a-zA-Z0-9-_]{20,}/g,
|
|
6
|
+
/sk-[a-zA-Z0-9]{20,}/g,
|
|
7
|
+
/xoxb-[0-9]+-[a-zA-Z0-9]+/g,
|
|
8
|
+
/xapp-[0-9]+-[a-zA-Z0-9]+/g,
|
|
9
|
+
/ghp_[a-zA-Z0-9]{36}/g,
|
|
10
|
+
/github_pat_[a-zA-Z0-9_]{82}/g,
|
|
11
|
+
/AKIA[A-Z0-9]{16}/g,
|
|
12
|
+
];
|
|
13
|
+
function redactCredentials(text) {
|
|
14
|
+
let redacted = text;
|
|
15
|
+
for (const pattern of CREDENTIAL_PATTERNS) {
|
|
16
|
+
redacted = redacted.replace(pattern, "[REDACTED]");
|
|
17
|
+
}
|
|
18
|
+
return redacted;
|
|
19
|
+
}
|
|
20
|
+
const MCP_PROGRESS_MESSAGES = {
|
|
21
|
+
"mcp__citio__investigate_codebase": "Scanning the codebase...",
|
|
22
|
+
"mcp__citio__read_file": "Reading repository files...",
|
|
23
|
+
"mcp__citio__write_file": "Preparing a code change...",
|
|
24
|
+
"mcp__citio__query_logs": "Querying CloudWatch logs...",
|
|
25
|
+
"mcp__citio__query_audit_log": "Checking the Citio audit trail...",
|
|
26
|
+
"mcp__citio__recall_context": "Recalling prior context...",
|
|
27
|
+
"mcp__citio__run_command": "Running a controlled workspace command...",
|
|
28
|
+
"mcp__citio__check_ci_status": "Checking CI status...",
|
|
29
|
+
"mcp__citio__create_branch": "Preparing a branch...",
|
|
30
|
+
"mcp__citio__create_pr": "Preparing a pull request...",
|
|
31
|
+
"citio.investigate_codebase": "Scanning the codebase...",
|
|
32
|
+
"citio.read_file": "Reading repository files...",
|
|
33
|
+
"citio.write_file": "Preparing a code change...",
|
|
34
|
+
"citio.query_logs": "Querying CloudWatch logs...",
|
|
35
|
+
"citio.query_audit_log": "Checking the Citio audit trail...",
|
|
36
|
+
"citio.recall_context": "Recalling prior context...",
|
|
37
|
+
"citio.run_command": "Running a controlled workspace command...",
|
|
38
|
+
"citio.check_ci_status": "Checking CI status...",
|
|
39
|
+
"citio.create_branch": "Preparing a branch...",
|
|
40
|
+
"citio.create_pr": "Preparing a pull request...",
|
|
41
|
+
};
|
|
42
|
+
const NATIVE_TOOL_NAMES = new Set(["Agent", "Bash", "Grep", "Glob", "Read", "ToolSearch"]);
|
|
43
|
+
/** Build a specific one-line label from the tool's salient argument. */
|
|
44
|
+
function specificProgressLabel(toolName, argsJson) {
|
|
45
|
+
const short = toolName.replace(/^mcp__citio__/, "").replace(/^citio\./, "");
|
|
46
|
+
let args = {};
|
|
47
|
+
if (argsJson) {
|
|
48
|
+
try {
|
|
49
|
+
args = JSON.parse(argsJson);
|
|
50
|
+
}
|
|
51
|
+
catch { /* generic fallback */ }
|
|
52
|
+
}
|
|
53
|
+
const s = (key, max = 90) => {
|
|
54
|
+
const v = args[key];
|
|
55
|
+
if (typeof v !== "string" || !v.trim())
|
|
56
|
+
return null;
|
|
57
|
+
const clean = v.replace(/\s+/g, " ").trim();
|
|
58
|
+
return clean.length > max ? clean.slice(0, max) + "…" : clean;
|
|
59
|
+
};
|
|
60
|
+
switch (short) {
|
|
61
|
+
case "run_command": {
|
|
62
|
+
const c = s("command");
|
|
63
|
+
return c ? `Running: \`${c}\`` : null;
|
|
64
|
+
}
|
|
65
|
+
case "read_file": {
|
|
66
|
+
const f = s("path") || s("file_path") || s("file");
|
|
67
|
+
return f ? `Reading ${f}` : null;
|
|
68
|
+
}
|
|
69
|
+
case "write_file": {
|
|
70
|
+
const f = s("path") || s("file_path") || s("file");
|
|
71
|
+
return f ? `Editing ${f}` : null;
|
|
72
|
+
}
|
|
73
|
+
case "investigate_codebase": {
|
|
74
|
+
const q = s("pattern") || s("query");
|
|
75
|
+
return q ? `Searching code for “${q}”` : null;
|
|
76
|
+
}
|
|
77
|
+
case "query_logs": {
|
|
78
|
+
const g = s("log_group") || s("group") || s("query");
|
|
79
|
+
return g ? `Querying logs: ${g}` : null;
|
|
80
|
+
}
|
|
81
|
+
case "create_branch": {
|
|
82
|
+
const b = s("branch") || s("name");
|
|
83
|
+
return b ? `Creating branch ${b}` : null;
|
|
84
|
+
}
|
|
85
|
+
case "create_pr": {
|
|
86
|
+
const ti = s("title");
|
|
87
|
+
return ti ? `Opening PR: ${ti}` : null;
|
|
88
|
+
}
|
|
89
|
+
case "check_ci_status": {
|
|
90
|
+
const n = args["pr_number"];
|
|
91
|
+
return typeof n === "number" ? `Checking CI for PR #${n}` : null;
|
|
92
|
+
}
|
|
93
|
+
default: return null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function progressLabelFor(toolNameWithArgs) {
|
|
97
|
+
const sep = toolNameWithArgs.indexOf(" · ");
|
|
98
|
+
const toolName = (sep >= 0 ? toolNameWithArgs.slice(0, sep) : toolNameWithArgs).trim();
|
|
99
|
+
const argsJson = sep >= 0 ? toolNameWithArgs.slice(sep + 3).replace(/…$/, "") : undefined;
|
|
100
|
+
return specificProgressLabel(toolName, argsJson) || MCP_PROGRESS_MESSAGES[toolName] || null;
|
|
101
|
+
}
|
|
102
|
+
function normalizeProgressChunk(chunk) {
|
|
103
|
+
const trimmed = chunk.trim();
|
|
104
|
+
if (!trimmed) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
if (trimmed.startsWith("[Progress] ")) {
|
|
108
|
+
return trimmed;
|
|
109
|
+
}
|
|
110
|
+
if (trimmed.startsWith("Using tool: ")) {
|
|
111
|
+
const rest = trimmed.slice("Using tool: ".length).trim();
|
|
112
|
+
const bareName = rest.split(" · ")[0];
|
|
113
|
+
if (bareName === "mcp__citio__post_update" || NATIVE_TOOL_NAMES.has(bareName)) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
return progressLabelFor(rest);
|
|
117
|
+
}
|
|
118
|
+
if (trimmed.startsWith("Using MCP tool ")) {
|
|
119
|
+
return progressLabelFor(trimmed.slice("Using MCP tool ".length).trim());
|
|
120
|
+
}
|
|
121
|
+
if (trimmed.startsWith("MCP tool ")) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
export class SlackAdapter {
|
|
127
|
+
app;
|
|
128
|
+
config;
|
|
129
|
+
agentRunner;
|
|
130
|
+
sessionManager;
|
|
131
|
+
constructor(config, agentRunner, sessionManager) {
|
|
132
|
+
this.config = config;
|
|
133
|
+
this.agentRunner = agentRunner;
|
|
134
|
+
this.sessionManager = sessionManager;
|
|
135
|
+
this.app = new App({
|
|
136
|
+
token: config.slack.bot_token,
|
|
137
|
+
appToken: config.slack.app_token,
|
|
138
|
+
socketMode: true,
|
|
139
|
+
});
|
|
140
|
+
this.setupAssistant();
|
|
141
|
+
}
|
|
142
|
+
setupAssistant() {
|
|
143
|
+
const assistant = new Assistant({
|
|
144
|
+
threadStarted: async ({ event, say, setSuggestedPrompts, saveThreadContext }) => {
|
|
145
|
+
console.log(JSON.stringify({
|
|
146
|
+
type: "assistant_thread_started",
|
|
147
|
+
user: event.assistant_thread.user_id,
|
|
148
|
+
channel: event.assistant_thread.context?.channel_id,
|
|
149
|
+
}));
|
|
150
|
+
await saveThreadContext();
|
|
151
|
+
const context = event.assistant_thread.context;
|
|
152
|
+
await say("Hi! I'm Citio, your autonomous CTO agent. Tell me what you need — bug investigation, code fixes, log analysis, or anything else.");
|
|
153
|
+
const prompts = [
|
|
154
|
+
{
|
|
155
|
+
title: "Investigate a bug",
|
|
156
|
+
message: "There's a bug in the login flow — users can't reset their passwords. Can you investigate and fix it?",
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
title: "Review recent changes",
|
|
160
|
+
message: "Can you review the latest changes on main and flag any issues?",
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
title: "Check deployment status",
|
|
164
|
+
message: "What's the status of our latest deployment? Any errors in the logs?",
|
|
165
|
+
},
|
|
166
|
+
];
|
|
167
|
+
if (context?.channel_id) {
|
|
168
|
+
prompts.unshift({
|
|
169
|
+
title: "Summarize this channel",
|
|
170
|
+
message: "Can you summarize the recent discussion in this channel?",
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
await setSuggestedPrompts({
|
|
174
|
+
title: "Here are some things I can help with:",
|
|
175
|
+
prompts,
|
|
176
|
+
});
|
|
177
|
+
},
|
|
178
|
+
threadContextChanged: async ({ saveThreadContext }) => {
|
|
179
|
+
await saveThreadContext();
|
|
180
|
+
},
|
|
181
|
+
userMessage: async ({ client, message, say, setTitle, setStatus, getThreadContext }) => {
|
|
182
|
+
if (!("text" in message) || !message.text)
|
|
183
|
+
return;
|
|
184
|
+
if (!("thread_ts" in message) || !message.thread_ts)
|
|
185
|
+
return;
|
|
186
|
+
const { channel, thread_ts } = message;
|
|
187
|
+
const userId = "user" in message ? message.user : undefined;
|
|
188
|
+
const text = message.text;
|
|
189
|
+
console.log(JSON.stringify({
|
|
190
|
+
type: "user_message",
|
|
191
|
+
user: userId,
|
|
192
|
+
text: text.slice(0, 100),
|
|
193
|
+
channel,
|
|
194
|
+
thread_ts,
|
|
195
|
+
}));
|
|
196
|
+
// DM auth check — only admin_users can DM the bot
|
|
197
|
+
if (userId &&
|
|
198
|
+
this.config.slack.admin_users &&
|
|
199
|
+
this.config.slack.admin_users.length > 0 &&
|
|
200
|
+
!this.config.slack.admin_users.includes(userId)) {
|
|
201
|
+
await say("DMs are restricted. Please @mention me in the team channel instead.");
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
try {
|
|
205
|
+
// Set title and status (best-effort — needs assistant:write scope)
|
|
206
|
+
try {
|
|
207
|
+
await setTitle(text.length > 50 ? text.slice(0, 50) + "..." : text);
|
|
208
|
+
await setStatus({
|
|
209
|
+
status: "investigating...",
|
|
210
|
+
loading_messages: [
|
|
211
|
+
"Reading the codebase...",
|
|
212
|
+
"Checking the logs...",
|
|
213
|
+
"Analyzing the issue...",
|
|
214
|
+
"Preparing a fix...",
|
|
215
|
+
"Almost there...",
|
|
216
|
+
],
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
catch (err) {
|
|
220
|
+
console.log(JSON.stringify({
|
|
221
|
+
type: "assistant_api_warning",
|
|
222
|
+
error: err instanceof Error ? err.message : String(err),
|
|
223
|
+
hint: "Add assistant:write scope in Slack app settings and reinstall",
|
|
224
|
+
}));
|
|
225
|
+
}
|
|
226
|
+
// Get thread context (which channel the user is viewing)
|
|
227
|
+
let contextInfo = "";
|
|
228
|
+
try {
|
|
229
|
+
const threadContext = await getThreadContext();
|
|
230
|
+
contextInfo = threadContext?.channel_id
|
|
231
|
+
? `The user is currently viewing channel ${threadContext.channel_id}.`
|
|
232
|
+
: "";
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
// Context not available
|
|
236
|
+
}
|
|
237
|
+
// Build the prompt with thread context
|
|
238
|
+
const prompt = this.buildPrompt(text, contextInfo, `${channel}:${thread_ts}`);
|
|
239
|
+
// Show queue status if busy
|
|
240
|
+
if (this.agentRunner.isSaturated) {
|
|
241
|
+
await say(`:hourglass: I'm working on another task. Yours is queued (position ${this.agentRunner.queueLength + 1}). I'll get to it shortly.`);
|
|
242
|
+
}
|
|
243
|
+
// Post thinking message
|
|
244
|
+
let thinkingTs;
|
|
245
|
+
try {
|
|
246
|
+
const thinkingMsg = await client.chat.postMessage({
|
|
247
|
+
channel,
|
|
248
|
+
thread_ts,
|
|
249
|
+
text: ":hourglass: Working on it...",
|
|
250
|
+
});
|
|
251
|
+
thinkingTs = thinkingMsg.ts ?? undefined;
|
|
252
|
+
}
|
|
253
|
+
catch {
|
|
254
|
+
// Continue without
|
|
255
|
+
}
|
|
256
|
+
// Get existing thread mapping (for conversation continuity)
|
|
257
|
+
const threadKey = `${channel}:${thread_ts}`;
|
|
258
|
+
// Only pass sessionId for follow-ups (resume), not first message
|
|
259
|
+
const sessionId = this.getProviderSessionId(threadKey);
|
|
260
|
+
// Submit to the agent
|
|
261
|
+
let dmLastUpdate = Date.now();
|
|
262
|
+
let dmAccOutput = "";
|
|
263
|
+
let dmLastProgressLine = "";
|
|
264
|
+
const stopProgressPolling = this.startProgressPolling(threadKey, (update) => {
|
|
265
|
+
const normalized = normalizeProgressChunk(update);
|
|
266
|
+
if (!normalized || normalized === dmLastProgressLine) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
dmLastProgressLine = normalized;
|
|
270
|
+
dmAccOutput += `${dmAccOutput ? "\n" : ""}${normalized}`;
|
|
271
|
+
});
|
|
272
|
+
await this.agentRunner.submit({
|
|
273
|
+
prompt,
|
|
274
|
+
threadKey,
|
|
275
|
+
sessionId,
|
|
276
|
+
onSessionEstablished: (providerSessionId) => {
|
|
277
|
+
this.rememberProviderSession(threadKey, providerSessionId);
|
|
278
|
+
},
|
|
279
|
+
onProgress: (chunk) => {
|
|
280
|
+
const normalized = normalizeProgressChunk(chunk);
|
|
281
|
+
if (!normalized || normalized === dmLastProgressLine) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
dmLastProgressLine = normalized;
|
|
285
|
+
dmAccOutput += `${dmAccOutput ? "\n" : ""}${normalized}`;
|
|
286
|
+
const now = Date.now();
|
|
287
|
+
if (thinkingTs && now - dmLastUpdate >= 5000) {
|
|
288
|
+
dmLastUpdate = now;
|
|
289
|
+
const preview = redactCredentials(dmAccOutput).slice(-3800);
|
|
290
|
+
client.chat.update({
|
|
291
|
+
channel,
|
|
292
|
+
ts: thinkingTs,
|
|
293
|
+
text: preview || ":hourglass: Still working...",
|
|
294
|
+
}).catch(() => { });
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
onComplete: async (output) => {
|
|
298
|
+
stopProgressPolling();
|
|
299
|
+
const finalOutput = redactCredentials(output);
|
|
300
|
+
try {
|
|
301
|
+
const truncated = finalOutput.length > 3900
|
|
302
|
+
? finalOutput.slice(-3900) + "\n\n_(output truncated)_"
|
|
303
|
+
: finalOutput;
|
|
304
|
+
if (thinkingTs) {
|
|
305
|
+
await client.chat.update({
|
|
306
|
+
channel,
|
|
307
|
+
ts: thinkingTs,
|
|
308
|
+
text: truncated || "Task completed (no output).",
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
await say(truncated || "Task completed (no output).");
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
catch {
|
|
316
|
+
try {
|
|
317
|
+
await say(finalOutput.slice(-3900) || "Task completed.");
|
|
318
|
+
}
|
|
319
|
+
catch { /* give up */ }
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
onError: async (err) => {
|
|
323
|
+
stopProgressPolling();
|
|
324
|
+
await say(`Sorry, something went wrong: ${err.message}`);
|
|
325
|
+
},
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
catch (err) {
|
|
329
|
+
console.error("Error handling message:", err);
|
|
330
|
+
await say(`Sorry, something went wrong: ${err instanceof Error ? err.message : String(err)}`);
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
});
|
|
334
|
+
this.app.assistant(assistant);
|
|
335
|
+
// Handle @mentions in channels — work directly in the channel thread
|
|
336
|
+
this.app.event("app_mention", async ({ event, client, context }) => {
|
|
337
|
+
await this.handleChannelRequest({
|
|
338
|
+
client,
|
|
339
|
+
userId: event.user,
|
|
340
|
+
rawText: event.text || "",
|
|
341
|
+
channel: event.channel,
|
|
342
|
+
threadTs: event.thread_ts || event.ts,
|
|
343
|
+
trigger: "app_mention",
|
|
344
|
+
botUserId: context.botUserId,
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
// Ambient mode: in the bot's home channel, plain messages work without an
|
|
348
|
+
// @mention. Skipped: messages addressed to OTHER people (someone else's
|
|
349
|
+
// <@mention>), bot/system messages, edits, and thread replies (threads
|
|
350
|
+
// stay opt-in via @mention). Requires the message.channels/groups events
|
|
351
|
+
// in the Slack app manifest.
|
|
352
|
+
this.app.event("message", async ({ event, client, context }) => {
|
|
353
|
+
if (this.config.slack.respond_without_mention === false)
|
|
354
|
+
return;
|
|
355
|
+
const homeChannel = this.config.slack.channel_id;
|
|
356
|
+
if (!homeChannel)
|
|
357
|
+
return;
|
|
358
|
+
const msg = event;
|
|
359
|
+
if (msg.channel !== homeChannel)
|
|
360
|
+
return;
|
|
361
|
+
if (msg.channel_type !== "channel" && msg.channel_type !== "group")
|
|
362
|
+
return;
|
|
363
|
+
if (msg.subtype || msg.bot_id)
|
|
364
|
+
return;
|
|
365
|
+
if (msg.thread_ts)
|
|
366
|
+
return;
|
|
367
|
+
const botUserId = context.botUserId;
|
|
368
|
+
const rawText = msg.text || "";
|
|
369
|
+
if (!msg.user || (botUserId && msg.user === botUserId))
|
|
370
|
+
return;
|
|
371
|
+
// Bot mentioned -> app_mention fires for it; don't double-handle.
|
|
372
|
+
if (botUserId && rawText.includes(`<@${botUserId}>`))
|
|
373
|
+
return;
|
|
374
|
+
// Addressed to someone else -> leave the humans alone.
|
|
375
|
+
if (/<@[A-Z0-9]+>/.test(rawText))
|
|
376
|
+
return;
|
|
377
|
+
await this.handleChannelRequest({
|
|
378
|
+
client,
|
|
379
|
+
userId: msg.user,
|
|
380
|
+
rawText,
|
|
381
|
+
channel: msg.channel,
|
|
382
|
+
threadTs: msg.thread_ts || msg.ts || "",
|
|
383
|
+
trigger: "ambient_message",
|
|
384
|
+
botUserId,
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
// In-flight channel requests, so a deploy-time SIGTERM can apologise instead
|
|
389
|
+
// of going silent (an in-flight `codex exec`/`claude -p` dies with the container).
|
|
390
|
+
activeRequests = new Map();
|
|
391
|
+
/** Called on SIGTERM: tell every waiting thread we're restarting. */
|
|
392
|
+
async notifyShutdown() {
|
|
393
|
+
const notices = [...this.activeRequests.values()].map(async (req) => {
|
|
394
|
+
const text = "⚠️ I'm being restarted mid-task (deploy in progress). Please re-send your request in a minute.";
|
|
395
|
+
try {
|
|
396
|
+
if (req.thinkingTs) {
|
|
397
|
+
await req.client.chat.update({ channel: req.channel, ts: req.thinkingTs, text });
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
await req.client.chat.postMessage({ channel: req.channel, text });
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
catch { /* best effort — we're dying anyway */ }
|
|
404
|
+
});
|
|
405
|
+
await Promise.all(notices);
|
|
406
|
+
}
|
|
407
|
+
async handleChannelRequest(params) {
|
|
408
|
+
const { client, channel, threadTs } = params;
|
|
409
|
+
const userId = params.userId;
|
|
410
|
+
// Strip only the BOT's own mention — other people's <@mentions> are meaningful
|
|
411
|
+
// context ("check what @john deployed") and render as real mentions if the
|
|
412
|
+
// agent echoes them in its reply. Fall back to strip-all when the bot id is
|
|
413
|
+
// unknown (shouldn't happen under Bolt).
|
|
414
|
+
const text = (params.botUserId
|
|
415
|
+
? params.rawText.split(`<@${params.botUserId}>`).join(" ")
|
|
416
|
+
: params.rawText.replace(/<@[A-Z0-9]+>/g, "")).replace(/\s+/g, " ").trim();
|
|
417
|
+
console.log(JSON.stringify({
|
|
418
|
+
type: params.trigger,
|
|
419
|
+
user: userId,
|
|
420
|
+
text: text.slice(0, 100),
|
|
421
|
+
channel,
|
|
422
|
+
}));
|
|
423
|
+
if (!text)
|
|
424
|
+
return;
|
|
425
|
+
// Auth check — only authorized users can use in channels
|
|
426
|
+
if (userId &&
|
|
427
|
+
this.config.slack.authorized_users &&
|
|
428
|
+
this.config.slack.authorized_users.length > 0 &&
|
|
429
|
+
!this.config.slack.authorized_users.includes(userId)) {
|
|
430
|
+
return; // Silent ignore
|
|
431
|
+
}
|
|
432
|
+
// Post thinking message directly in channel (not in thread)
|
|
433
|
+
let thinkingTs;
|
|
434
|
+
try {
|
|
435
|
+
const msg = await client.chat.postMessage({
|
|
436
|
+
channel,
|
|
437
|
+
text: ":hourglass: Working on it...",
|
|
438
|
+
});
|
|
439
|
+
thinkingTs = msg.ts ?? undefined;
|
|
440
|
+
}
|
|
441
|
+
catch {
|
|
442
|
+
// Continue without
|
|
443
|
+
}
|
|
444
|
+
const threadKey = `${channel}:${threadTs}`;
|
|
445
|
+
this.activeRequests.set(threadKey, { client, channel, thinkingTs });
|
|
446
|
+
const sessionId = this.getProviderSessionId(threadKey);
|
|
447
|
+
const prompt = this.buildPrompt(text, "", threadKey);
|
|
448
|
+
let lastUpdateTime = Date.now();
|
|
449
|
+
let accumulatedOutput = "";
|
|
450
|
+
let lastProgressLine = "";
|
|
451
|
+
const stopProgressPolling = this.startProgressPolling(threadKey, (update) => {
|
|
452
|
+
const normalized = normalizeProgressChunk(update);
|
|
453
|
+
if (!normalized || normalized === lastProgressLine) {
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
lastProgressLine = normalized;
|
|
457
|
+
accumulatedOutput += `${accumulatedOutput ? "\n" : ""}${normalized}`;
|
|
458
|
+
});
|
|
459
|
+
await this.agentRunner.submit({
|
|
460
|
+
prompt,
|
|
461
|
+
threadKey,
|
|
462
|
+
sessionId,
|
|
463
|
+
onSessionEstablished: (providerSessionId) => {
|
|
464
|
+
this.rememberProviderSession(threadKey, providerSessionId);
|
|
465
|
+
},
|
|
466
|
+
onProgress: (chunk) => {
|
|
467
|
+
const normalized = normalizeProgressChunk(chunk);
|
|
468
|
+
if (!normalized || normalized === lastProgressLine) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
lastProgressLine = normalized;
|
|
472
|
+
accumulatedOutput += `${accumulatedOutput ? "\n" : ""}${normalized}`;
|
|
473
|
+
const now = Date.now();
|
|
474
|
+
// Update thinking message every 5 seconds with latest output
|
|
475
|
+
if (thinkingTs && now - lastUpdateTime >= 5000) {
|
|
476
|
+
lastUpdateTime = now;
|
|
477
|
+
const preview = redactCredentials(accumulatedOutput).slice(-3800);
|
|
478
|
+
client.chat.update({
|
|
479
|
+
channel,
|
|
480
|
+
ts: thinkingTs,
|
|
481
|
+
text: preview || ":hourglass: Still working...",
|
|
482
|
+
}).catch(() => { });
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
onComplete: async (output) => {
|
|
486
|
+
this.activeRequests.delete(threadKey);
|
|
487
|
+
stopProgressPolling();
|
|
488
|
+
const finalOutput = redactCredentials(output);
|
|
489
|
+
try {
|
|
490
|
+
const truncated = finalOutput.length > 3900
|
|
491
|
+
? finalOutput.slice(-3900) + "\n\n_(output truncated)_"
|
|
492
|
+
: finalOutput;
|
|
493
|
+
if (thinkingTs) {
|
|
494
|
+
await client.chat.update({
|
|
495
|
+
channel,
|
|
496
|
+
ts: thinkingTs,
|
|
497
|
+
text: truncated || "Done (no output).",
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
await client.chat.postMessage({
|
|
502
|
+
channel,
|
|
503
|
+
text: truncated || "Done (no output).",
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
catch {
|
|
508
|
+
try {
|
|
509
|
+
await client.chat.postMessage({
|
|
510
|
+
channel,
|
|
511
|
+
text: finalOutput.slice(-3900) || "Done.",
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
catch { /* give up */ }
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
onError: async (err) => {
|
|
518
|
+
this.activeRequests.delete(threadKey);
|
|
519
|
+
stopProgressPolling();
|
|
520
|
+
await client.chat.postMessage({
|
|
521
|
+
channel,
|
|
522
|
+
text: `Sorry, something went wrong: ${err.message}`,
|
|
523
|
+
});
|
|
524
|
+
},
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
getProviderSessionId(threadKey) {
|
|
528
|
+
return this.sessionManager.get(threadKey);
|
|
529
|
+
}
|
|
530
|
+
rememberProviderSession(threadKey, sessionId) {
|
|
531
|
+
this.sessionManager.remember(threadKey, sessionId);
|
|
532
|
+
}
|
|
533
|
+
buildPrompt(userMessage, contextInfo, threadKey) {
|
|
534
|
+
const parts = [
|
|
535
|
+
"You are Citio, an autonomous CTO agent. A team member is asking for help.",
|
|
536
|
+
"You should prefer the Citio MCP tools for repository investigation, file edits, pull requests, CI checks, log queries, and controlled command execution.",
|
|
537
|
+
"Use the Citio MCP tools instead of native Bash/Grep/Glob/Read tools whenever a Citio tool can do the job.",
|
|
538
|
+
"For AWS and CloudWatch work, prefer query_logs first and only fall back to Citio run_command when query_logs cannot answer the question.",
|
|
539
|
+
"If you use shell access, keep it to the minimum needed and do not assume direct credential access.",
|
|
540
|
+
"For AWS commands: never use --profile. The ECS task role provides credentials automatically when those commands are available.",
|
|
541
|
+
`If you want to send a structured progress update, call post_update with thread_key=\"${threadKey}\".`,
|
|
542
|
+
];
|
|
543
|
+
// Team rules from citio.yaml — the user's behaviour guardrails for the agent.
|
|
544
|
+
const teamRules = this.config.workspace?.rules ?? [];
|
|
545
|
+
if (teamRules.length > 0) {
|
|
546
|
+
parts.push("Team rules — follow these on every task:\n" +
|
|
547
|
+
teamRules.map((rule) => `- ${rule}`).join("\n"));
|
|
548
|
+
}
|
|
549
|
+
if (contextInfo) {
|
|
550
|
+
parts.push(contextInfo);
|
|
551
|
+
}
|
|
552
|
+
parts.push(`User's message: ${userMessage}`);
|
|
553
|
+
parts.push("Help them with their request. Be concise and actionable.");
|
|
554
|
+
parts.push(`IMPORTANT: Format your response using Slack mrkdwn syntax, NOT markdown.
|
|
555
|
+
Slack formatting rules:
|
|
556
|
+
- Bold: *bold* (NOT **bold**)
|
|
557
|
+
- Italic: _italic_ (NOT *italic*)
|
|
558
|
+
- Strikethrough: ~strikethrough~
|
|
559
|
+
- Code inline: \`code\`
|
|
560
|
+
- Code block: \`\`\`code block\`\`\`
|
|
561
|
+
- Bullet lists: use bullet character • or dash - with no extra blank lines between items
|
|
562
|
+
- Numbered lists: 1. 2. 3. (no extra blank lines)
|
|
563
|
+
- Links: <https://example.com|link text>
|
|
564
|
+
- Block quotes: > quoted text
|
|
565
|
+
- NO headers (# syntax does not work in Slack)
|
|
566
|
+
- NO horizontal rules
|
|
567
|
+
- Keep paragraphs short. Use single newlines between sections, not double.`);
|
|
568
|
+
return parts.join("\n\n");
|
|
569
|
+
}
|
|
570
|
+
startProgressPolling(threadKey, onUpdate) {
|
|
571
|
+
const memoryDir = process.env.CITIO_MEMORY || "/memory";
|
|
572
|
+
const safeName = threadKey.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
573
|
+
const progressPath = path.join(memoryDir, "progress", `${safeName}.jsonl`);
|
|
574
|
+
let offset = existsSync(progressPath) ? readFileSync(progressPath, "utf-8").length : 0;
|
|
575
|
+
let stopped = false;
|
|
576
|
+
const poll = () => {
|
|
577
|
+
if (stopped || !existsSync(progressPath)) {
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
try {
|
|
581
|
+
const content = readFileSync(progressPath, "utf-8");
|
|
582
|
+
if (content.length <= offset) {
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
const chunk = content.slice(offset);
|
|
586
|
+
offset = content.length;
|
|
587
|
+
for (const line of chunk.split("\n")) {
|
|
588
|
+
if (!line.trim())
|
|
589
|
+
continue;
|
|
590
|
+
try {
|
|
591
|
+
const entry = JSON.parse(line);
|
|
592
|
+
if (entry.text) {
|
|
593
|
+
onUpdate(`[Progress] ${entry.text}`);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
catch {
|
|
597
|
+
// Ignore malformed lines from partial writes.
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
catch {
|
|
602
|
+
// Best-effort only.
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
const interval = setInterval(poll, 2000);
|
|
606
|
+
return () => {
|
|
607
|
+
stopped = true;
|
|
608
|
+
clearInterval(interval);
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
async start() {
|
|
612
|
+
await this.app.start();
|
|
613
|
+
console.log(JSON.stringify({
|
|
614
|
+
type: "slack_connected",
|
|
615
|
+
mode: "assistant",
|
|
616
|
+
channel: this.config.slack.channel_id,
|
|
617
|
+
}));
|
|
618
|
+
}
|
|
619
|
+
async stop() {
|
|
620
|
+
await this.agentRunner.shutdown();
|
|
621
|
+
await this.app.stop();
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
//# sourceMappingURL=slack.js.map
|
|
@@ -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