@openacp/cli 0.6.9 → 0.6.10

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.
@@ -47,7 +47,6 @@ import {
47
47
  } from "./chunk-2HMQOC7N.js";
48
48
  import {
49
49
  PRODUCT_GUIDE,
50
- STATUS_ICONS,
51
50
  dispatchMessage,
52
51
  evaluateNoise,
53
52
  extractContentText,
@@ -55,10 +54,11 @@ import {
55
54
  formatToolSummary,
56
55
  formatToolTitle,
57
56
  progressBar,
57
+ resolveToolIcon,
58
58
  splitMessage,
59
59
  stripCodeFences,
60
60
  truncateContent
61
- } from "./chunk-JUYDFUSN.js";
61
+ } from "./chunk-OWP7RZ62.js";
62
62
  import {
63
63
  ChannelAdapter
64
64
  } from "./chunk-LBIKITQT.js";
@@ -71,7 +71,11 @@ import {
71
71
  import "./chunk-VUNV25KB.js";
72
72
 
73
73
  // src/adapters/discord/adapter.ts
74
- import { Client, GatewayIntentBits, MessageFlags } from "discord.js";
74
+ import {
75
+ Client,
76
+ GatewayIntentBits,
77
+ MessageFlags
78
+ } from "discord.js";
75
79
 
76
80
  // src/adapters/discord/send-queue.ts
77
81
  var DiscordSendQueue = class {
@@ -152,27 +156,47 @@ function formatViewerLinks(links, filePath) {
152
156
  [View diff${fileName ? ` \u2014 ${fileName}` : ""}](${links.diff})`;
153
157
  return text;
154
158
  }
155
- function formatToolCall(tool, verbosity = "medium") {
156
- const si = STATUS_ICONS[tool.status || ""] || "\u{1F527}";
157
- const name = tool.name || "Tool";
158
- const label = verbosity === "low" ? formatToolTitle(name, tool.rawInput) : formatToolSummary(name, tool.rawInput);
159
- let text = `${si} **${label}**`;
160
- text += formatViewerLinks(tool.viewerLinks, tool.viewerFilePath);
161
- if (verbosity === "high" || verbosity === "medium" && !tool.viewerLinks) {
162
- const details = stripCodeFences(extractContentText(tool.content));
163
- if (details) {
159
+ function formatHighDetails(rawInput, content, maxLen) {
160
+ let text = "";
161
+ if (rawInput) {
162
+ const inputStr = typeof rawInput === "string" ? rawInput : JSON.stringify(rawInput, null, 2);
163
+ if (inputStr && inputStr !== "{}") {
164
164
  text += `
165
+ **Input:**
165
166
  \`\`\`
166
- ${truncateContent(details, 500)}
167
+ ${truncateContent(inputStr, maxLen)}
167
168
  \`\`\``;
168
169
  }
169
170
  }
171
+ const details = stripCodeFences(extractContentText(content));
172
+ if (details) {
173
+ text += `
174
+ **Output:**
175
+ \`\`\`
176
+ ${truncateContent(details, maxLen)}
177
+ \`\`\``;
178
+ }
179
+ return text;
180
+ }
181
+ function formatToolCall(tool, verbosity = "medium") {
182
+ const si = resolveToolIcon(tool);
183
+ const name = tool.name || "Tool";
184
+ const label = verbosity === "low" ? formatToolTitle(name, tool.rawInput, tool.displayTitle) : formatToolSummary(name, tool.rawInput, tool.displaySummary);
185
+ let text = `${si} **${label}**`;
186
+ text += formatViewerLinks(tool.viewerLinks, tool.viewerFilePath);
187
+ if (verbosity === "high") {
188
+ text += formatHighDetails(tool.rawInput, tool.content, 500);
189
+ }
170
190
  return text;
171
191
  }
172
192
  function formatToolUpdate(update, verbosity = "medium") {
173
193
  return formatToolCall(update, verbosity);
174
194
  }
175
- function formatPlan(entries) {
195
+ function formatPlan(entries, verbosity = "medium") {
196
+ if (verbosity === "medium") {
197
+ const done = entries.filter((e) => e.status === "completed").length;
198
+ return `\u{1F4CB} **Plan:** ${done}/${entries.length} steps completed`;
199
+ }
176
200
  const statusIcon = {
177
201
  pending: "\u23F3",
178
202
  in_progress: "\u{1F504}",
@@ -184,16 +208,23 @@ function formatPlan(entries) {
184
208
  return `**Plan:**
185
209
  ${lines.join("\n")}`;
186
210
  }
187
- function formatUsage(usage) {
188
- const { tokensUsed, contextSize } = usage;
211
+ function formatUsage(usage, verbosity = "medium") {
212
+ const { tokensUsed, contextSize, cost } = usage;
189
213
  if (tokensUsed == null) return "\u{1F4CA} Usage data unavailable";
214
+ if (verbosity === "medium") {
215
+ const costStr = cost != null ? ` \xB7 $${cost.toFixed(2)}` : "";
216
+ return `\u{1F4CA} ${formatTokens(tokensUsed)} tokens${costStr}`;
217
+ }
190
218
  if (contextSize == null) return `\u{1F4CA} ${formatTokens(tokensUsed)} tokens`;
191
219
  const ratio = tokensUsed / contextSize;
192
220
  const pct = Math.round(ratio * 100);
193
221
  const bar = progressBar(ratio);
194
222
  const emoji = pct >= 85 ? "\u26A0\uFE0F" : "\u{1F4CA}";
195
- return `${emoji} ${formatTokens(tokensUsed)} / ${formatTokens(contextSize)} tokens
223
+ let text = `${emoji} ${formatTokens(tokensUsed)} / ${formatTokens(contextSize)} tokens
196
224
  ${bar} ${pct}%`;
225
+ if (cost != null) text += `
226
+ \u{1F4B0} $${cost.toFixed(2)}`;
227
+ return text;
197
228
  }
198
229
  function splitMessage2(text, maxLength = 1800) {
199
230
  return splitMessage(text, maxLength);
@@ -548,8 +579,8 @@ var UsageMessage = class {
548
579
  this.sendQueue = sendQueue;
549
580
  }
550
581
  message;
551
- async send(usage) {
552
- const text = formatUsage(usage);
582
+ async send(usage, verbosity = "medium") {
583
+ const text = formatUsage(usage, verbosity);
553
584
  const embed = new EmbedBuilder().setDescription(text);
554
585
  try {
555
586
  if (this.message) {
@@ -573,10 +604,7 @@ var UsageMessage = class {
573
604
  const msg = this.message;
574
605
  this.message = void 0;
575
606
  try {
576
- await this.sendQueue.enqueue(
577
- () => msg.delete(),
578
- { type: "other" }
579
- );
607
+ await this.sendQueue.enqueue(() => msg.delete(), { type: "other" });
580
608
  } catch (err) {
581
609
  log.warn({ err }, "[UsageMessage] delete() failed");
582
610
  }
@@ -593,6 +621,10 @@ var PlanCard = class {
593
621
  latestEntries;
594
622
  lastSentText;
595
623
  flushTimer;
624
+ verbosity = "medium";
625
+ setVerbosity(v) {
626
+ this.verbosity = v;
627
+ }
596
628
  update(entries) {
597
629
  this.latestEntries = entries;
598
630
  if (this.flushTimer) clearTimeout(this.flushTimer);
@@ -621,7 +653,7 @@ var PlanCard = class {
621
653
  }
622
654
  async _flush() {
623
655
  if (!this.latestEntries) return;
624
- const text = formatPlan(this.latestEntries);
656
+ const text = formatPlan(this.latestEntries, this.verbosity);
625
657
  if (this.message && text === this.lastSentText) return;
626
658
  this.lastSentText = text;
627
659
  const embed = new EmbedBuilder().setDescription(text);
@@ -675,14 +707,15 @@ var ActivityTracker = class {
675
707
  this.thinking.dismiss();
676
708
  this.thinking.reset();
677
709
  }
678
- async onPlan(entries) {
710
+ async onPlan(entries, verbosity) {
679
711
  await this._firstEventGuard();
680
712
  this.thinking.dismiss();
681
713
  this.hasPlanCard = true;
714
+ if (verbosity) this.planCard.setVerbosity(verbosity);
682
715
  this.planCard.update(entries);
683
716
  }
684
- async sendUsage(usage) {
685
- await this.usage.send(usage);
717
+ async sendUsage(usage, verbosity = "medium") {
718
+ await this.usage.send(usage, verbosity);
686
719
  }
687
720
  async cleanup() {
688
721
  this.thinking.dismiss();
@@ -1583,7 +1616,10 @@ var DiscordAdapter = class extends ChannelAdapter {
1583
1616
  this.draftManager = new DraftManager(this.sendQueue);
1584
1617
  this.fileService = core.fileService;
1585
1618
  this.client.rest.on("rateLimited", (info) => {
1586
- log.warn({ route: info.route, timeToReset: info.timeToReset }, "[DiscordAdapter] Rate limited");
1619
+ log.warn(
1620
+ { route: info.route, timeToReset: info.timeToReset },
1621
+ "[DiscordAdapter] Rate limited"
1622
+ );
1587
1623
  this.sendQueue.onRateLimited();
1588
1624
  });
1589
1625
  }
@@ -1592,13 +1628,18 @@ var DiscordAdapter = class extends ChannelAdapter {
1592
1628
  return new Promise((resolve, reject) => {
1593
1629
  this.client.once("ready", async () => {
1594
1630
  try {
1595
- log.info({ guildId: this.discordConfig.guildId }, "[DiscordAdapter] Client ready, initializing...");
1631
+ log.info(
1632
+ { guildId: this.discordConfig.guildId },
1633
+ "[DiscordAdapter] Client ready, initializing..."
1634
+ );
1596
1635
  const guild = this.client.guilds.cache.get(this.discordConfig.guildId) ?? await this.client.guilds.fetch(this.discordConfig.guildId).catch(() => null);
1597
1636
  if (!guild) {
1598
1637
  throw new Error(`Guild not found: ${this.discordConfig.guildId}`);
1599
1638
  }
1600
1639
  this.guild = guild;
1601
- const saveConfig = (updates) => this.core.configManager.save(updates);
1640
+ const saveConfig = (updates) => this.core.configManager.save(
1641
+ updates
1642
+ );
1602
1643
  const { forumChannel, notificationChannel } = await ensureForums(
1603
1644
  guild,
1604
1645
  {
@@ -1609,7 +1650,10 @@ var DiscordAdapter = class extends ChannelAdapter {
1609
1650
  );
1610
1651
  this.forumChannel = forumChannel;
1611
1652
  this.notificationChannel = notificationChannel;
1612
- this.skillManager = new SkillCommandManager(this.sendQueue, this.core.sessionManager);
1653
+ this.skillManager = new SkillCommandManager(
1654
+ this.sendQueue,
1655
+ this.core.sessionManager
1656
+ );
1613
1657
  this.permissionHandler = new PermissionHandler(
1614
1658
  guild.id,
1615
1659
  (sessionId) => this.core.sessionManager.getSession(sessionId),
@@ -1622,7 +1666,10 @@ var DiscordAdapter = class extends ChannelAdapter {
1622
1666
  try {
1623
1667
  await this.notificationChannel.send(welcomeMsg);
1624
1668
  } catch (err) {
1625
- log.warn({ err }, "[DiscordAdapter] Failed to send welcome message");
1669
+ log.warn(
1670
+ { err },
1671
+ "[DiscordAdapter] Failed to send welcome message"
1672
+ );
1626
1673
  }
1627
1674
  await this.setupAssistant();
1628
1675
  log.info("[DiscordAdapter] Initialization complete");
@@ -1641,7 +1688,10 @@ var DiscordAdapter = class extends ChannelAdapter {
1641
1688
  try {
1642
1689
  await this.assistantSession.destroy();
1643
1690
  } catch (err) {
1644
- log.warn({ err }, "[DiscordAdapter] Failed to destroy assistant session");
1691
+ log.warn(
1692
+ { err },
1693
+ "[DiscordAdapter] Failed to destroy assistant session"
1694
+ );
1645
1695
  }
1646
1696
  this.assistantSession = null;
1647
1697
  }
@@ -1679,7 +1729,12 @@ var DiscordAdapter = class extends ChannelAdapter {
1679
1729
  const userId = message.author.id;
1680
1730
  let text = message.content;
1681
1731
  log.debug(
1682
- { threadId, userId, text: text.slice(0, 50), attachmentCount: message.attachments.size },
1732
+ {
1733
+ threadId,
1734
+ userId,
1735
+ text: text.slice(0, 50),
1736
+ attachmentCount: message.attachments.size
1737
+ },
1683
1738
  "[DiscordAdapter] messageCreate received"
1684
1739
  );
1685
1740
  if (!text && message.attachments.size === 0) return;
@@ -1698,7 +1753,10 @@ var DiscordAdapter = class extends ChannelAdapter {
1698
1753
  "[discord-media] Processing incoming attachments"
1699
1754
  );
1700
1755
  }
1701
- const attachments = await this.processIncomingAttachments(message, sessionId);
1756
+ const attachments = await this.processIncomingAttachments(
1757
+ message,
1758
+ sessionId
1759
+ );
1702
1760
  if (!text && attachments.length > 0) {
1703
1761
  text = buildFallbackText(attachments);
1704
1762
  }
@@ -1711,7 +1769,10 @@ var DiscordAdapter = class extends ChannelAdapter {
1711
1769
  }
1712
1770
  if (this.discordConfig.assistantThreadId && threadId === this.discordConfig.assistantThreadId) {
1713
1771
  if (this.assistantSession && text) {
1714
- await this.assistantSession.enqueuePrompt(text, attachments.length > 0 ? attachments : void 0);
1772
+ await this.assistantSession.enqueuePrompt(
1773
+ text,
1774
+ attachments.length > 0 ? attachments : void 0
1775
+ );
1715
1776
  }
1716
1777
  return;
1717
1778
  }
@@ -1734,14 +1795,25 @@ var DiscordAdapter = class extends ChannelAdapter {
1734
1795
  try {
1735
1796
  const existing = this.guild.channels.cache.get(threadId) ?? await this.guild.channels.fetch(threadId);
1736
1797
  if (existing && existing.isThread()) {
1737
- await ensureUnarchived(existing);
1738
- log.info({ threadId }, "[DiscordAdapter] Reusing existing assistant thread");
1798
+ await ensureUnarchived(
1799
+ existing
1800
+ );
1801
+ log.info(
1802
+ { threadId },
1803
+ "[DiscordAdapter] Reusing existing assistant thread"
1804
+ );
1739
1805
  } else {
1740
- log.warn({ threadId }, "[DiscordAdapter] Assistant thread not found, recreating...");
1806
+ log.warn(
1807
+ { threadId },
1808
+ "[DiscordAdapter] Assistant thread not found, recreating..."
1809
+ );
1741
1810
  threadId = null;
1742
1811
  }
1743
1812
  } catch {
1744
- log.warn({ threadId }, "[DiscordAdapter] Assistant thread inaccessible, recreating...");
1813
+ log.warn(
1814
+ { threadId },
1815
+ "[DiscordAdapter] Assistant thread inaccessible, recreating..."
1816
+ );
1745
1817
  threadId = null;
1746
1818
  }
1747
1819
  }
@@ -1795,7 +1867,10 @@ var DiscordAdapter = class extends ChannelAdapter {
1795
1867
  fileName = "voice.wav";
1796
1868
  mimeType = "audio/wav";
1797
1869
  } catch (err) {
1798
- log.warn({ err }, "[discord-media] OGG\u2192WAV conversion failed, saving original");
1870
+ log.warn(
1871
+ { err },
1872
+ "[discord-media] OGG\u2192WAV conversion failed, saving original"
1873
+ );
1799
1874
  }
1800
1875
  }
1801
1876
  return this.fileService.saveFile(sessionId, fileName, data, mimeType);
@@ -1803,10 +1878,18 @@ var DiscordAdapter = class extends ChannelAdapter {
1803
1878
  );
1804
1879
  const rejected = results.filter((r) => r.status === "rejected");
1805
1880
  if (rejected.length > 0) {
1806
- log.warn({ rejected: rejected.map((r) => r.reason) }, "[discord-media] Some attachments failed");
1881
+ log.warn(
1882
+ { rejected: rejected.map((r) => r.reason) },
1883
+ "[discord-media] Some attachments failed"
1884
+ );
1807
1885
  }
1808
- const saved = results.filter((r) => r.status === "fulfilled").map((r) => r.value).filter((att) => att !== null);
1809
- log.info({ count: saved.length, files: saved.map((a) => a.fileName) }, "[discord-media] Attachments processed");
1886
+ const saved = results.filter(
1887
+ (r) => r.status === "fulfilled"
1888
+ ).map((r) => r.value).filter((att) => att !== null);
1889
+ log.info(
1890
+ { count: saved.length, files: saved.map((a) => a.fileName) },
1891
+ "[discord-media] Attachments processed"
1892
+ );
1810
1893
  return saved;
1811
1894
  }
1812
1895
  // ─── Helper: resolve thread ───────────────────────────────────────────────
@@ -1820,17 +1903,26 @@ var DiscordAdapter = class extends ChannelAdapter {
1820
1903
  try {
1821
1904
  const channel = this.guild.channels.cache.get(threadId) ?? await this.guild.channels.fetch(threadId);
1822
1905
  if (channel && channel.isThread()) return channel;
1823
- log.warn({ sessionId, threadId }, "[DiscordAdapter] Channel is not a thread");
1906
+ log.warn(
1907
+ { sessionId, threadId },
1908
+ "[DiscordAdapter] Channel is not a thread"
1909
+ );
1824
1910
  return null;
1825
1911
  } catch (err) {
1826
- log.warn({ err, sessionId, threadId }, "[DiscordAdapter] Failed to fetch thread");
1912
+ log.warn(
1913
+ { err, sessionId, threadId },
1914
+ "[DiscordAdapter] Failed to fetch thread"
1915
+ );
1827
1916
  return null;
1828
1917
  }
1829
1918
  }
1830
1919
  // ─── Helper: get or create activity tracker ──────────────────────────────
1831
1920
  getOrCreateTracker(sessionId, thread) {
1832
1921
  if (!this.sessionTrackers.has(sessionId)) {
1833
- this.sessionTrackers.set(sessionId, new ActivityTracker(thread, this.sendQueue));
1922
+ this.sessionTrackers.set(
1923
+ sessionId,
1924
+ new ActivityTracker(thread, this.sendQueue)
1925
+ );
1834
1926
  }
1835
1927
  return this.sessionTrackers.get(sessionId);
1836
1928
  }
@@ -1856,42 +1948,71 @@ var DiscordAdapter = class extends ChannelAdapter {
1856
1948
  if (noiseAction === "collapse" && this.verbosity === "low") return;
1857
1949
  const tracker = this.getOrCreateTracker(ctx.sessionId, ctx.thread);
1858
1950
  await tracker.onToolCall();
1859
- await this.draftManager.finalize(ctx.sessionId, ctx.thread, ctx.isAssistant);
1860
- await this.toolTracker.trackNewCall(ctx.sessionId, ctx.thread, {
1861
- id: String(meta.id ?? ""),
1862
- name: toolName,
1863
- kind: meta.kind,
1864
- status: String(meta.status ?? "running"),
1865
- content: meta.content,
1866
- viewerLinks: meta.viewerLinks,
1867
- viewerFilePath: meta.viewerFilePath
1868
- }, this.verbosity);
1951
+ await this.draftManager.finalize(
1952
+ ctx.sessionId,
1953
+ ctx.thread,
1954
+ ctx.isAssistant
1955
+ );
1956
+ await this.toolTracker.trackNewCall(
1957
+ ctx.sessionId,
1958
+ ctx.thread,
1959
+ {
1960
+ id: String(meta.id ?? ""),
1961
+ name: toolName,
1962
+ kind: meta.kind,
1963
+ status: String(meta.status ?? "running"),
1964
+ content: meta.content,
1965
+ rawInput: meta.rawInput,
1966
+ viewerLinks: meta.viewerLinks,
1967
+ viewerFilePath: meta.viewerFilePath,
1968
+ displaySummary: meta.displaySummary,
1969
+ displayTitle: meta.displayTitle,
1970
+ displayKind: meta.displayKind
1971
+ },
1972
+ this.verbosity
1973
+ );
1869
1974
  },
1870
1975
  onToolUpdate: async (ctx, content) => {
1871
1976
  const meta = content.metadata ?? {};
1872
- await this.toolTracker.updateCall(ctx.sessionId, {
1873
- id: String(meta.id ?? ""),
1874
- name: content.text || String(meta.name ?? ""),
1875
- kind: meta.kind,
1876
- status: String(meta.status ?? "completed"),
1877
- content: meta.content,
1878
- viewerLinks: meta.viewerLinks,
1879
- viewerFilePath: meta.viewerFilePath
1880
- }, this.verbosity);
1977
+ await this.toolTracker.updateCall(
1978
+ ctx.sessionId,
1979
+ {
1980
+ id: String(meta.id ?? ""),
1981
+ name: content.text || String(meta.name ?? ""),
1982
+ kind: meta.kind,
1983
+ status: String(meta.status ?? "completed"),
1984
+ content: meta.content,
1985
+ rawInput: meta.rawInput,
1986
+ viewerLinks: meta.viewerLinks,
1987
+ viewerFilePath: meta.viewerFilePath,
1988
+ displaySummary: meta.displaySummary,
1989
+ displayTitle: meta.displayTitle,
1990
+ displayKind: meta.displayKind
1991
+ },
1992
+ this.verbosity
1993
+ );
1881
1994
  },
1882
1995
  onPlan: async (ctx, content) => {
1883
1996
  const entries = content.metadata?.entries ?? [];
1884
1997
  const tracker = this.getOrCreateTracker(ctx.sessionId, ctx.thread);
1885
- await tracker.onPlan(entries);
1998
+ await tracker.onPlan(entries, this.verbosity);
1886
1999
  },
1887
2000
  onUsage: async (ctx, content) => {
1888
- await this.draftManager.finalize(ctx.sessionId, ctx.thread, ctx.isAssistant);
2001
+ await this.draftManager.finalize(
2002
+ ctx.sessionId,
2003
+ ctx.thread,
2004
+ ctx.isAssistant
2005
+ );
1889
2006
  const meta = content.metadata ?? {};
1890
2007
  const tracker = this.getOrCreateTracker(ctx.sessionId, ctx.thread);
1891
- await tracker.sendUsage({
1892
- tokensUsed: meta.tokensUsed,
1893
- contextSize: meta.contextSize
1894
- });
2008
+ await tracker.sendUsage(
2009
+ {
2010
+ tokensUsed: meta.tokensUsed,
2011
+ contextSize: meta.contextSize,
2012
+ cost: meta.cost
2013
+ },
2014
+ this.verbosity
2015
+ );
1895
2016
  try {
1896
2017
  const deepLink = buildDeepLink(this.guild.id, ctx.thread.id);
1897
2018
  await this.sendNotification({
@@ -1904,7 +2025,11 @@ var DiscordAdapter = class extends ChannelAdapter {
1904
2025
  }
1905
2026
  },
1906
2027
  onSessionEnd: async (ctx, _content) => {
1907
- await this.draftManager.finalize(ctx.sessionId, ctx.thread, ctx.isAssistant);
2028
+ await this.draftManager.finalize(
2029
+ ctx.sessionId,
2030
+ ctx.thread,
2031
+ ctx.isAssistant
2032
+ );
1908
2033
  const tracker = this.getOrCreateTracker(ctx.sessionId, ctx.thread);
1909
2034
  await tracker.cleanup();
1910
2035
  this.toolTracker.cleanup(ctx.sessionId);
@@ -1919,7 +2044,11 @@ var DiscordAdapter = class extends ChannelAdapter {
1919
2044
  }
1920
2045
  },
1921
2046
  onError: async (ctx, content) => {
1922
- await this.draftManager.finalize(ctx.sessionId, ctx.thread, ctx.isAssistant);
2047
+ await this.draftManager.finalize(
2048
+ ctx.sessionId,
2049
+ ctx.thread,
2050
+ ctx.isAssistant
2051
+ );
1923
2052
  const tracker = this.getOrCreateTracker(ctx.sessionId, ctx.thread);
1924
2053
  await tracker.cleanup();
1925
2054
  this.toolTracker.cleanup(ctx.sessionId);
@@ -1935,12 +2064,25 @@ var DiscordAdapter = class extends ChannelAdapter {
1935
2064
  onAttachment: async (ctx, content) => {
1936
2065
  if (!content.attachment) return;
1937
2066
  const { attachment } = content;
1938
- await this.draftManager.finalize(ctx.sessionId, ctx.thread, ctx.isAssistant);
2067
+ await this.draftManager.finalize(
2068
+ ctx.sessionId,
2069
+ ctx.thread,
2070
+ ctx.isAssistant
2071
+ );
1939
2072
  if (isAttachmentTooLarge(attachment.size)) {
1940
- log.warn({ sessionId: ctx.sessionId, fileName: attachment.fileName, size: attachment.size }, "[discord-media] File too large (>25MB)");
2073
+ log.warn(
2074
+ {
2075
+ sessionId: ctx.sessionId,
2076
+ fileName: attachment.fileName,
2077
+ size: attachment.size
2078
+ },
2079
+ "[discord-media] File too large (>25MB)"
2080
+ );
1941
2081
  try {
1942
2082
  await this.sendQueue.enqueue(
1943
- () => ctx.thread.send({ content: `\u26A0\uFE0F File too large to send (${Math.round(attachment.size / 1024 / 1024)}MB): ${attachment.fileName}` }),
2083
+ () => ctx.thread.send({
2084
+ content: `\u26A0\uFE0F File too large to send (${Math.round(attachment.size / 1024 / 1024)}MB): ${attachment.fileName}`
2085
+ }),
1944
2086
  { type: "other" }
1945
2087
  );
1946
2088
  } catch {
@@ -1949,7 +2091,11 @@ var DiscordAdapter = class extends ChannelAdapter {
1949
2091
  }
1950
2092
  try {
1951
2093
  await this.sendQueue.enqueue(
1952
- () => ctx.thread.send({ files: [{ attachment: attachment.filePath, name: attachment.fileName }] }),
2094
+ () => ctx.thread.send({
2095
+ files: [
2096
+ { attachment: attachment.filePath, name: attachment.fileName }
2097
+ ]
2098
+ }),
1953
2099
  { type: "other" }
1954
2100
  );
1955
2101
  if (attachment.type === "audio") {
@@ -1960,7 +2106,10 @@ var DiscordAdapter = class extends ChannelAdapter {
1960
2106
  }
1961
2107
  }
1962
2108
  } catch (err) {
1963
- log.error({ err, sessionId: ctx.sessionId, fileName: attachment.fileName }, "[discord-media] Failed to send attachment");
2109
+ log.error(
2110
+ { err, sessionId: ctx.sessionId, fileName: attachment.fileName },
2111
+ "[discord-media] Failed to send attachment"
2112
+ );
1964
2113
  }
1965
2114
  },
1966
2115
  onSystemMessage: async (ctx, content) => {
@@ -1989,12 +2138,19 @@ var DiscordAdapter = class extends ChannelAdapter {
1989
2138
  async sendPermissionRequest(sessionId, request) {
1990
2139
  const session = this.core.sessionManager.getSession(sessionId);
1991
2140
  if (!session) {
1992
- log.warn({ sessionId }, "[DiscordAdapter] sendPermissionRequest: session not found");
2141
+ log.warn(
2142
+ { sessionId },
2143
+ "[DiscordAdapter] sendPermissionRequest: session not found"
2144
+ );
1993
2145
  return;
1994
2146
  }
1995
2147
  const thread = await this.getThread(sessionId);
1996
2148
  if (!thread) return;
1997
- await this.permissionHandler.sendPermissionRequest(session, request, thread);
2149
+ await this.permissionHandler.sendPermissionRequest(
2150
+ session,
2151
+ request,
2152
+ thread
2153
+ );
1998
2154
  }
1999
2155
  // ─── sendNotification ─────────────────────────────────────────────────────
2000
2156
  async sendNotification(notification) {
@@ -2080,4 +2236,4 @@ ${notification.deepLink}`;
2080
2236
  export {
2081
2237
  DiscordAdapter
2082
2238
  };
2083
- //# sourceMappingURL=discord-7IVQKB2H.js.map
2239
+ //# sourceMappingURL=discord-OMC52Y54.js.map