@townco/agent 0.1.140 → 0.1.141

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.
@@ -110,6 +110,31 @@ function getSourceName(url) {
110
110
  */
111
111
  function extractSourcesFromToolOutput(toolName, rawOutput, toolCallId, sourceCounter) {
112
112
  const sources = [];
113
+ // Check for pre-extracted sources from runner (extracted before compaction)
114
+ // These preserve URLs that may be stripped during LLM compaction
115
+ if (rawOutput._compactionMeta &&
116
+ typeof rawOutput._compactionMeta === "object") {
117
+ const meta = rawOutput._compactionMeta;
118
+ if (meta.preExtractedSources && meta.preExtractedSources.length > 0) {
119
+ logger.info("Using pre-extracted sources from runner", {
120
+ toolName,
121
+ toolCallId,
122
+ sourcesCount: meta.preExtractedSources.length,
123
+ });
124
+ for (const s of meta.preExtractedSources) {
125
+ sources.push({
126
+ id: s.id,
127
+ url: s.url,
128
+ title: s.title,
129
+ toolCallId,
130
+ ...(s.snippet && { snippet: s.snippet }),
131
+ ...(s.favicon && { favicon: s.favicon }),
132
+ ...(s.sourceName && { sourceName: s.sourceName }),
133
+ });
134
+ }
135
+ return sources;
136
+ }
137
+ }
113
138
  // Parse the actual output from the wrapper
114
139
  // The runner wraps results as { content: JSON.stringify(actualResult) }
115
140
  let actualOutput = rawOutput;