@triplef/agent 0.1.2 → 0.1.3

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.
@@ -1,5 +1,5 @@
1
- import { T as TemplateName, F as FormatZodShapeOptions } from '../intent.schema-BbIiFHUW.js';
2
- export { D as DEFAULT_VARIANT_ID } from '../intent.schema-BbIiFHUW.js';
1
+ import { T as TemplateName, F as FormatZodShapeOptions } from '../intent.schema-BFsi1OVf.js';
2
+ export { D as DEFAULT_VARIANT_ID } from '../intent.schema-BFsi1OVf.js';
3
3
  import * as zod from 'zod';
4
4
  import { z, ZodTypeAny, ZodType } from 'zod';
5
5
  import * as zod_v4_core from 'zod/v4/core';
@@ -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,12 @@ 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 1-3 most relevant result pages.
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 webFetch for plain pages; use a scrape tool for pages behind anti-bot protection.
2660
+
2655
2661
  MEDIA-TYPE TOOL SELECTION
2656
2662
  When the user explicitly or implicitly requests specific media types, include the corresponding concrete tools (never category names):
2657
2663
  - images, photos, pictures, screenshots, artwork \u2192 include every enabled *ImageSearch tool (e.g. serperImageSearch)
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- export { D as DEFAULT_VARIANT_ID, F as FormatZodShapeOptions, I as IntentResult, a as IntentSchema, T as TemplateName, f as formatZodShape } from '../intent.schema-BbIiFHUW.js';
2
+ export { D as DEFAULT_VARIANT_ID, F as FormatZodShapeOptions, I as IntentResult, a as IntentSchema, T as TemplateName, f as formatZodShape } from '../intent.schema-BFsi1OVf.js';
3
3
 
4
4
  declare const BLOCKED_IMAGE_HOSTS: Set<string>;
5
5
 
@@ -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.3",
5
5
  "packageManager": "pnpm@11.24.0",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -10,7 +10,6 @@ declare const TEMPLATES: readonly ["article", "news", "describe", "compare", "oc
10
10
  type TemplateName = (typeof TEMPLATES)[number];
11
11
  declare const IntentSchema: z.ZodObject<{
12
12
  template: z.ZodEnum<{
13
- text: "text";
14
13
  article: "article";
15
14
  news: "news";
16
15
  describe: "describe";
@@ -25,6 +24,7 @@ declare const IntentSchema: z.ZodObject<{
25
24
  stockmarketitem: "stockmarketitem";
26
25
  stockmarketlist: "stockmarketlist";
27
26
  merge: "merge";
27
+ text: "text";
28
28
  }>;
29
29
  prompt: z.ZodDefault<z.ZodString>;
30
30
  tools: z.ZodArray<z.ZodEnum<{