@triplef/agent 0.1.2 → 0.1.4

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.
@@ -368,7 +368,7 @@ var TOOL_DESCRIPTIONS = {
368
368
  eodhdIntraday: "Fetch intraday OHLCV bars for an EODHD ticker and return a per-day, per-price-band volume profile as chartData for the client heatmap. Use to render a volume heatmap across fixed price bands.",
369
369
  eodhdNews: "Fetch recent financial news for an EODHD ticker \u2014 headlines, links, sources, publish dates. Use to ground a stock-market answer in what is happening around a company.",
370
370
  eodhdFundamentals: "Fetch company fundamentals for an EODHD ticker \u2014 general info, valuation, and key financial highlights (sector, market cap, P/E, revenue, margins).",
371
- webFetch: "Fetch the full content of a specific URL. Use only when search snippets are insufficient.",
371
+ webFetch: "Fetch the full content of a specific URL (e.g. a search result page) as clean Markdown. Prefer fetching the most relevant search results to ground the answer in full source text rather than relying on snippets alone.",
372
372
  browser_navigate: "Control a real browser: navigate to a URL. Use for interactive browsing \u2014 JS-heavy pages, content behind clicks, tabs, scrolling, or forms \u2014 that static search/fetch cannot reach. Follow up with browser_snapshot to read the page before acting on it.",
373
373
  browser_navigate_back: "Go back to the previous page in the browser history.",
374
374
  browser_snapshot: "Read the current browser page as an accessibility snapshot (structured text with element refs). The primary way to see page content and obtain the refs that browser_click/browser_type need.",
@@ -2652,6 +2652,13 @@ WHEN TO USE TOOLS
2652
2652
  - user asks about a specific product to buy, prices, or best deals \u2192 product template with a *WebSearch tool, shopping search, and reviews search
2653
2653
  - user asks about specific factual entities, specifications, data, statistics \u2192 the enabled *WebSearch tool
2654
2654
 
2655
+ FETCH-AFTER-SEARCH RULES
2656
+ - When you include a *WebSearch tool for factual research (article, news, evaluation, product, or text), also include a fetch tool \u2014 webFetch, serperWebpageScrape, or brightDataWebpageScrape \u2014 to fetch the most relevant result pages (typically 1-3; more when the topic is broad and several pages each add distinct depth).
2657
+ - The fetched full content grounds the answer in source text (not just snippets) and populates the knowledge cache for future turns.
2658
+ - You decide which pages are worth fetching: fetch only pages whose full content would meaningfully improve the answer. Skip fetching for trivial lookups, quick facts, or when the snippets already answer the request completely.
2659
+ - Prefer primary/readable sources \u2014 official sites, documentation, Wikipedia, news articles \u2014 over app stores, forums, and discussion threads, unless the question is specifically about those.
2660
+ - Prefer webFetch for plain pages; use a scrape tool for pages behind anti-bot protection.
2661
+
2655
2662
  MEDIA-TYPE TOOL SELECTION
2656
2663
  When the user explicitly or implicitly requests specific media types, include the corresponding concrete tools (never category names):
2657
2664
  - images, photos, pictures, screenshots, artwork \u2192 include every enabled *ImageSearch tool (e.g. serperImageSearch)
@@ -149,10 +149,17 @@ interface LexiconSelectedChunk {
149
149
  title?: string;
150
150
  content: string;
151
151
  score: number;
152
+ sourceType?: 'content' | 'result';
153
+ }
154
+ interface LexiconSearchResult {
155
+ url: string;
156
+ title?: string;
157
+ snippet: string;
152
158
  }
153
159
  interface LexiconSelectInput {
154
160
  query: string;
155
161
  documents: LexiconSourceDocument[];
162
+ searchResults?: LexiconSearchResult[];
156
163
  budgetChars?: number;
157
164
  partitionScope?: string;
158
165
  }
@@ -896,4 +903,4 @@ declare const videolistSchema: z.ZodObject<{
896
903
  }, z.core.$strip>>>;
897
904
  }, z.core.$strip>;
898
905
 
899
- export { BLOCKED_IMAGE_HOSTS, BLOCKED_URL_HOSTS, BROWSER_TOOL_NAMES, COGNITION_LIMIT_DEFAULT, COGNITION_LIMIT_MAX, COGNITION_LIMIT_MIN, COGNITION_PURGE_BATCH, type ConsolidationVerdict, ConsolidationVerdictSchema, EPISODE_PROBE_LIMIT_DEFAULT, EPISODE_PROBE_LIMIT_MAX, EPISODE_PROBE_LIMIT_MIN, EPISODE_RECENCY_MIDPOINT_DEFAULT, EPISODE_RECENCY_MIDPOINT_MAX, EPISODE_RECENCY_MIDPOINT_MIN, EPISODE_RECENCY_SCALE_SECONDS_DEFAULT, EPISODE_RECENCY_SCALE_SECONDS_MAX, EPISODE_RECENCY_SCALE_SECONDS_MIN, EPISODE_RECENCY_WEIGHT_DEFAULT, EPISODE_RECENCY_WEIGHT_MAX, EPISODE_RECENCY_WEIGHT_MIN, EPISODE_SCORE_THRESHOLD_DEFAULT, EPISODE_SCORE_THRESHOLD_MAX, EPISODE_SCORE_THRESHOLD_MIN, EPISODE_TAGS, EPISODE_TEXT_LIMIT, ExtractionSchema, HERO_VIDEO_TITLE_ISSUE, INSIGHTS_MAX_PER_TURN, INSIGHT_TAGS, INSIGHT_TEXT_LIMIT, type LexiconSelectInput, type LexiconSelectResult, type LexiconSelectedChunk, type LexiconSourceDocument, MEMORY_TOOL_NAMES, type MemoryCognitionProfile, type MemoryExtraction, type MemoryProfileInsight, type MemoryProfileResponse, NON_PAGE_EXTENSIONS, type ProviderConfig, TOOL_DESCRIPTIONS, TOOL_NAMES, type ToolName, VARIANT_NAMES, type VariantName, cardSchema, categorizeTools, clampCognitionLimit, clampEpisodeProbeLimit, clampEpisodeRecencyMidpoint, clampEpisodeRecencyScaleSeconds, clampEpisodeRecencyWeight, clampEpisodeScoreThreshold, compareSchema, createTextItemSchema, deriveSchemaKeys, describeSchema, discardedReferenceSchema, formatZodIssues, galleryItemSchema, hasBlockedImageHost, heroVideoHasTitle, imagelistSchema, internationalCoverageSchema, isAllFieldsNullWipe, isPrivateOrLocalhost, isTrustedImageUrl, isTrustedUrl, markerSchema, memoryProfileResponseSchema, mergeCognitionProfiles, normalizeInsightPath, ocrSchema, parseStoredProfile, productSchema, referenceGalleryItemSchema, referenceLineSchema, relatedStorySchema, safeMediaUrl, safeMediaUrlOrEmpty, safeUrl, safeVideoUrl, safeVideoUrlOrEmpty, shoplistSchema, sourceSchema, stockmarketItemSchema, stockmarketListSchema, summarySchema, videoGalleryItemSchema, videolistSchema };
906
+ export { BLOCKED_IMAGE_HOSTS, BLOCKED_URL_HOSTS, BROWSER_TOOL_NAMES, COGNITION_LIMIT_DEFAULT, COGNITION_LIMIT_MAX, COGNITION_LIMIT_MIN, COGNITION_PURGE_BATCH, type ConsolidationVerdict, ConsolidationVerdictSchema, EPISODE_PROBE_LIMIT_DEFAULT, EPISODE_PROBE_LIMIT_MAX, EPISODE_PROBE_LIMIT_MIN, EPISODE_RECENCY_MIDPOINT_DEFAULT, EPISODE_RECENCY_MIDPOINT_MAX, EPISODE_RECENCY_MIDPOINT_MIN, EPISODE_RECENCY_SCALE_SECONDS_DEFAULT, EPISODE_RECENCY_SCALE_SECONDS_MAX, EPISODE_RECENCY_SCALE_SECONDS_MIN, EPISODE_RECENCY_WEIGHT_DEFAULT, EPISODE_RECENCY_WEIGHT_MAX, EPISODE_RECENCY_WEIGHT_MIN, EPISODE_SCORE_THRESHOLD_DEFAULT, EPISODE_SCORE_THRESHOLD_MAX, EPISODE_SCORE_THRESHOLD_MIN, EPISODE_TAGS, EPISODE_TEXT_LIMIT, ExtractionSchema, HERO_VIDEO_TITLE_ISSUE, INSIGHTS_MAX_PER_TURN, INSIGHT_TAGS, INSIGHT_TEXT_LIMIT, type LexiconSearchResult, type LexiconSelectInput, type LexiconSelectResult, type LexiconSelectedChunk, type LexiconSourceDocument, MEMORY_TOOL_NAMES, type MemoryCognitionProfile, type MemoryExtraction, type MemoryProfileInsight, type MemoryProfileResponse, NON_PAGE_EXTENSIONS, type ProviderConfig, TOOL_DESCRIPTIONS, TOOL_NAMES, type ToolName, VARIANT_NAMES, type VariantName, cardSchema, categorizeTools, clampCognitionLimit, clampEpisodeProbeLimit, clampEpisodeRecencyMidpoint, clampEpisodeRecencyScaleSeconds, clampEpisodeRecencyWeight, clampEpisodeScoreThreshold, compareSchema, createTextItemSchema, deriveSchemaKeys, describeSchema, discardedReferenceSchema, formatZodIssues, galleryItemSchema, hasBlockedImageHost, heroVideoHasTitle, imagelistSchema, internationalCoverageSchema, isAllFieldsNullWipe, isPrivateOrLocalhost, isTrustedImageUrl, isTrustedUrl, markerSchema, memoryProfileResponseSchema, mergeCognitionProfiles, normalizeInsightPath, ocrSchema, parseStoredProfile, productSchema, referenceGalleryItemSchema, referenceLineSchema, relatedStorySchema, safeMediaUrl, safeMediaUrlOrEmpty, safeUrl, safeVideoUrl, safeVideoUrlOrEmpty, shoplistSchema, sourceSchema, stockmarketItemSchema, stockmarketListSchema, summarySchema, videoGalleryItemSchema, videolistSchema };
@@ -110,7 +110,7 @@ var TOOL_DESCRIPTIONS = {
110
110
  eodhdIntraday: "Fetch intraday OHLCV bars for an EODHD ticker and return a per-day, per-price-band volume profile as chartData for the client heatmap. Use to render a volume heatmap across fixed price bands.",
111
111
  eodhdNews: "Fetch recent financial news for an EODHD ticker \u2014 headlines, links, sources, publish dates. Use to ground a stock-market answer in what is happening around a company.",
112
112
  eodhdFundamentals: "Fetch company fundamentals for an EODHD ticker \u2014 general info, valuation, and key financial highlights (sector, market cap, P/E, revenue, margins).",
113
- webFetch: "Fetch the full content of a specific URL. Use only when search snippets are insufficient.",
113
+ webFetch: "Fetch the full content of a specific URL (e.g. a search result page) as clean Markdown. Prefer fetching the most relevant search results to ground the answer in full source text rather than relying on snippets alone.",
114
114
  browser_navigate: "Control a real browser: navigate to a URL. Use for interactive browsing \u2014 JS-heavy pages, content behind clicks, tabs, scrolling, or forms \u2014 that static search/fetch cannot reach. Follow up with browser_snapshot to read the page before acting on it.",
115
115
  browser_navigate_back: "Go back to the previous page in the browser history.",
116
116
  browser_snapshot: "Read the current browser page as an accessibility snapshot (structured text with element refs). The primary way to see page content and obtain the refs that browser_click/browser_type need.",
@@ -669,7 +669,7 @@ function createBrightDataWebpageScrape(deps) {
669
669
  });
670
670
  const content = data.text || "";
671
671
  deps.logger.log(`Bright Data webpage scraped ${content.length} chars from "${url}"`);
672
- return { content, title: "" };
672
+ return { url, content, title: "" };
673
673
  } catch (err) {
674
674
  deps.logger.warn(`Bright Data webpage scrape failed for "${url}": ${String(err)}`);
675
675
  return { content: "", error: String(err) };
@@ -1416,7 +1416,7 @@ function createSerperWebpageScrape(deps) {
1416
1416
  const content = data.text || "";
1417
1417
  const title = data.title || "";
1418
1418
  deps.logger.log(`Serper.dev Webpage scraped ${content.length} chars from "${url}"`);
1419
- return { content, title };
1419
+ return { url, content, title };
1420
1420
  }
1421
1421
  });
1422
1422
  }
@@ -1474,7 +1474,7 @@ function extractArticleText(html) {
1474
1474
  // src/tools/web-fetch/web-fetch.tool.ts
1475
1475
  function createWebFetchTool() {
1476
1476
  return tool({
1477
- description: "Fetch the full content of a specific URL. Returns the main article text as Markdown (boilerplate removed). Use only when search snippets are insufficient.",
1477
+ description: "Fetch the full content of a specific URL (e.g. a search result page). Returns the main article text as Markdown (boilerplate removed). Prefer fetching the most relevant search results to ground the answer in full source text.",
1478
1478
  inputSchema: webFetchSchema,
1479
1479
  execute: async ({ url }) => {
1480
1480
  const response = await fetchWithTimeout(
@@ -1488,7 +1488,7 @@ function createWebFetchTool() {
1488
1488
  { timeoutMs: SEARCH_TIMEOUT_MS }
1489
1489
  );
1490
1490
  const html = await response.text();
1491
- return { content: extractArticleText(html) };
1491
+ return { url, content: extractArticleText(html) };
1492
1492
  }
1493
1493
  });
1494
1494
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@triplef/agent",
3
3
  "description": "tripleF (3F) agent domain — structured-output schemas, prompt builders, and model tools shared across the apps.",
4
- "version": "0.1.2",
4
+ "version": "0.1.4",
5
5
  "packageManager": "pnpm@11.24.0",
6
6
  "license": "MIT",
7
7
  "type": "module",