@friendlyrobot/discord-pi-agent 0.10.1 → 0.10.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 +17 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -109,11 +109,6 @@ async function collectReply(session, prompt, options = {}) {
109
109
  let toolCount = 0;
110
110
  const model = session.model ? `${session.model.provider}/${session.model.id}` : "none";
111
111
  debugPrint(prompt, "Full Prompt");
112
- logger3.debug({
113
- promptLength: prompt.length,
114
- model,
115
- prompt
116
- }, "prompt start");
117
112
  const unsubscribe = session.subscribe((event) => {
118
113
  eventCount += 1;
119
114
  if (event.type === "message_update") {
@@ -133,7 +128,7 @@ async function collectReply(session, prompt, options = {}) {
133
128
  logger3.debug({
134
129
  toolName: event.toolName,
135
130
  isError: event.isError,
136
- output: event.result
131
+ output: truncateForLog(extractToolOutput(event.result))
137
132
  }, `tool end: [${event.toolName}]`);
138
133
  }
139
134
  if (event.type === "agent_end") {
@@ -164,6 +159,22 @@ async function collectReply(session, prompt, options = {}) {
164
159
  }
165
160
  return "No response generated.";
166
161
  }
162
+ function truncateForLog(value, maxLength = 400) {
163
+ if (value.length <= maxLength) {
164
+ return value;
165
+ }
166
+ return `${value.slice(0, maxLength)}...`;
167
+ }
168
+ function extractToolOutput(output) {
169
+ if (typeof output === "string") {
170
+ return output;
171
+ }
172
+ try {
173
+ return JSON.stringify(output);
174
+ } catch {
175
+ return String(output);
176
+ }
177
+ }
167
178
  function getLatestAssistantText(messages) {
168
179
  const latestAssistantMessage = [...messages].reverse().find((message) => {
169
180
  return message.role === "assistant";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@friendlyrobot/discord-pi-agent",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "Reusable Discord gateway bridge for persistent pi agent sessions",
5
5
  "license": "MIT",
6
6
  "type": "module",