@friendlyrobot/discord-pi-agent 0.9.5 → 0.9.7

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,15 @@ 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 + 8);
46
+ console.info(`${fence} ${label} ${fence}`);
47
+ console.info(body);
48
+ console.info(`${fence} END ${fence}`);
49
+ }
50
+
42
51
  // src/markdown-table-transformer.ts
43
52
  import { Lexer } from "marked";
44
53
  var logger2 = createModuleLogger("markdown-table-transformer");
@@ -101,7 +110,7 @@ async function collectReply(session, prompt, options = {}) {
101
110
  let toolCount = 0;
102
111
  let sawAgentEnd = false;
103
112
  const model = session.model ? `${session.model.provider}/${session.model.id}` : "none";
104
- console.info(prompt);
113
+ debugPrint(prompt, "Full Prompt");
105
114
  logger3.debug({
106
115
  logPrefix,
107
116
  promptLength: prompt.length,
@@ -154,11 +163,8 @@ async function collectReply(session, prompt, options = {}) {
154
163
  }
155
164
  if (finalText) {
156
165
  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 ==========`);
166
+ debugPrint(finalText, "BEFORE");
167
+ debugPrint(transformed, "TRANSFORMED");
162
168
  return transformed;
163
169
  }
164
170
  return "No response generated.";
@@ -1028,20 +1034,15 @@ async function sendReply(message, text) {
1028
1034
  return;
1029
1035
  }
1030
1036
  const chunks = chunkMessage(text);
1031
- logger5.debug("sending reply");
1032
1037
  const [firstChunk, ...remainingChunks] = chunks;
1033
1038
  if (!firstChunk) {
1034
1039
  return;
1035
1040
  }
1036
1041
  try {
1037
- console.info("=== Reply Start ===");
1038
1042
  await message.reply(firstChunk);
1039
- console.info(firstChunk);
1040
1043
  for (const chunk of remainingChunks) {
1041
- console.info(chunk);
1042
1044
  await channel.send(chunk);
1043
1045
  }
1044
- console.info("=== Reply End ===");
1045
1046
  } catch (error) {
1046
1047
  logger5.error({
1047
1048
  messageId: message.id,
@@ -1188,10 +1189,6 @@ async function onMessage(message, config, agentService, sessionRegistry, authCon
1188
1189
  let response;
1189
1190
  try {
1190
1191
  response = await promptQueue.enqueue(async () => {
1191
- logger5.debug({
1192
- messageId: message.id,
1193
- scope
1194
- }, "processing message");
1195
1192
  const promptContent = buildDiscordPromptContent(message, scope, content, config);
1196
1193
  const transformedPrompt = await config.promptTransform(promptContent);
1197
1194
  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.7",
4
4
  "description": "Reusable Discord gateway bridge for persistent pi agent sessions",
5
5
  "license": "MIT",
6
6
  "type": "module",