@gonzih/cc-discord 0.2.2 → 0.2.3
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/meta-agent-manager.js +33 -15
- package/dist/notifier.js +13 -2
- package/package.json +1 -1
|
@@ -59,25 +59,43 @@ export function injectMcp(ns, wsPath, token) {
|
|
|
59
59
|
const npmCache = process.env.npm_config_cache ?? `${homedir()}/.npm`;
|
|
60
60
|
const trustedOwners = process.env.CC_AGENT_TRUSTED_OWNERS ?? "";
|
|
61
61
|
const systemPath = process.env.PATH ?? "/usr/local/bin:/usr/bin:/bin";
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
npm_config_cache: npmCache,
|
|
75
|
-
},
|
|
62
|
+
const servers = {
|
|
63
|
+
"cc-agent": {
|
|
64
|
+
command: "/opt/homebrew/bin/npx",
|
|
65
|
+
args: ["-y", "--prefer-online", "@gonzih/cc-agent"],
|
|
66
|
+
env: {
|
|
67
|
+
CC_AGENT_NAMESPACE: ns,
|
|
68
|
+
CWD: wsPath,
|
|
69
|
+
CLAUDE_CODE_OAUTH_TOKEN: token,
|
|
70
|
+
CLAUDE_TOKENS: token,
|
|
71
|
+
CC_AGENT_TRUSTED_OWNERS: trustedOwners,
|
|
72
|
+
PATH: systemPath,
|
|
73
|
+
npm_config_cache: npmCache,
|
|
76
74
|
},
|
|
77
75
|
},
|
|
78
76
|
};
|
|
77
|
+
// gmail MCP — enabled when GMAIL_EMAIL + GMAIL_APP_PASSWORD are in env
|
|
78
|
+
const gmailEmail = process.env.GMAIL_EMAIL;
|
|
79
|
+
const gmailPass = process.env.GMAIL_APP_PASSWORD;
|
|
80
|
+
if (gmailEmail && gmailPass) {
|
|
81
|
+
servers["gmail-personal"] = {
|
|
82
|
+
command: "/opt/homebrew/bin/npx",
|
|
83
|
+
args: ["-y", "gmail-mcp-imap"],
|
|
84
|
+
env: { GMAIL_EMAIL: gmailEmail, GMAIL_APP_PASSWORD: gmailPass, npm_config_cache: npmCache },
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
// github MCP — enabled when GITHUB_PERSONAL_ACCESS_TOKEN is in env
|
|
88
|
+
const ghToken = process.env.GITHUB_PERSONAL_ACCESS_TOKEN;
|
|
89
|
+
if (ghToken) {
|
|
90
|
+
servers["github"] = {
|
|
91
|
+
command: "docker",
|
|
92
|
+
args: ["run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server"],
|
|
93
|
+
env: { GITHUB_PERSONAL_ACCESS_TOKEN: ghToken },
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const config = { mcpServers: servers };
|
|
79
97
|
writeFileSync(mcpPath, JSON.stringify(config, null, 2), "utf8");
|
|
80
|
-
console.log(`[meta-agent-manager] injected MCP config for namespace=${ns}`);
|
|
98
|
+
console.log(`[meta-agent-manager] injected MCP config for namespace=${ns} (servers: ${Object.keys(servers).join(", ")})`);
|
|
81
99
|
}
|
|
82
100
|
/**
|
|
83
101
|
* Resolve claude binary — same logic as claude.ts resolveClaude.
|
package/dist/notifier.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* cca:discord:chat:log:{ns} — LPUSH + LTRIM 0 499 (last 500 messages)
|
|
11
11
|
* cca:discord:chat:outgoing:{ns} — PUBLISH for web UI to consume
|
|
12
12
|
*/
|
|
13
|
-
import { discordChatLog, discordChatOutgoing, discordNotify, chatIncomingChannel, createCcWire, TIMING, } from "@gonzih/cc-wire";
|
|
13
|
+
import { discordChatLog, discordChatOutgoing, discordNotify, notifyChannel, chatIncomingChannel, createCcWire, TIMING, } from "@gonzih/cc-wire";
|
|
14
14
|
import { existsSync, statSync } from "fs";
|
|
15
15
|
import { splitLongMessage, stripAnsi } from "./formatter.js";
|
|
16
16
|
const SAFE_DIRS = ["/tmp/", "/var/folders/"];
|
|
@@ -152,9 +152,11 @@ export function startNotifier(bot, notifyChannelId, namespace, redis, handleUser
|
|
|
152
152
|
if (subscribedNamespaces.has(ns))
|
|
153
153
|
return;
|
|
154
154
|
subscribedNamespaces.add(ns);
|
|
155
|
-
const notifyCh = discordNotify(ns);
|
|
155
|
+
const notifyCh = discordNotify(ns); // cca:discord:notify:{ns} — new cc-wire path
|
|
156
|
+
const legacyNotifyCh = notifyChannel(ns); // cca:notify:{ns} — cc-agent still publishes here
|
|
156
157
|
const incomingCh = chatIncomingChannel(ns);
|
|
157
158
|
channelToNamespace.set(notifyCh, ns);
|
|
159
|
+
channelToNamespace.set(legacyNotifyCh, ns);
|
|
158
160
|
channelToNamespace.set(incomingCh, ns);
|
|
159
161
|
sub.subscribe(notifyCh, (err) => {
|
|
160
162
|
if (err) {
|
|
@@ -164,6 +166,15 @@ export function startNotifier(bot, notifyChannelId, namespace, redis, handleUser
|
|
|
164
166
|
log("info", `subscribed to ${notifyCh}`);
|
|
165
167
|
}
|
|
166
168
|
});
|
|
169
|
+
// Also subscribe to legacy cc-agent notification channel
|
|
170
|
+
sub.subscribe(legacyNotifyCh, (err) => {
|
|
171
|
+
if (err) {
|
|
172
|
+
log("error", `subscribe ${legacyNotifyCh} failed:`, err.message);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
log("info", `subscribed to ${legacyNotifyCh} (legacy cc-agent)`);
|
|
176
|
+
}
|
|
177
|
+
});
|
|
167
178
|
sub.subscribe(incomingCh, (err) => {
|
|
168
179
|
if (err) {
|
|
169
180
|
log("error", `subscribe ${incomingCh} failed:`, err.message);
|