@gonzih/cc-discord 0.2.13 → 0.2.14

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/bot.js CHANGED
@@ -1293,7 +1293,7 @@ export class CcDiscordBot {
1293
1293
  startMetaAgentPolling() {
1294
1294
  if (!this.wire)
1295
1295
  return;
1296
- this.metaAgentManager.startPolling(this.wire, () => Array.from(this.channelNamespaceMap.values()).map((v) => v.namespace));
1296
+ this.metaAgentManager.startPolling(this.wire, () => Array.from(this.channelNamespaceMap.values()));
1297
1297
  }
1298
1298
  stop() {
1299
1299
  for (const [key, session] of this.sessions) {
@@ -39,7 +39,10 @@ export declare function spawnSession(ns: string, message: string, token: string,
39
39
  export interface MetaAgentManager {
40
40
  ensureWorkspace: (ns: string, repoUrl: string) => Promise<void>;
41
41
  injectMcp: (ns: string, token: string) => void;
42
- startPolling: (wire: Wire, getNamespaces: () => string[]) => void;
42
+ startPolling: (wire: Wire, getNamespaces: () => Array<{
43
+ namespace: string;
44
+ repoUrl: string;
45
+ }>) => void;
43
46
  stop: () => void;
44
47
  }
45
48
  /**
@@ -190,7 +190,7 @@ export function createMetaAgentManager() {
190
190
  const namespaces = getNamespaces();
191
191
  if (namespaces.length === 0)
192
192
  return;
193
- for (const ns of namespaces) {
193
+ for (const { namespace: ns, repoUrl } of namespaces) {
194
194
  if (activeNamespaces.has(ns))
195
195
  continue;
196
196
  wire.discord.dequeue(ns)
@@ -228,6 +228,11 @@ export function createMetaAgentManager() {
228
228
  });
229
229
  return;
230
230
  }
231
+ // Ensure the workspace directory exists — idempotent if already cloned.
232
+ // This guards against the workspace being absent after a bot restart.
233
+ const wsPath = workspacePath(ns);
234
+ await ensureWorkspace(ns, repoUrl);
235
+ injectMcp(ns, wsPath, token);
231
236
  spawnSession(ns, content, token, wire)
232
237
  .catch((err) => {
233
238
  console.error(`[meta-agent-manager] session error (ns=${ns}):`, err.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gonzih/cc-discord",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "description": "Claude Code Discord bot — chat with Claude Code via Discord",
5
5
  "type": "module",
6
6
  "bin": {