@friendlyrobot/discord-pi-agent 0.19.1 → 0.19.2

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -31
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -320,20 +320,17 @@ async function runPromptAndCollectReply(session, prompt, options = {}) {
320
320
  }
321
321
  if (event.type === "tool_execution_start") {
322
322
  toolCount += 1;
323
+ const input = event.toolName === "bash" ? event.args.command : event.args;
323
324
  logger4.debug({
324
325
  toolName: event.toolName,
325
- input: event.toolName === "bash" ? event.args.command : event.args
326
- }, `tool start: [${event.toolName}] `);
326
+ input
327
+ }, `agent tool start: [${event.toolName}] `);
327
328
  }
328
329
  if (event.type === "tool_execution_end") {
329
330
  logger4.debug({
330
331
  toolName: event.toolName,
331
- isError: event.isError,
332
- output: truncateForLog(extractToolOutput(event.result))
333
- }, `tool end: [${event.toolName}]`);
334
- }
335
- if (event.type === "agent_end") {
336
- logger4.debug("agent end");
332
+ isError: event.isError
333
+ }, `agent tool end: [${event.toolName}]`);
337
334
  }
338
335
  });
339
336
  try {
@@ -355,22 +352,6 @@ async function runPromptAndCollectReply(session, prompt, options = {}) {
355
352
  }
356
353
  return "No response generated.";
357
354
  }
358
- function truncateForLog(value, maxLength = 400) {
359
- if (value.length <= maxLength) {
360
- return value;
361
- }
362
- return `${value.slice(0, maxLength)}...`;
363
- }
364
- function extractToolOutput(output) {
365
- if (typeof output === "string") {
366
- return output;
367
- }
368
- try {
369
- return JSON.stringify(output);
370
- } catch {
371
- return String(output);
372
- }
373
- }
374
355
  function getLatestAssistantText(messages) {
375
356
  const latestAssistantMessage = [...messages].reverse().find((message) => {
376
357
  return message.role === "assistant";
@@ -1335,7 +1316,6 @@ async function sendTypingSafe(channel, channelKey) {
1335
1316
  headers: { Authorization: `Bot ${token}` }
1336
1317
  });
1337
1318
  if (response.ok) {
1338
- logger10.debug("[TYPING] STATUS UPDATED OK");
1339
1319
  return;
1340
1320
  }
1341
1321
  if (response.status === 429) {
@@ -1353,19 +1333,18 @@ async function sendTypingSafe(channel, channelKey) {
1353
1333
  method: "POST",
1354
1334
  headers: { Authorization: `Bot ${token}` }
1355
1335
  });
1356
- logger10.info({ channelKey }, "[TYPING] retry done");
1336
+ logger10.warn({ channelKey }, "[TYPING] retry done");
1357
1337
  return;
1358
1338
  }
1359
1339
  logger10.warn({ channelKey, status: response.status }, "[TYPING] unexpected status");
1360
1340
  } catch (error) {
1361
- logger10.warn({ channelKey, error }, "[TYPING] FAILED");
1341
+ logger10.error({ channelKey, error }, "[TYPING] FAILED");
1362
1342
  }
1363
1343
  }
1364
1344
  function startTypingForChannel(channel, channelKey) {
1365
1345
  const existing = typingIntervals.get(channelKey);
1366
1346
  if (existing) {
1367
1347
  existing.refs += 1;
1368
- logger10.debug({ channelKey, refs: existing.refs }, "[TYPING] ref++ (reusing existing interval)");
1369
1348
  return;
1370
1349
  }
1371
1350
  logger10.debug("[TYPING] started new interval");
@@ -1378,17 +1357,14 @@ function startTypingForChannel(channel, channelKey) {
1378
1357
  function stopTypingForChannel(channelKey) {
1379
1358
  const entry = typingIntervals.get(channelKey);
1380
1359
  if (!entry) {
1381
- logger10.debug({ channelKey }, "[TYPING] stop called but no entry found");
1382
1360
  return;
1383
1361
  }
1384
1362
  entry.refs -= 1;
1385
1363
  if (entry.refs <= 0) {
1386
1364
  clearInterval(entry.interval);
1387
1365
  typingIntervals.delete(channelKey);
1388
- logger10.debug("[TYPING] interval cleared (refs hit 0)");
1389
1366
  return;
1390
1367
  }
1391
- logger10.debug("[TYPING] ref-- (interval still active)");
1392
1368
  }
1393
1369
 
1394
1370
  // src/prompt-context.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@friendlyrobot/discord-pi-agent",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "description": "Reusable Discord gateway for persistent pi agent sessions",
5
5
  "license": "MIT",
6
6
  "type": "module",