clementine-agent 1.0.89 → 1.0.91

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.
@@ -1788,12 +1788,18 @@ You have a cost budget per message — not a hard turn limit. Work until the tas
1788
1788
  const supportsThinking = !resolvedModel.includes('haiku');
1789
1789
  const needsThinking = !isHeartbeat && (isPlanStep || isUnleashed || !isCron);
1790
1790
  const computedThinking = thinking ?? (supportsThinking && needsThinking ? { type: 'adaptive' } : undefined);
1791
- // Haiku rejects user-configurable task budgets with a 400 ("This model
1792
- // does not support user-configurable task budgets"). Only pass
1793
- // taskBudget to models that accept it otherwise every Haiku cron
1794
- // run dies on arrival and (historically) got mis-classified as a
1795
- // permanent "budget exceeded" failure.
1796
- const supportsTaskBudget = !resolvedModel.includes('haiku');
1791
+ // ── taskBudget: don't pass to the SDK ─────────────────────────
1792
+ // The Anthropic API now rejects `taskBudget` for both Haiku AND Sonnet
1793
+ // ("This model does not support user-configurable task budgets" 400).
1794
+ // We previously gated by !haiku, but that left Sonnet crons (e.g.,
1795
+ // ross-the-sdr:reply-detection) failing on every run. Cost is
1796
+ // informational on a Claude subscription anyway — `maxTurns` and the
1797
+ // wall-clock cap (`maxHours` for unleashed) are the actual brakes.
1798
+ //
1799
+ // computedTaskBudget is still computed below for any future telemetry
1800
+ // path that wants to log "soft target" values, but it is intentionally
1801
+ // never passed into sdkOptions.
1802
+ const supportsTaskBudget = false;
1797
1803
  // 1M context beta: enable for Sonnet when toggled and context-heavy work benefits
1798
1804
  const isSonnet = resolvedModel.includes('sonnet');
1799
1805
  const computedBetas = ENABLE_1M_CONTEXT && isSonnet
@@ -63,8 +63,15 @@ export declare class AgentBotClient {
63
63
  *
64
64
  * Priority:
65
65
  * 1. Explicit channelIds from config (e.g. discordChannelId in agent.md)
66
- * 2. Match by channelName in any guild the bot is in
67
- * 3. All text channels the bot can see (fallback for simple setups)
66
+ * 2. Match by channelName in any guild the bot is in (single name or array)
67
+ * 3. **DM-only.** If neither is configured, the bot does not subscribe to any
68
+ * text channel — it only responds in DMs. Each agent has its own bot
69
+ * token specifically so it has its own DM lane to the owner; spamming
70
+ * every visible channel by default is the opposite of what users want.
71
+ *
72
+ * Previously this fell back to "all visible text channels," which made
73
+ * Ross + Nora respond everywhere in guild because they had no channelName
74
+ * set. Opt-in is the correct default.
68
75
  */
69
76
  private discoverChannels;
70
77
  /**
@@ -200,8 +200,15 @@ export class AgentBotClient {
200
200
  *
201
201
  * Priority:
202
202
  * 1. Explicit channelIds from config (e.g. discordChannelId in agent.md)
203
- * 2. Match by channelName in any guild the bot is in
204
- * 3. All text channels the bot can see (fallback for simple setups)
203
+ * 2. Match by channelName in any guild the bot is in (single name or array)
204
+ * 3. **DM-only.** If neither is configured, the bot does not subscribe to any
205
+ * text channel — it only responds in DMs. Each agent has its own bot
206
+ * token specifically so it has its own DM lane to the owner; spamming
207
+ * every visible channel by default is the opposite of what users want.
208
+ *
209
+ * Previously this fell back to "all visible text channels," which made
210
+ * Ross + Nora respond everywhere in guild because they had no channelName
211
+ * set. Opt-in is the correct default.
205
212
  */
206
213
  discoverChannels() {
207
214
  // 1. Explicit IDs
@@ -225,19 +232,13 @@ export class AgentBotClient {
225
232
  logger.info({ slug: this.config.slug, channelNames, matched }, 'Auto-discovered channels by name');
226
233
  return matched;
227
234
  }
228
- logger.warn({ slug: this.config.slug, channelNames }, 'No channels found matching channelName(s) — falling back to all visible text channels');
229
- }
230
- // 3. Fallback: all text channels the bot can see
231
- const all = [];
232
- for (const guild of this.client.guilds.cache.values()) {
233
- for (const channel of guild.channels.cache.values()) {
234
- if (channel.type === ChannelType.GuildText) {
235
- all.push(channel.id);
236
- }
237
- }
235
+ logger.warn({ slug: this.config.slug, channelNames }, 'No channels found matching channelName(s) — falling back to DM-only');
238
236
  }
239
- logger.info({ slug: this.config.slug, count: all.length }, 'Fallback: listening in all visible text channels');
240
- return all;
237
+ // 3. DM-only. Bot will still respond to DMs (handleMessage checks isDMBased
238
+ // before consulting resolvedChannelIds), so this is the right "no channels"
239
+ // default — not silence.
240
+ logger.info({ slug: this.config.slug }, 'Bot in DM-only mode (no channelName configured)');
241
+ return [];
241
242
  }
242
243
  /**
243
244
  * Send a notification to the owner's DMs on behalf of this agent bot.
@@ -457,11 +457,27 @@ export class CronScheduler {
457
457
  // phase updates for deep-mode runs get routed back to the originating
458
458
  // session instead of fanning out to every registered channel.
459
459
  const isDeepMode = (jobName) => jobName.startsWith('deep-');
460
- // Wire up push notifications for unleashed task completions
460
+ // Wire up push notifications for unleashed task completions.
461
+ //
462
+ // This callback is only meant for AD-HOC unleashed tasks (chat-triggered
463
+ // "deep mode" follow-ups that didn't go through a registered job). Three
464
+ // other paths already own their own delivery and would otherwise produce
465
+ // double-dispatches:
466
+ //
467
+ // 1. deep-mode (`deep-*`) → router handles delivery via _deliverDeepResult
468
+ // 2. background tasks (`bg:*`) → processBackgroundTasks dispatches result
469
+ // 3. registered cron jobs → cron-runner success path dispatches at line ~1115
470
+ //
471
+ // Each path is gated below; without the guards Sasha's morning brief was
472
+ // landing twice in her Discord channel.
461
473
  this.gateway.setUnleashedCompleteCallback((jobName, result) => {
462
474
  this.completedJobs.set(jobName, Date.now());
463
475
  if (isDeepMode(jobName))
464
- return; // router handles delivery via _deliverDeepResult
476
+ return; // (1) deep-mode router
477
+ if (jobName.startsWith('bg:'))
478
+ return; // (2) background-task dispatcher
479
+ if (this.jobs.some(j => j.name === jobName))
480
+ return; // (3) registered cron job
465
481
  if (result && result !== '__NOTHING__') {
466
482
  const slug = jobName.includes(':') ? jobName.split(':')[0] : undefined;
467
483
  // Strip system metadata for clean conversational delivery
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clementine-agent",
3
- "version": "1.0.89",
3
+ "version": "1.0.91",
4
4
  "description": "Clementine — Personal AI Assistant (TypeScript)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",