@friendlyrobot/discord-pi-agent 0.9.5 → 0.9.6

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.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Print a text body to stdout with ASCII fences.
3
+ * Useful for ad-hoc debug output that stands out in logs.
4
+ *
5
+ * @param body The text content to print.
6
+ * @param title Optional label for the opening fence (defaults to "DEBUG").
7
+ */
8
+ export declare function debugPrint(body: string, title?: string): void;
package/dist/index.js CHANGED
@@ -39,6 +39,19 @@ function createModuleLogger(moduleName) {
39
39
  return logger.child({ module: moduleName });
40
40
  }
41
41
 
42
+ // src/debug-print.ts
43
+ function debugPrint(body, title) {
44
+ const label = title ?? "DEBUG";
45
+ const fence = "=".repeat(label.length + 12);
46
+ console.info(`${fence}
47
+ ===== ${label} =====
48
+ ${fence}`);
49
+ console.info(body);
50
+ console.info(`${fence}
51
+ ===== END =====
52
+ ${fence}`);
53
+ }
54
+
42
55
  // src/markdown-table-transformer.ts
43
56
  import { Lexer } from "marked";
44
57
  var logger2 = createModuleLogger("markdown-table-transformer");
@@ -101,7 +114,7 @@ async function collectReply(session, prompt, options = {}) {
101
114
  let toolCount = 0;
102
115
  let sawAgentEnd = false;
103
116
  const model = session.model ? `${session.model.provider}/${session.model.id}` : "none";
104
- console.info(prompt);
117
+ debugPrint(prompt, "Full Prompt");
105
118
  logger3.debug({
106
119
  logPrefix,
107
120
  promptLength: prompt.length,
@@ -154,11 +167,8 @@ async function collectReply(session, prompt, options = {}) {
154
167
  }
155
168
  if (finalText) {
156
169
  const transformed = await transformMarkdownTablesToCodeBlocks(finalText);
157
- console.info(`========== BEFORE ==========`);
158
- console.info(finalText);
159
- console.info(`========== TRANSFORMED ==========`);
160
- console.info(transformed);
161
- console.info(`========== END ==========`);
170
+ debugPrint(finalText, "BEFORE");
171
+ debugPrint(transformed, "TRANSFORMED");
162
172
  return transformed;
163
173
  }
164
174
  return "No response generated.";
@@ -1027,21 +1037,17 @@ async function sendReply(message, text) {
1027
1037
  }, "reply skipped, channel not sendable");
1028
1038
  return;
1029
1039
  }
1040
+ debugPrint(text, "Full Reply");
1030
1041
  const chunks = chunkMessage(text);
1031
- logger5.debug("sending reply");
1032
1042
  const [firstChunk, ...remainingChunks] = chunks;
1033
1043
  if (!firstChunk) {
1034
1044
  return;
1035
1045
  }
1036
1046
  try {
1037
- console.info("=== Reply Start ===");
1038
1047
  await message.reply(firstChunk);
1039
- console.info(firstChunk);
1040
1048
  for (const chunk of remainingChunks) {
1041
- console.info(chunk);
1042
1049
  await channel.send(chunk);
1043
1050
  }
1044
- console.info("=== Reply End ===");
1045
1051
  } catch (error) {
1046
1052
  logger5.error({
1047
1053
  messageId: message.id,
@@ -1188,10 +1194,6 @@ async function onMessage(message, config, agentService, sessionRegistry, authCon
1188
1194
  let response;
1189
1195
  try {
1190
1196
  response = await promptQueue.enqueue(async () => {
1191
- logger5.debug({
1192
- messageId: message.id,
1193
- scope
1194
- }, "processing message");
1195
1197
  const promptContent = buildDiscordPromptContent(message, scope, content, config);
1196
1198
  const transformedPrompt = await config.promptTransform(promptContent);
1197
1199
  return collectReply(session, transformedPrompt, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@friendlyrobot/discord-pi-agent",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Reusable Discord gateway bridge for persistent pi agent sessions",
5
5
  "license": "MIT",
6
6
  "type": "module",