@triplef/agent 0.1.18 → 0.1.19

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.
@@ -0,0 +1,35 @@
1
+ interface EncyclopediaDocumentInput {
2
+ url: string;
3
+ offset?: number;
4
+ maxChars?: number;
5
+ }
6
+ interface EncyclopediaDocumentResult {
7
+ url: string;
8
+ title?: string;
9
+ domain: string;
10
+ totalChunks: number;
11
+ fromChunk: number;
12
+ toChunk: number;
13
+ hasMore: boolean;
14
+ content: string;
15
+ }
16
+
17
+ interface EncyclopediaSearchInput {
18
+ query: string;
19
+ url?: string;
20
+ domain?: string;
21
+ limit?: number;
22
+ }
23
+ interface EncyclopediaSearchHit {
24
+ url: string;
25
+ title?: string;
26
+ domain: string;
27
+ content: string;
28
+ score: number;
29
+ chunkIndex: number;
30
+ chunkCount: number;
31
+ sourceType: 'content' | 'result';
32
+ fetchedAt: string;
33
+ }
34
+
35
+ export type { EncyclopediaDocumentInput as E, EncyclopediaDocumentResult as a, EncyclopediaSearchHit as b, EncyclopediaSearchInput as c };
@@ -5,6 +5,7 @@ type VariantName = (typeof VARIANT_NAMES)[number];
5
5
  declare const TOOL_DESCRIPTIONS: Record<string, string>;
6
6
  declare const BROWSER_TOOL_NAMES: readonly ["browser_navigate", "browser_navigate_back", "browser_snapshot", "browser_click", "browser_type", "browser_fill_form", "browser_select_option", "browser_press_key", "browser_wait_for", "browser_take_screenshot", "browser_tabs", "browser_console_messages", "browser_network_requests", "browser_verify_element_visible", "browser_verify_text_visible"];
7
7
  declare const MEMORY_TOOL_NAMES: readonly ["memory-partition-remember", "memory-partition-recall", "memory-partition-delete", "memory-cognition-remember", "memory-cognition-forget"];
8
+ declare const ENCYCLOPEDIA_TOOL_NAMES: readonly ["encyclopedia-search", "encyclopedia-read"];
8
9
  declare const TOOL_NAMES: readonly ["webFetch", "brightDataWebSearch", "brightDataImageSearch", "brightDataNewsSearch", "brightDataPlacesSearch", "brightDataShoppingSearch", "brightDataVideoSearch", "brightDataWebpageScrape", "serperWebSearch", "serperImageSearch", "serperNewsSearch", "serperPlacesSearch", "serperShoppingSearch", "serperBusinessReviewsSearch", "serperVideoSearch", "serperWebpageScrape", "youtubeVideoSearch", "eodhdSearch", "eodhdQuote", "eodhdHistory", "eodhdTechnical", "eodhdIntraday", "eodhdNews", "eodhdFundamentals", "requestGrayscale", "requestDenoised", "requestSharpened", "requestClahe", "memory-partition-remember", "memory-partition-recall", "memory-partition-delete", "memory-cognition-remember", "memory-cognition-forget", "browser_navigate", "browser_navigate_back", "browser_snapshot", "browser_click", "browser_type", "browser_fill_form", "browser_select_option", "browser_press_key", "browser_wait_for", "browser_take_screenshot", "browser_tabs", "browser_console_messages", "browser_network_requests", "browser_verify_element_visible", "browser_verify_text_visible"];
9
10
  type ToolName = (typeof TOOL_NAMES)[number];
10
11
  type ProviderConfig = {
@@ -200,4 +201,4 @@ interface FormatZodShapeOptions {
200
201
  }
201
202
  declare function formatZodShape(schema: z.ZodType, options?: FormatZodShapeOptions): string;
202
203
 
203
- export { BROWSER_TOOL_NAMES as B, DEFAULT_VARIANT_ID as D, type FormatZodShapeOptions as F, type IntentResult as I, MEMORY_TOOL_NAMES as M, type ProviderConfig as P, type TemplateName as T, type VariantName as V, IMAGE_TASK_TEMPLATES as a, type ImageTaskTemplate as b, IntentSchema as c, TOOL_DESCRIPTIONS as d, TOOL_NAMES as e, type ToolName as f, VARIANT_NAMES as g, formatZodShape as h, isImageTaskTemplate as i };
204
+ export { BROWSER_TOOL_NAMES as B, DEFAULT_VARIANT_ID as D, ENCYCLOPEDIA_TOOL_NAMES as E, type FormatZodShapeOptions as F, type IntentResult as I, MEMORY_TOOL_NAMES as M, type ProviderConfig as P, type TemplateName as T, type VariantName as V, IMAGE_TASK_TEMPLATES as a, type ImageTaskTemplate as b, IntentSchema as c, TOOL_DESCRIPTIONS as d, TOOL_NAMES as e, type ToolName as f, VARIANT_NAMES as g, formatZodShape as h, isImageTaskTemplate as i };
@@ -1,5 +1,5 @@
1
- import { V as VariantName, I as IntentResult, T as TemplateName, F as FormatZodShapeOptions } from '../format-zod-shape.helper-DTl2uBDp.js';
2
- export { D as DEFAULT_VARIANT_ID } from '../format-zod-shape.helper-DTl2uBDp.js';
1
+ import { V as VariantName, I as IntentResult, T as TemplateName, F as FormatZodShapeOptions } from '../format-zod-shape.helper-BviIexpu.js';
2
+ export { D as DEFAULT_VARIANT_ID } from '../format-zod-shape.helper-BviIexpu.js';
3
3
  import { M as MemoryPoint } from '../memory-point.model-C4wvvjAY.js';
4
4
  import * as zod from 'zod';
5
5
  import { z, ZodTypeAny, ZodType } from 'zod';
@@ -61,6 +61,8 @@ declare function buildClassifyTranscript(messages: Array<{
61
61
  content: string;
62
62
  }>): string | undefined;
63
63
 
64
+ declare function buildCognitionProfileSection(profileJson: string): string | undefined;
65
+
64
66
  declare function buildMemoryProbeSection(points: Array<Pick<MemoryPoint, 'text' | 'role' | 'createdAt'>>): string | undefined;
65
67
 
66
68
  declare function buildCorrectionPrompt(error: string, template?: string, options?: {
@@ -199,6 +201,13 @@ declare function buildMemoryWritePrompt(params: {
199
201
  knownTags?: string[];
200
202
  }): string;
201
203
 
204
+ declare const RESEARCH_TRIAGE_INSTRUCTIONS: string;
205
+ declare function buildResearchTriagePrompt(gaps: Array<{
206
+ url: string;
207
+ title?: string;
208
+ snippet: string;
209
+ }>, maxPayloadChars?: number): string;
210
+
202
211
  declare function buildExtractionPrompt(knownCategories?: readonly string[], knownTags?: readonly string[]): string;
203
212
  declare function buildExtractionCorrectionPrompt(error: string): string;
204
213
 
@@ -368,4 +377,4 @@ declare const verdictSpineSnippet: TemplateSnippet;
368
377
 
369
378
  declare const videoGallerySnippet: TemplateSnippet;
370
379
 
371
- export { COMMONMARK_FORMAT, COMPARE_INSTRUCTIONS, COMPARE_VISUAL_INSTRUCTIONS, CONVICTION_INSTRUCTIONS, type ContentSystemPromptParams, DESCRIBE_CONCISE_INSTRUCTIONS, DESCRIBE_DETAILED_INSTRUCTIONS, DESCRIBE_INSTRUCTIONS, FINAL_REMINDER, FRICTION_INSTRUCTIONS, type FrictionFact, HISTORY_URLS_RULES, IMAGELIST_INSTRUCTIONS, IMAGE_TASK_RULE, INTERNATIONAL_COVERAGE_INSTRUCTIONS, ITEM_SHAPES, JSON_RULES, MEDIA_COUNTS, MEDIA_RULES, MEMORY_CLUSTER_INSTRUCTIONS, MEMORY_CONSOLIDATE_INSTRUCTIONS, MEMORY_PROFILE_INSTRUCTIONS, MEMORY_WRITE_INSTRUCTIONS, MERGE_MEDIA_RULES, MERGE_TOPIC_RULE, MULTIMODAL_POLICY, NOISE_RULES, OCR_INSTRUCTIONS, OCR_VERBATIM_INSTRUCTIONS, PRECEDENCE_RULES, PRODUCT_INSTRUCTIONS, RESPONSE_LAYOUTS, type ResponseLayout, SECURITY_RULES, SHOPLIST_INSTRUCTIONS, SNIPPET_TEMPLATE_PRESETS, SOURCE_TRUTH_RULES, SOURCE_VOICE_RULES, STOCKMARKET_ITEM_INSTRUCTIONS, STOCKMARKET_LIST_INSTRUCTIONS, SUMMARY_INSTRUCTIONS, type SnippetTemplatePreset, type SourcePolicyConfig, type StructuredPromptTemplate, TEMPLATE_VARIANTS, TEXT_CODING_INSTRUCTIONS, TEXT_FAMILIARITY_INSTRUCTIONS, TEXT_INSTRUCTIONS, TOOL_RESULTS_RULES, type TemplateSnippet, VIDEOLIST_INSTRUCTIONS, articlePreset, assessmentListsSnippet, authorMetaSnippet, bodyBriefSnippet, bodyExtensiveSnippet, buildBaseSystemPrompt, buildClarificationTranslationSystemPrompt, buildClarificationTranslationUserPrompt, buildClassifyTranscript, buildClusterSummaryPrompt, buildConsolidatePrompt, buildContentSystemPrompt, buildContextSummarySection, buildConvictionSynthesisPrompt, buildCorrectionPrompt, buildEncyclopediaClassifyPrompt, buildEnrichPrompt, buildExecuteLanguageInstruction, buildExtractionCorrectionPrompt, buildExtractionPrompt, buildFrictionPrompt, buildImageExecutePrompt, buildIntentCorrectionPrompt, buildIntentSelectionPrompt, buildLanguageRule, buildLayoutInstruction, buildLocalizationRule, buildMemoryProbeSection, buildMemoryProfilePrompt, buildMemoryWritePrompt, buildMergeDirective, buildMissingToolsPrompt, buildOutputContract, buildSnippetInstruction, buildSourcePolicyPrompt, buildStockmarketNote, buildStructuredJsonPrompt, buildStructuredPrompt, buildToolExecutePrompt, buildVocabularySection, bylineDatelineSnippet, cardsSnippet, comparisonSchema, comparisonSnippet, composeSnippetKeys, composeSnippetSchema, conclusionSnippet, evaluationPreset, formatCurrentTimestamp, formatProvenanceLine, formatToolAvailabilityCatalog, formatVariantCatalog, gallerySnippet, getSnippetTemplateKeys, getSnippetTemplateSchema, headerArticleSnippet, headerNewsSnippet, heroMediaSnippet, internationalCoverageSnippet, introductionSnippet, isSnippetTemplate, keyFindingsSnippet, languageCorrectionPrompt, leadSnippet, mergePreset, mergedEvaluationsSnippet, newsKeyFindingsSnippet, newsPreset, quoteSnippet, reasoningSnippet, relatedStoriesSnippet, resolveLanguageName, resolveVariantInstructions, responseLayoutSchema, sourcesSnippet, subjectSchema, subjectsSnippet, summarySnippet, verdictSpineSnippet, videoGallerySnippet };
380
+ export { COMMONMARK_FORMAT, COMPARE_INSTRUCTIONS, COMPARE_VISUAL_INSTRUCTIONS, CONVICTION_INSTRUCTIONS, type ContentSystemPromptParams, DESCRIBE_CONCISE_INSTRUCTIONS, DESCRIBE_DETAILED_INSTRUCTIONS, DESCRIBE_INSTRUCTIONS, FINAL_REMINDER, FRICTION_INSTRUCTIONS, type FrictionFact, HISTORY_URLS_RULES, IMAGELIST_INSTRUCTIONS, IMAGE_TASK_RULE, INTERNATIONAL_COVERAGE_INSTRUCTIONS, ITEM_SHAPES, JSON_RULES, MEDIA_COUNTS, MEDIA_RULES, MEMORY_CLUSTER_INSTRUCTIONS, MEMORY_CONSOLIDATE_INSTRUCTIONS, MEMORY_PROFILE_INSTRUCTIONS, MEMORY_WRITE_INSTRUCTIONS, MERGE_MEDIA_RULES, MERGE_TOPIC_RULE, MULTIMODAL_POLICY, NOISE_RULES, OCR_INSTRUCTIONS, OCR_VERBATIM_INSTRUCTIONS, PRECEDENCE_RULES, PRODUCT_INSTRUCTIONS, RESEARCH_TRIAGE_INSTRUCTIONS, RESPONSE_LAYOUTS, type ResponseLayout, SECURITY_RULES, SHOPLIST_INSTRUCTIONS, SNIPPET_TEMPLATE_PRESETS, SOURCE_TRUTH_RULES, SOURCE_VOICE_RULES, STOCKMARKET_ITEM_INSTRUCTIONS, STOCKMARKET_LIST_INSTRUCTIONS, SUMMARY_INSTRUCTIONS, type SnippetTemplatePreset, type SourcePolicyConfig, type StructuredPromptTemplate, TEMPLATE_VARIANTS, TEXT_CODING_INSTRUCTIONS, TEXT_FAMILIARITY_INSTRUCTIONS, TEXT_INSTRUCTIONS, TOOL_RESULTS_RULES, type TemplateSnippet, VIDEOLIST_INSTRUCTIONS, articlePreset, assessmentListsSnippet, authorMetaSnippet, bodyBriefSnippet, bodyExtensiveSnippet, buildBaseSystemPrompt, buildClarificationTranslationSystemPrompt, buildClarificationTranslationUserPrompt, buildClassifyTranscript, buildClusterSummaryPrompt, buildCognitionProfileSection, buildConsolidatePrompt, buildContentSystemPrompt, buildContextSummarySection, buildConvictionSynthesisPrompt, buildCorrectionPrompt, buildEncyclopediaClassifyPrompt, buildEnrichPrompt, buildExecuteLanguageInstruction, buildExtractionCorrectionPrompt, buildExtractionPrompt, buildFrictionPrompt, buildImageExecutePrompt, buildIntentCorrectionPrompt, buildIntentSelectionPrompt, buildLanguageRule, buildLayoutInstruction, buildLocalizationRule, buildMemoryProbeSection, buildMemoryProfilePrompt, buildMemoryWritePrompt, buildMergeDirective, buildMissingToolsPrompt, buildOutputContract, buildResearchTriagePrompt, buildSnippetInstruction, buildSourcePolicyPrompt, buildStockmarketNote, buildStructuredJsonPrompt, buildStructuredPrompt, buildToolExecutePrompt, buildVocabularySection, bylineDatelineSnippet, cardsSnippet, comparisonSchema, comparisonSnippet, composeSnippetKeys, composeSnippetSchema, conclusionSnippet, evaluationPreset, formatCurrentTimestamp, formatProvenanceLine, formatToolAvailabilityCatalog, formatVariantCatalog, gallerySnippet, getSnippetTemplateKeys, getSnippetTemplateSchema, headerArticleSnippet, headerNewsSnippet, heroMediaSnippet, internationalCoverageSnippet, introductionSnippet, isSnippetTemplate, keyFindingsSnippet, languageCorrectionPrompt, leadSnippet, mergePreset, mergedEvaluationsSnippet, newsKeyFindingsSnippet, newsPreset, quoteSnippet, reasoningSnippet, relatedStoriesSnippet, resolveLanguageName, resolveVariantInstructions, responseLayoutSchema, sourcesSnippet, subjectSchema, subjectsSnippet, summarySnippet, verdictSpineSnippet, videoGallerySnippet };
@@ -2754,6 +2754,16 @@ ${lines.join("\n")}
2754
2754
  </conversation-history>`;
2755
2755
  }
2756
2756
 
2757
+ // src/prompts/harness/interpret/cognition-profile-section.prompt.ts
2758
+ var COGNITION_PROFILE_CHAR_LIMIT = 2e3;
2759
+ function buildCognitionProfileSection(profileJson) {
2760
+ const trimmed = profileJson.trim();
2761
+ if (!trimmed) return void 0;
2762
+ const capped = trimmed.length > COGNITION_PROFILE_CHAR_LIMIT ? `${trimmed.slice(0, COGNITION_PROFILE_CHAR_LIMIT)}\u2026` : trimmed;
2763
+ return `COGNITION PROFILE \u2014 YOUR accumulated understanding of this user: your own derived conclusions (traits, interests, standing context), not their verbatim statements. Use it to resolve what the user is referring to and to shape tool choices; never treat it as the current request itself.
2764
+ ${capped}`;
2765
+ }
2766
+
2757
2767
  // src/prompts/memory/format-provenance-line.helper.ts
2758
2768
  function formatProvenanceLine(line) {
2759
2769
  const who = line.role === "user" ? "the user" : "you (assistant)";
@@ -3388,6 +3398,52 @@ function buildMemoryWritePrompt(params) {
3388
3398
  ].filter(Boolean).join("\n\n");
3389
3399
  }
3390
3400
  var MEMORY_WRITE_VERDICT = 'Decide: store each durable user-specific fact with one memory-partition-remember call, each derived understanding with one memory-cognition-remember call, or answer "none" if the turn surfaced nothing durable about this user.';
3401
+ var ResearchTriageDecisionSchema = z.object({
3402
+ /** The gap's url — echoed back so the worker maps the verdict to its candidate. */
3403
+ url: z.string(),
3404
+ /** True = fetch and persist this page; false = skip (transient/low-value). */
3405
+ close: z.boolean(),
3406
+ /** One-sentence reason — logged for observability, never shown to users. */
3407
+ reason: z.string(),
3408
+ /**
3409
+ * New topics this page (or snippet) references that the knowledge base does
3410
+ * not yet cover — the next deep-dive's search queries (the Z candidates).
3411
+ * Empty when the page is self-contained.
3412
+ */
3413
+ followUpTopics: z.array(z.string().min(1).max(200)).max(3).optional()
3414
+ });
3415
+ var ResearchTriageSchema = z.object({
3416
+ decisions: z.array(ResearchTriageDecisionSchema).max(50)
3417
+ });
3418
+
3419
+ // src/prompts/memory/research-triage.prompt.ts
3420
+ var RESEARCH_TRIAGE_INSTRUCTIONS = buildStructuredPrompt(ResearchTriageSchema, {
3421
+ before: `ENCYCLOPEDIA RESEARCH TRIAGE \u2014 one purpose: decide which knowledge-base gaps to close and what to research next.
3422
+
3423
+ You receive a list of GAPS. Each gap is a search result the user's own past searches surfaced but whose page was never fetched into the knowledge base. For each gap you decide:
3424
+ - close=true: the page is worth fetching and storing \u2014 substantive, durable knowledge (a spec, a how-to, a reference, a fact the user will likely need again). close=false: transient, duplicate, low-value, or already-covered content.
3425
+ - followUpTopics: NEW topics the page will likely reference that the knowledge base does not yet cover \u2014 the next deep-dive's search queries. Empty when the page is self-contained. Never echo the gap's own subject back as a follow-up.
3426
+
3427
+ Rules:
3428
+ - Judge from the snippet alone \u2014 you have not fetched the page yet.
3429
+ - Prefer closing gaps that deepen a subject the user already researched; skip clickbait, ads, login walls, and pure navigation pages.
3430
+ - followUpTopics are concrete search queries (2\u20138 words), at most 3 per gap.
3431
+ - Never invent facts; the reason is one sentence of honest justification.
3432
+
3433
+ OUTPUT FORMAT \u2014 output ONLY valid JSON:`,
3434
+ after: "No markdown fences, no explanations."
3435
+ });
3436
+ function buildResearchTriagePrompt(gaps, maxPayloadChars) {
3437
+ const body = JSON.stringify(
3438
+ gaps.map((gap) => ({
3439
+ url: gap.url,
3440
+ title: gap.title ?? "(untitled)",
3441
+ snippet: gap.snippet
3442
+ }))
3443
+ );
3444
+ return [`GAPS:
3445
+ ${limitText(body, maxPayloadChars)}`, "Write the decisions JSON object now."].join("\n\n");
3446
+ }
3391
3447
  var FACT_KINDS = [
3392
3448
  "preference",
3393
3449
  "decision",
@@ -3534,4 +3590,4 @@ Compose the response from the snippets below. Include every snippet you can subs
3534
3590
  ${parts.join("\n\n")}`;
3535
3591
  }
3536
3592
 
3537
- export { COMMONMARK_FORMAT, COMPARE_INSTRUCTIONS, COMPARE_VISUAL_INSTRUCTIONS, CONVICTION_INSTRUCTIONS, DEFAULT_VARIANT_ID, DESCRIBE_CONCISE_INSTRUCTIONS, DESCRIBE_DETAILED_INSTRUCTIONS, DESCRIBE_INSTRUCTIONS, FINAL_REMINDER, FRICTION_INSTRUCTIONS, HISTORY_URLS_RULES, IMAGELIST_INSTRUCTIONS, IMAGE_TASK_RULE, INTERNATIONAL_COVERAGE_INSTRUCTIONS, ITEM_SHAPES, JSON_RULES, MEDIA_COUNTS, MEDIA_RULES, MEMORY_CLUSTER_INSTRUCTIONS, MEMORY_CONSOLIDATE_INSTRUCTIONS, MEMORY_PROFILE_INSTRUCTIONS, MEMORY_WRITE_INSTRUCTIONS, MERGE_MEDIA_RULES, MERGE_TOPIC_RULE, MULTIMODAL_POLICY, NOISE_RULES, OCR_INSTRUCTIONS, OCR_VERBATIM_INSTRUCTIONS, PRECEDENCE_RULES, PRODUCT_INSTRUCTIONS, RESPONSE_LAYOUTS, SECURITY_RULES, SHOPLIST_INSTRUCTIONS, SNIPPET_TEMPLATE_PRESETS, SOURCE_TRUTH_RULES, SOURCE_VOICE_RULES, STOCKMARKET_ITEM_INSTRUCTIONS, STOCKMARKET_LIST_INSTRUCTIONS, SUMMARY_INSTRUCTIONS, TEMPLATE_VARIANTS, TEXT_CODING_INSTRUCTIONS, TEXT_FAMILIARITY_INSTRUCTIONS, TEXT_INSTRUCTIONS, TOOL_RESULTS_RULES, VIDEOLIST_INSTRUCTIONS, articlePreset, assessmentListsSnippet, authorMetaSnippet, bodyBriefSnippet, bodyExtensiveSnippet, buildBaseSystemPrompt, buildClarificationTranslationSystemPrompt, buildClarificationTranslationUserPrompt, buildClassifyTranscript, buildClusterSummaryPrompt, buildConsolidatePrompt, buildContentSystemPrompt, buildContextSummarySection, buildConvictionSynthesisPrompt, buildCorrectionPrompt, buildEncyclopediaClassifyPrompt, buildEnrichPrompt, buildExecuteLanguageInstruction, buildExtractionCorrectionPrompt, buildExtractionPrompt, buildFrictionPrompt, buildImageExecutePrompt, buildIntentCorrectionPrompt, buildIntentSelectionPrompt, buildLanguageRule, buildLayoutInstruction, buildLocalizationRule, buildMemoryProbeSection, buildMemoryProfilePrompt, buildMemoryWritePrompt, buildMergeDirective, buildMissingToolsPrompt, buildOutputContract, buildSnippetInstruction, buildSourcePolicyPrompt, buildStockmarketNote, buildStructuredJsonPrompt, buildStructuredPrompt, buildToolExecutePrompt, buildVocabularySection, bylineDatelineSnippet, cardsSnippet, comparisonSchema, comparisonSnippet, composeSnippetKeys, composeSnippetSchema, conclusionSnippet, evaluationPreset, formatCurrentTimestamp, formatProvenanceLine, formatToolAvailabilityCatalog, formatVariantCatalog, gallerySnippet, getSnippetTemplateKeys, getSnippetTemplateSchema, headerArticleSnippet, headerNewsSnippet, heroMediaSnippet, internationalCoverageSnippet, introductionSnippet, isSnippetTemplate, keyFindingsSnippet, languageCorrectionPrompt, leadSnippet, mergePreset, mergedEvaluationsSnippet, newsKeyFindingsSnippet, newsPreset, quoteSnippet, reasoningSnippet, relatedStoriesSnippet, resolveLanguageName, resolveVariantInstructions, responseLayoutSchema, sourcesSnippet, subjectSchema, subjectsSnippet, summarySnippet, verdictSpineSnippet, videoGallerySnippet };
3593
+ export { COMMONMARK_FORMAT, COMPARE_INSTRUCTIONS, COMPARE_VISUAL_INSTRUCTIONS, CONVICTION_INSTRUCTIONS, DEFAULT_VARIANT_ID, DESCRIBE_CONCISE_INSTRUCTIONS, DESCRIBE_DETAILED_INSTRUCTIONS, DESCRIBE_INSTRUCTIONS, FINAL_REMINDER, FRICTION_INSTRUCTIONS, HISTORY_URLS_RULES, IMAGELIST_INSTRUCTIONS, IMAGE_TASK_RULE, INTERNATIONAL_COVERAGE_INSTRUCTIONS, ITEM_SHAPES, JSON_RULES, MEDIA_COUNTS, MEDIA_RULES, MEMORY_CLUSTER_INSTRUCTIONS, MEMORY_CONSOLIDATE_INSTRUCTIONS, MEMORY_PROFILE_INSTRUCTIONS, MEMORY_WRITE_INSTRUCTIONS, MERGE_MEDIA_RULES, MERGE_TOPIC_RULE, MULTIMODAL_POLICY, NOISE_RULES, OCR_INSTRUCTIONS, OCR_VERBATIM_INSTRUCTIONS, PRECEDENCE_RULES, PRODUCT_INSTRUCTIONS, RESEARCH_TRIAGE_INSTRUCTIONS, RESPONSE_LAYOUTS, SECURITY_RULES, SHOPLIST_INSTRUCTIONS, SNIPPET_TEMPLATE_PRESETS, SOURCE_TRUTH_RULES, SOURCE_VOICE_RULES, STOCKMARKET_ITEM_INSTRUCTIONS, STOCKMARKET_LIST_INSTRUCTIONS, SUMMARY_INSTRUCTIONS, TEMPLATE_VARIANTS, TEXT_CODING_INSTRUCTIONS, TEXT_FAMILIARITY_INSTRUCTIONS, TEXT_INSTRUCTIONS, TOOL_RESULTS_RULES, VIDEOLIST_INSTRUCTIONS, articlePreset, assessmentListsSnippet, authorMetaSnippet, bodyBriefSnippet, bodyExtensiveSnippet, buildBaseSystemPrompt, buildClarificationTranslationSystemPrompt, buildClarificationTranslationUserPrompt, buildClassifyTranscript, buildClusterSummaryPrompt, buildCognitionProfileSection, buildConsolidatePrompt, buildContentSystemPrompt, buildContextSummarySection, buildConvictionSynthesisPrompt, buildCorrectionPrompt, buildEncyclopediaClassifyPrompt, buildEnrichPrompt, buildExecuteLanguageInstruction, buildExtractionCorrectionPrompt, buildExtractionPrompt, buildFrictionPrompt, buildImageExecutePrompt, buildIntentCorrectionPrompt, buildIntentSelectionPrompt, buildLanguageRule, buildLayoutInstruction, buildLocalizationRule, buildMemoryProbeSection, buildMemoryProfilePrompt, buildMemoryWritePrompt, buildMergeDirective, buildMissingToolsPrompt, buildOutputContract, buildResearchTriagePrompt, buildSnippetInstruction, buildSourcePolicyPrompt, buildStockmarketNote, buildStructuredJsonPrompt, buildStructuredPrompt, buildToolExecutePrompt, buildVocabularySection, bylineDatelineSnippet, cardsSnippet, comparisonSchema, comparisonSnippet, composeSnippetKeys, composeSnippetSchema, conclusionSnippet, evaluationPreset, formatCurrentTimestamp, formatProvenanceLine, formatToolAvailabilityCatalog, formatVariantCatalog, gallerySnippet, getSnippetTemplateKeys, getSnippetTemplateSchema, headerArticleSnippet, headerNewsSnippet, heroMediaSnippet, internationalCoverageSnippet, introductionSnippet, isSnippetTemplate, keyFindingsSnippet, languageCorrectionPrompt, leadSnippet, mergePreset, mergedEvaluationsSnippet, newsKeyFindingsSnippet, newsPreset, quoteSnippet, reasoningSnippet, relatedStoriesSnippet, resolveLanguageName, resolveVariantInstructions, responseLayoutSchema, sourcesSnippet, subjectSchema, subjectsSnippet, summarySnippet, verdictSpineSnippet, videoGallerySnippet };
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
- export { B as BROWSER_TOOL_NAMES, D as DEFAULT_VARIANT_ID, F as FormatZodShapeOptions, a as IMAGE_TASK_TEMPLATES, b as ImageTaskTemplate, I as IntentResult, c as IntentSchema, M as MEMORY_TOOL_NAMES, P as ProviderConfig, d as TOOL_DESCRIPTIONS, e as TOOL_NAMES, T as TemplateName, f as ToolName, g as VARIANT_NAMES, V as VariantName, h as formatZodShape, i as isImageTaskTemplate } from '../format-zod-shape.helper-DTl2uBDp.js';
2
+ export { E as EncyclopediaDocumentInput, a as EncyclopediaDocumentResult, b as EncyclopediaSearchHit, c as EncyclopediaSearchInput } from '../encyclopedia-search.model-oFW8_rUT.js';
3
+ export { B as BROWSER_TOOL_NAMES, D as DEFAULT_VARIANT_ID, E as ENCYCLOPEDIA_TOOL_NAMES, F as FormatZodShapeOptions, a as IMAGE_TASK_TEMPLATES, b as ImageTaskTemplate, I as IntentResult, c as IntentSchema, M as MEMORY_TOOL_NAMES, P as ProviderConfig, d as TOOL_DESCRIPTIONS, e as TOOL_NAMES, T as TemplateName, f as ToolName, g as VARIANT_NAMES, V as VariantName, h as formatZodShape, i as isImageTaskTemplate } from '../format-zod-shape.helper-BviIexpu.js';
3
4
 
4
5
  declare const BLOCKED_IMAGE_HOSTS: Set<string>;
5
6
 
@@ -271,6 +272,23 @@ interface MergedCognitionProfile {
271
272
  }
272
273
  declare function mergeCognitionProfiles(current: MemoryCognitionProfile | undefined, patch: MemoryCognitionProfile): MergedCognitionProfile;
273
274
 
275
+ declare const ResearchTriageDecisionSchema: z.ZodObject<{
276
+ url: z.ZodString;
277
+ close: z.ZodBoolean;
278
+ reason: z.ZodString;
279
+ followUpTopics: z.ZodOptional<z.ZodArray<z.ZodString>>;
280
+ }, z.core.$strip>;
281
+ declare const ResearchTriageSchema: z.ZodObject<{
282
+ decisions: z.ZodArray<z.ZodObject<{
283
+ url: z.ZodString;
284
+ close: z.ZodBoolean;
285
+ reason: z.ZodString;
286
+ followUpTopics: z.ZodOptional<z.ZodArray<z.ZodString>>;
287
+ }, z.core.$strip>>;
288
+ }, z.core.$strip>;
289
+ type ResearchTriageDecision = z.infer<typeof ResearchTriageDecisionSchema>;
290
+ type ResearchTriage = z.infer<typeof ResearchTriageSchema>;
291
+
274
292
  declare const cardSchema: z.ZodObject<{
275
293
  url: z.ZodString;
276
294
  title: z.ZodOptional<z.ZodString>;
@@ -877,4 +895,4 @@ declare const videolistSchema: z.ZodObject<{
877
895
  }, z.core.$strip>>>;
878
896
  }, z.core.$strip>;
879
897
 
880
- export { BLOCKED_IMAGE_HOSTS, BLOCKED_URL_HOSTS, COGNITION_LIMIT_DEFAULT, COGNITION_LIMIT_MAX, COGNITION_LIMIT_MIN, COGNITION_PURGE_BATCH, CONVICTION_TAGS, CONVICTION_TEXT_LIMIT, type ConsolidationVerdict, ConsolidationVerdictSchema, DEFAULT_MEDIA_COUNT, EMBEDDABLE_VIDEO_PROVIDER_CLAUSE, EMBEDDABLE_VIDEO_PROVIDER_LABELS, EPISODE_PROBE_LIMIT_DEFAULT, 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, type EncyclopediaClassification, EncyclopediaClassifySchema, type EncyclopediaSearchResult, type EncyclopediaSelectInput, type EncyclopediaSelectResult, type EncyclopediaSelectedChunk, type EncyclopediaSourceDocument, type ExtractedFact, ExtractedFactSchema, ExtractionSchema, FACT_KINDS, FACT_STABILITIES, HERO_VIDEO_TITLE_ISSUE, INSIGHTS_MAX_PER_TURN, INSIGHT_TAGS, INSIGHT_TEXT_LIMIT, MORE_MEDIA_COUNT, type MemoryClusterSummary, MemoryClusterSummarySchema, type MemoryCognitionProfile, type MemoryEnrichment, MemoryEnrichmentSchema, type MemoryExtraction, type MemoryProfileInsight, type MemoryProfileResponse, type MergedCognitionProfile, NON_PAGE_EXTENSIONS, 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 };
898
+ export { BLOCKED_IMAGE_HOSTS, BLOCKED_URL_HOSTS, COGNITION_LIMIT_DEFAULT, COGNITION_LIMIT_MAX, COGNITION_LIMIT_MIN, COGNITION_PURGE_BATCH, CONVICTION_TAGS, CONVICTION_TEXT_LIMIT, type ConsolidationVerdict, ConsolidationVerdictSchema, DEFAULT_MEDIA_COUNT, EMBEDDABLE_VIDEO_PROVIDER_CLAUSE, EMBEDDABLE_VIDEO_PROVIDER_LABELS, EPISODE_PROBE_LIMIT_DEFAULT, 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, type EncyclopediaClassification, EncyclopediaClassifySchema, type EncyclopediaSearchResult, type EncyclopediaSelectInput, type EncyclopediaSelectResult, type EncyclopediaSelectedChunk, type EncyclopediaSourceDocument, type ExtractedFact, ExtractedFactSchema, ExtractionSchema, FACT_KINDS, FACT_STABILITIES, HERO_VIDEO_TITLE_ISSUE, INSIGHTS_MAX_PER_TURN, INSIGHT_TAGS, INSIGHT_TEXT_LIMIT, MORE_MEDIA_COUNT, type MemoryClusterSummary, MemoryClusterSummarySchema, type MemoryCognitionProfile, type MemoryEnrichment, MemoryEnrichmentSchema, type MemoryExtraction, type MemoryProfileInsight, type MemoryProfileResponse, type MergedCognitionProfile, NON_PAGE_EXTENSIONS, type ResearchTriage, type ResearchTriageDecision, ResearchTriageDecisionSchema, ResearchTriageSchema, 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 };
@@ -182,6 +182,7 @@ var MEMORY_TOOL_NAMES = [
182
182
  "memory-cognition-remember",
183
183
  "memory-cognition-forget"
184
184
  ];
185
+ var ENCYCLOPEDIA_TOOL_NAMES = ["encyclopedia-search", "encyclopedia-read"];
185
186
  var TOOL_NAMES = [
186
187
  "webFetch",
187
188
  "brightDataWebSearch",
@@ -773,6 +774,23 @@ function mergeCognitionProfiles(current, patch) {
773
774
  const changed = JSON.stringify(profile) !== JSON.stringify(before);
774
775
  return { profile: changed ? profile : void 0, removals };
775
776
  }
777
+ var ResearchTriageDecisionSchema = z.object({
778
+ /** The gap's url — echoed back so the worker maps the verdict to its candidate. */
779
+ url: z.string(),
780
+ /** True = fetch and persist this page; false = skip (transient/low-value). */
781
+ close: z.boolean(),
782
+ /** One-sentence reason — logged for observability, never shown to users. */
783
+ reason: z.string(),
784
+ /**
785
+ * New topics this page (or snippet) references that the knowledge base does
786
+ * not yet cover — the next deep-dive's search queries (the Z candidates).
787
+ * Empty when the page is self-contained.
788
+ */
789
+ followUpTopics: z.array(z.string().min(1).max(200)).max(3).optional()
790
+ });
791
+ var ResearchTriageSchema = z.object({
792
+ decisions: z.array(ResearchTriageDecisionSchema).max(50)
793
+ });
776
794
  var cardSchema = z.object(
777
795
  {
778
796
  url: safeUrl({ message: "cards entries must have a valid url" }),
@@ -1153,4 +1171,4 @@ var videolistSchema = z.object({
1153
1171
  internationalCoverage: internationalCoverageSchema.optional()
1154
1172
  });
1155
1173
 
1156
- export { BLOCKED_IMAGE_HOSTS, BLOCKED_URL_HOSTS, BROWSER_TOOL_NAMES, COGNITION_LIMIT_DEFAULT, COGNITION_LIMIT_MAX, COGNITION_LIMIT_MIN, COGNITION_PURGE_BATCH, CONVICTION_TAGS, CONVICTION_TEXT_LIMIT, ConsolidationVerdictSchema, DEFAULT_MEDIA_COUNT, DEFAULT_VARIANT_ID, EMBEDDABLE_VIDEO_PROVIDER_CLAUSE, EMBEDDABLE_VIDEO_PROVIDER_LABELS, EPISODE_PROBE_LIMIT_DEFAULT, 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, EncyclopediaClassifySchema, ExtractedFactSchema, ExtractionSchema, FACT_KINDS, FACT_STABILITIES, HERO_VIDEO_TITLE_ISSUE, IMAGE_TASK_TEMPLATES, INSIGHTS_MAX_PER_TURN, INSIGHT_TAGS, INSIGHT_TEXT_LIMIT, IntentSchema, MEMORY_TOOL_NAMES, MORE_MEDIA_COUNT, MemoryClusterSummarySchema, MemoryEnrichmentSchema, NON_PAGE_EXTENSIONS, TOOL_DESCRIPTIONS, TOOL_NAMES, VARIANT_NAMES, cardSchema, categorizeTools, clampCognitionLimit, clampEpisodeProbeLimit, clampEpisodeRecencyMidpoint, clampEpisodeRecencyScaleSeconds, clampEpisodeRecencyWeight, clampEpisodeScoreThreshold, compareSchema, createTextItemSchema, deriveSchemaKeys, describeSchema, discardedReferenceSchema, formatZodIssues, formatZodShape, galleryItemSchema, hasBlockedImageHost, heroVideoHasTitle, imagelistSchema, internationalCoverageSchema, isAllFieldsNullWipe, isImageTaskTemplate, 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 };
1174
+ export { BLOCKED_IMAGE_HOSTS, BLOCKED_URL_HOSTS, BROWSER_TOOL_NAMES, COGNITION_LIMIT_DEFAULT, COGNITION_LIMIT_MAX, COGNITION_LIMIT_MIN, COGNITION_PURGE_BATCH, CONVICTION_TAGS, CONVICTION_TEXT_LIMIT, ConsolidationVerdictSchema, DEFAULT_MEDIA_COUNT, DEFAULT_VARIANT_ID, EMBEDDABLE_VIDEO_PROVIDER_CLAUSE, EMBEDDABLE_VIDEO_PROVIDER_LABELS, ENCYCLOPEDIA_TOOL_NAMES, EPISODE_PROBE_LIMIT_DEFAULT, 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, EncyclopediaClassifySchema, ExtractedFactSchema, ExtractionSchema, FACT_KINDS, FACT_STABILITIES, HERO_VIDEO_TITLE_ISSUE, IMAGE_TASK_TEMPLATES, INSIGHTS_MAX_PER_TURN, INSIGHT_TAGS, INSIGHT_TEXT_LIMIT, IntentSchema, MEMORY_TOOL_NAMES, MORE_MEDIA_COUNT, MemoryClusterSummarySchema, MemoryEnrichmentSchema, NON_PAGE_EXTENSIONS, ResearchTriageDecisionSchema, ResearchTriageSchema, TOOL_DESCRIPTIONS, TOOL_NAMES, VARIANT_NAMES, cardSchema, categorizeTools, clampCognitionLimit, clampEpisodeProbeLimit, clampEpisodeRecencyMidpoint, clampEpisodeRecencyScaleSeconds, clampEpisodeRecencyWeight, clampEpisodeScoreThreshold, compareSchema, createTextItemSchema, deriveSchemaKeys, describeSchema, discardedReferenceSchema, formatZodIssues, formatZodShape, galleryItemSchema, hasBlockedImageHost, heroVideoHasTitle, imagelistSchema, internationalCoverageSchema, isAllFieldsNullWipe, isImageTaskTemplate, 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 };
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { Tool } from 'ai';
3
+ import { a as EncyclopediaDocumentResult, b as EncyclopediaSearchHit } from '../encyclopedia-search.model-oFW8_rUT.js';
3
4
  import { M as MemoryPoint } from '../memory-point.model-C4wvvjAY.js';
4
5
  export { a as MemoryRole } from '../memory-point.model-C4wvvjAY.js';
5
6
 
@@ -283,6 +284,40 @@ declare const SEARCH_RETRIES = 1;
283
284
  declare const STANDALONE_QUERY_DESCRIPTION = "A standalone, self-contained search query that explicitly names the subject (title, entity, brand, person, place, or topic). Never copy the user message verbatim: rewrite short follow-ups (e.g. \"what do the reviews say?\") into a full query that names the established subject from the conversation (e.g. \"Neverness to Everness NTE reviews\").";
284
285
  declare const STANDALONE_QUERY_TOOL_CLAUSE = "Always pass a standalone query that names the subject explicitly \u2014 never the user message verbatim.";
285
286
 
287
+ declare const encyclopediaReadSchema: z.ZodObject<{
288
+ url: z.ZodString;
289
+ startChunk: z.ZodOptional<z.ZodNumber>;
290
+ maxChars: z.ZodOptional<z.ZodNumber>;
291
+ }, z.core.$strip>;
292
+ type EncyclopediaReadToolInput = z.infer<typeof encyclopediaReadSchema>;
293
+
294
+ interface EncyclopediaReadDeps {
295
+ readDocument: (input: {
296
+ url: string;
297
+ offset?: number;
298
+ maxChars?: number;
299
+ }) => Promise<EncyclopediaDocumentResult | null>;
300
+ }
301
+ declare function createEncyclopediaReadTool(deps: EncyclopediaReadDeps): Tool;
302
+
303
+ declare const encyclopediaSearchSchema: z.ZodObject<{
304
+ query: z.ZodString;
305
+ topK: z.ZodOptional<z.ZodNumber>;
306
+ url: z.ZodOptional<z.ZodString>;
307
+ domain: z.ZodOptional<z.ZodString>;
308
+ }, z.core.$strip>;
309
+ type EncyclopediaSearchToolInput = z.infer<typeof encyclopediaSearchSchema>;
310
+
311
+ interface EncyclopediaSearchDeps {
312
+ search: (input: {
313
+ text: string;
314
+ url?: string;
315
+ domain?: string;
316
+ limit?: number;
317
+ }) => Promise<EncyclopediaSearchHit[]>;
318
+ }
319
+ declare function createEncyclopediaSearchTool(deps: EncyclopediaSearchDeps): Tool;
320
+
286
321
  declare function applyLocaleParams(body: Record<string, unknown>, lang?: string): void;
287
322
 
288
323
  type SearchRecency = keyof typeof QDR_BY_RECENCY;
@@ -643,6 +678,8 @@ declare const summarizeFound: ToolSummaryFn;
643
678
  declare const defaultSummarize: ToolSummaryFn;
644
679
  declare function withSummary(tool: Tool, summarize?: ToolSummaryFn): ToolWithSummary;
645
680
 
681
+ declare function extractArticleText(html: string): string;
682
+
646
683
  declare const webFetchSchema: z.ZodObject<{
647
684
  url: z.ZodString;
648
685
  }, z.core.$strip>;
@@ -705,4 +742,4 @@ interface VideoStats {
705
742
  lang?: string;
706
743
  }
707
744
 
708
- export { BRIGHT_DATA_TIMEOUT_MS, type BrightDataConfig, type BrightDataImageSearchInput, type BrightDataImageSearchResponse, type BrightDataNewsSearchInput, type BrightDataNewsSearchResponse, type BrightDataPlacesSearchInput, type BrightDataPlacesSearchResponse, type BrightDataShoppingSearchInput, type BrightDataShoppingSearchResponse, type BrightDataVideoSearchInput, type BrightDataVideoSearchResponse, type BrightDataWebSearchInput, type BrightDataWebSearchResponse, type BrightDataWebpageScrapeInput, type BrightDataWebpageScrapeResponse, type EodhdConfig, type EodhdNewsConfig, type FilterVariant, HEADERS, MIN_IMAGE_HEIGHT, MIN_IMAGE_WIDTH, type MarketDailyBar, type MemoryCognitionForgetInput, type MemoryCognitionRememberInput, type MemoryPartitionDeleteInput, type MemoryPartitionRecallInput, type MemoryPartitionRememberInput, MemoryPoint, type MemoryToolScope, type ProviderEndpointConfig, RECENCY_DESCRIPTION, type ResolvableOffer, SEARCH_RETRIES, SEARCH_TIMEOUT_MS, SOURCE, STANDALONE_QUERY_DESCRIPTION, STANDALONE_QUERY_TOOL_CLAUSE, type SearchRecency, type SerperBusinessReviewsSearchInput, type SerperBusinessReviewsSearchResponse, type SerperConfig, type SerperImageSearchInput, type SerperImageSearchResponse, type SerperNewsSearchInput, type SerperNewsSearchResponse, type SerperPlacesSearchInput, type SerperPlacesSearchResponse, type SerperShoppingSearchInput, type SerperShoppingSearchResponse, type SerperVideoSearchInput, type SerperVideoSearchResponse, type SerperWebSearchInput, type SerperWebSearchResponse, type SerperWebpageScrapeInput, type SerperWebpageScrapeResponse, type SourcesConfig, type ToolConfigSnapshot, type ToolDependencies, type ToolLogger, type ToolSummaryFn, type ToolWithSummary, type Variant, type VideoStats, type WebFetchInput, type YoutubeConfig, type YoutubeSearchResponse, type YoutubeVideoSearchInput, type YoutubeVideosResponse, applyLocaleParams, applyRecencyParam, brightDataImageSearchSchema, brightDataNewsSearchSchema, brightDataPlacesSearchSchema, brightDataShoppingSearchSchema, brightDataVideoSearchSchema, brightDataWebSearchSchema, brightDataWebpageScrapeSchema, buildGoogleUrl, buildYoutubeThumbnailUrl, createBrightDataImageSearch, createBrightDataNewsSearch, createBrightDataPlacesSearch, createBrightDataShoppingSearch, createBrightDataVideoSearch, createBrightDataWebSearch, createBrightDataWebpageScrape, createMemoryCognitionForgetTool, createMemoryCognitionRememberTool, createMemoryPartitionDeleteTool, createMemoryPartitionRecallTool, createMemoryPartitionRememberTool, createSerperBusinessReviewsSearch, createSerperImageSearch, createSerperNewsSearch, createSerperPlacesSearch, createSerperShoppingSearch, createSerperVideoSearch, createSerperWebSearch, createSerperWebpageScrape, createVariantRequestTool, createWebFetchTool, createYoutubeVideoSearch, defaultSummarize, engineEnabled, fetchWithTimeout, isGoogleHostUrl, localizedQuerySuffix, meetsMinimumImageDimensions, memoryCognitionForgetSchema, memoryCognitionRememberSchema, memoryPartitionDeleteSchema, memoryPartitionRecallSchema, memoryPartitionRememberSchema, pickMerchantResult, requestBrightData, resolveSerperShopOfferLinks, serperBusinessReviewsSearchSchema, serperImageSearchSchema, serperNewsSearchSchema, serperPlacesSearchSchema, serperShoppingSearchSchema, serperVideoSearchSchema, serperWebSearchSchema, serperWebpageScrapeSchema, storeHostToken, summarizeContent, summarizeFound, summarizeResults, tbsSizeLabelForPixels, variantRequestSchema, webFetchSchema, withSummary, youtubeVideoSearchSchema };
745
+ export { BRIGHT_DATA_TIMEOUT_MS, type BrightDataConfig, type BrightDataImageSearchInput, type BrightDataImageSearchResponse, type BrightDataNewsSearchInput, type BrightDataNewsSearchResponse, type BrightDataPlacesSearchInput, type BrightDataPlacesSearchResponse, type BrightDataShoppingSearchInput, type BrightDataShoppingSearchResponse, type BrightDataVideoSearchInput, type BrightDataVideoSearchResponse, type BrightDataWebSearchInput, type BrightDataWebSearchResponse, type BrightDataWebpageScrapeInput, type BrightDataWebpageScrapeResponse, type EncyclopediaReadToolInput, type EncyclopediaSearchToolInput, type EodhdConfig, type EodhdNewsConfig, type FilterVariant, HEADERS, MIN_IMAGE_HEIGHT, MIN_IMAGE_WIDTH, type MarketDailyBar, type MemoryCognitionForgetInput, type MemoryCognitionRememberInput, type MemoryPartitionDeleteInput, type MemoryPartitionRecallInput, type MemoryPartitionRememberInput, MemoryPoint, type MemoryToolScope, type ProviderEndpointConfig, RECENCY_DESCRIPTION, type ResolvableOffer, SEARCH_RETRIES, SEARCH_TIMEOUT_MS, SOURCE, STANDALONE_QUERY_DESCRIPTION, STANDALONE_QUERY_TOOL_CLAUSE, type SearchRecency, type SerperBusinessReviewsSearchInput, type SerperBusinessReviewsSearchResponse, type SerperConfig, type SerperImageSearchInput, type SerperImageSearchResponse, type SerperNewsSearchInput, type SerperNewsSearchResponse, type SerperPlacesSearchInput, type SerperPlacesSearchResponse, type SerperShoppingSearchInput, type SerperShoppingSearchResponse, type SerperVideoSearchInput, type SerperVideoSearchResponse, type SerperWebSearchInput, type SerperWebSearchResponse, type SerperWebpageScrapeInput, type SerperWebpageScrapeResponse, type SourcesConfig, type ToolConfigSnapshot, type ToolDependencies, type ToolLogger, type ToolSummaryFn, type ToolWithSummary, type Variant, type VideoStats, type WebFetchInput, type YoutubeConfig, type YoutubeSearchResponse, type YoutubeVideoSearchInput, type YoutubeVideosResponse, applyLocaleParams, applyRecencyParam, brightDataImageSearchSchema, brightDataNewsSearchSchema, brightDataPlacesSearchSchema, brightDataShoppingSearchSchema, brightDataVideoSearchSchema, brightDataWebSearchSchema, brightDataWebpageScrapeSchema, buildGoogleUrl, buildYoutubeThumbnailUrl, createBrightDataImageSearch, createBrightDataNewsSearch, createBrightDataPlacesSearch, createBrightDataShoppingSearch, createBrightDataVideoSearch, createBrightDataWebSearch, createBrightDataWebpageScrape, createEncyclopediaReadTool, createEncyclopediaSearchTool, createMemoryCognitionForgetTool, createMemoryCognitionRememberTool, createMemoryPartitionDeleteTool, createMemoryPartitionRecallTool, createMemoryPartitionRememberTool, createSerperBusinessReviewsSearch, createSerperImageSearch, createSerperNewsSearch, createSerperPlacesSearch, createSerperShoppingSearch, createSerperVideoSearch, createSerperWebSearch, createSerperWebpageScrape, createVariantRequestTool, createWebFetchTool, createYoutubeVideoSearch, defaultSummarize, encyclopediaReadSchema, encyclopediaSearchSchema, engineEnabled, extractArticleText, fetchWithTimeout, isGoogleHostUrl, localizedQuerySuffix, meetsMinimumImageDimensions, memoryCognitionForgetSchema, memoryCognitionRememberSchema, memoryPartitionDeleteSchema, memoryPartitionRecallSchema, memoryPartitionRememberSchema, pickMerchantResult, requestBrightData, resolveSerperShopOfferLinks, serperBusinessReviewsSearchSchema, serperImageSearchSchema, serperNewsSearchSchema, serperPlacesSearchSchema, serperShoppingSearchSchema, serperVideoSearchSchema, serperWebSearchSchema, serperWebpageScrapeSchema, storeHostToken, summarizeContent, summarizeFound, summarizeResults, tbsSizeLabelForPixels, variantRequestSchema, webFetchSchema, withSummary, youtubeVideoSearchSchema };
@@ -719,6 +719,65 @@ function createBrightDataWebpageScrape(deps) {
719
719
  }
720
720
  });
721
721
  }
722
+ var encyclopediaReadSchema = z.object({
723
+ url: z.string().min(1).max(2e3).describe(
724
+ "The exact url of the document to read \u2014 taken from an encyclopedia-search result (uploaded documents included)."
725
+ ),
726
+ startChunk: z.number().int().min(0).optional().describe(
727
+ "Chunk index to start reading from (default 0). To continue a previous read, pass the next chunk index named in its footer."
728
+ ),
729
+ maxChars: z.number().int().min(1e3).max(48e3).optional().describe("Maximum chars of content to return for this read (default 12000).")
730
+ });
731
+ function createEncyclopediaReadTool(deps) {
732
+ return tool({
733
+ description: "Read one knowledge-base document in original order \u2014 the deep-dive follow-up to encyclopedia-search. Pass a result\u2019s exact url to pull the surrounding and remaining content of that document (a fetched page, or the extracted text of an uploaded PDF, receipt, or instruction document) without a live fetch. Use it when a knowledge-base passage looks incomplete, when the user asks for more detail or a deep dive into one stored document, or to scan the whole document section by section. Returns a verbatim window; when the footer says more content follows, call again with startChunk set to the named next index to continue reading.",
734
+ inputSchema: encyclopediaReadSchema,
735
+ execute: async ({ url, startChunk, maxChars }) => {
736
+ const result = await deps.readDocument({ url, offset: startChunk, maxChars });
737
+ if (!result) {
738
+ return "No document found in the knowledge base for this url \u2014 pass the exact url of an encyclopedia-search result.";
739
+ }
740
+ const footer = result.hasMore ? `More of this document follows \u2014 call encyclopedia-read again with startChunk=${result.toChunk + 1} to continue.` : `End of document (${result.totalChunks} chunks total).`;
741
+ const title = result.title ? ` "${result.title}"` : "";
742
+ return `YOUR KNOWLEDGE BASE \u2014 DOCUMENT${title} \u2014 ${result.url}
743
+ Verbatim content, chunks ${result.fromChunk + 1}\u2013${result.toChunk + 1} of ${result.totalChunks} (cite this url when you use it; upload urls open/download the original file):
744
+ ${result.content}
745
+
746
+ ${footer}`;
747
+ }
748
+ });
749
+ }
750
+ var encyclopediaSearchSchema = z.object({
751
+ query: z.string().min(1).max(1e3).describe(
752
+ 'What to look up in the knowledge base, as a natural-language question or keywords, e.g. "receipt hardware store march" or "graphrag retriever patterns".'
753
+ ),
754
+ topK: z.number().int().min(1).max(10).optional().describe("Maximum number of passages to return (default 5)."),
755
+ url: z.string().min(1).max(2e3).optional().describe(
756
+ "Restrict the search to ONE document \u2014 pass the exact url of a previous knowledge-base result to search only within that document\u2019s embeddings."
757
+ ),
758
+ domain: z.string().min(1).max(200).optional().describe('Restrict the search to one source domain, e.g. "reddit.com".')
759
+ });
760
+ function createEncyclopediaSearchTool(deps) {
761
+ return tool({
762
+ description: "Search your knowledge base (encyclopedia): VERBATIM passages from webpages you fetched and documents the user uploaded in past sessions \u2014 each with its source url (upload urls open/download the original file) and the fetch date as the freshness signal. Consult it whenever a request might be answerable from knowledge you already have, and cite the url/title of what you use. It complements live web search, never replaces it: weigh the dates, and still search the web when recency, updates, or coverage gaps matter \u2014 fresh fetches are how this knowledge base closes its gaps and stays current. Scope options: pass a known result url to search within that one document only, or a domain to search one source. Passages may be fragments \u2014 pass a result url to the encyclopedia-read tool to pull the surrounding or full document (PDF, receipt, instructions).",
763
+ inputSchema: encyclopediaSearchSchema,
764
+ execute: async ({ query, topK, url, domain }) => {
765
+ const hits = await deps.search({ text: query, url, domain, limit: topK ?? 5 });
766
+ if (hits.length === 0) {
767
+ return url ? "No matching knowledge found inside that document \u2014 check the url, or fall back to a live web search/fetch." : "No matching knowledge found in your knowledge base (no previously fetched page or uploaded document matched). Answer from a live web search instead \u2014 its sources also grow the knowledge base.";
768
+ }
769
+ const lines = hits.map((hit) => {
770
+ const title = hit.title ? `"${hit.title}"` : "Untitled";
771
+ const fetched = hit.fetchedAt ? `, fetched ${hit.fetchedAt.slice(0, 10)}` : "";
772
+ const position = hit.sourceType === "result" ? "search snippet \u2014 NOT full text (fetch the page for more)" : `chunk ${hit.chunkIndex + 1} of ${hit.chunkCount}`;
773
+ return `- ${title} \u2014 ${hit.url} [${position}; relevance ${hit.score.toFixed(2)}${fetched}]
774
+ ${hit.content}`;
775
+ });
776
+ return `YOUR KNOWLEDGE BASE (encyclopedia) \u2014 verbatim passages from pages you fetched and documents the user uploaded in earlier sessions. Cite the url/title of what you use so the user can open the source (upload urls open/download the original file). Full-text chunks are fragments of their document \u2014 pass a result's exact url to the encyclopedia-read tool when you need the surrounding or full document:
777
+ ${lines.join("\n")}`;
778
+ }
779
+ });
780
+ }
722
781
 
723
782
  // src/tools/helpers/is-google-host-url.helper.ts
724
783
  function isGoogleHostUrl(url) {
@@ -1606,14 +1665,11 @@ var defaultSummarize = (data) => {
1606
1665
  if (typeof data.content === "string") return summarizeContent(data);
1607
1666
  return {};
1608
1667
  };
1609
- function withSummary(tool24, summarize = defaultSummarize) {
1610
- const t = tool24;
1668
+ function withSummary(tool26, summarize = defaultSummarize) {
1669
+ const t = tool26;
1611
1670
  t.summarize = summarize;
1612
1671
  return t;
1613
1672
  }
1614
- var webFetchSchema = z.object({
1615
- url: z.string().describe("The URL to fetch content from")
1616
- });
1617
1673
  function extractArticleText(html) {
1618
1674
  if (!html.trim()) return "";
1619
1675
  const { document } = parseHTML(html);
@@ -1625,8 +1681,9 @@ function extractArticleText(html) {
1625
1681
  }
1626
1682
  return turndown.turndown(document.body?.innerHTML ?? "");
1627
1683
  }
1628
-
1629
- // src/tools/web-fetch/web-fetch.tool.ts
1684
+ var webFetchSchema = z.object({
1685
+ url: z.string().describe("The URL to fetch content from")
1686
+ });
1630
1687
  function createWebFetchTool() {
1631
1688
  return tool({
1632
1689
  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.",
@@ -1792,4 +1849,4 @@ function createYoutubeVideoSearch(deps) {
1792
1849
  });
1793
1850
  }
1794
1851
 
1795
- export { BRIGHT_DATA_TIMEOUT_MS, HEADERS, MIN_IMAGE_HEIGHT, MIN_IMAGE_WIDTH, RECENCY_DESCRIPTION, SEARCH_RETRIES, SEARCH_TIMEOUT_MS, SOURCE, STANDALONE_QUERY_DESCRIPTION, STANDALONE_QUERY_TOOL_CLAUSE, applyLocaleParams, applyRecencyParam, brightDataImageSearchSchema, brightDataNewsSearchSchema, brightDataPlacesSearchSchema, brightDataShoppingSearchSchema, brightDataVideoSearchSchema, brightDataWebSearchSchema, brightDataWebpageScrapeSchema, buildGoogleUrl, buildYoutubeThumbnailUrl, createBrightDataImageSearch, createBrightDataNewsSearch, createBrightDataPlacesSearch, createBrightDataShoppingSearch, createBrightDataVideoSearch, createBrightDataWebSearch, createBrightDataWebpageScrape, createMemoryCognitionForgetTool, createMemoryCognitionRememberTool, createMemoryPartitionDeleteTool, createMemoryPartitionRecallTool, createMemoryPartitionRememberTool, createSerperBusinessReviewsSearch, createSerperImageSearch, createSerperNewsSearch, createSerperPlacesSearch, createSerperShoppingSearch, createSerperVideoSearch, createSerperWebSearch, createSerperWebpageScrape, createVariantRequestTool, createWebFetchTool, createYoutubeVideoSearch, defaultSummarize, engineEnabled, fetchWithTimeout, isGoogleHostUrl, localizedQuerySuffix, meetsMinimumImageDimensions, memoryCognitionForgetSchema, memoryCognitionRememberSchema, memoryPartitionDeleteSchema, memoryPartitionRecallSchema, memoryPartitionRememberSchema, pickMerchantResult, requestBrightData, resolveSerperShopOfferLinks, serperBusinessReviewsSearchSchema, serperImageSearchSchema, serperNewsSearchSchema, serperPlacesSearchSchema, serperShoppingSearchSchema, serperVideoSearchSchema, serperWebSearchSchema, serperWebpageScrapeSchema, storeHostToken, summarizeContent, summarizeFound, summarizeResults, tbsSizeLabelForPixels, variantRequestSchema, webFetchSchema, withSummary, youtubeVideoSearchSchema };
1852
+ export { BRIGHT_DATA_TIMEOUT_MS, HEADERS, MIN_IMAGE_HEIGHT, MIN_IMAGE_WIDTH, RECENCY_DESCRIPTION, SEARCH_RETRIES, SEARCH_TIMEOUT_MS, SOURCE, STANDALONE_QUERY_DESCRIPTION, STANDALONE_QUERY_TOOL_CLAUSE, applyLocaleParams, applyRecencyParam, brightDataImageSearchSchema, brightDataNewsSearchSchema, brightDataPlacesSearchSchema, brightDataShoppingSearchSchema, brightDataVideoSearchSchema, brightDataWebSearchSchema, brightDataWebpageScrapeSchema, buildGoogleUrl, buildYoutubeThumbnailUrl, createBrightDataImageSearch, createBrightDataNewsSearch, createBrightDataPlacesSearch, createBrightDataShoppingSearch, createBrightDataVideoSearch, createBrightDataWebSearch, createBrightDataWebpageScrape, createEncyclopediaReadTool, createEncyclopediaSearchTool, createMemoryCognitionForgetTool, createMemoryCognitionRememberTool, createMemoryPartitionDeleteTool, createMemoryPartitionRecallTool, createMemoryPartitionRememberTool, createSerperBusinessReviewsSearch, createSerperImageSearch, createSerperNewsSearch, createSerperPlacesSearch, createSerperShoppingSearch, createSerperVideoSearch, createSerperWebSearch, createSerperWebpageScrape, createVariantRequestTool, createWebFetchTool, createYoutubeVideoSearch, defaultSummarize, encyclopediaReadSchema, encyclopediaSearchSchema, engineEnabled, extractArticleText, fetchWithTimeout, isGoogleHostUrl, localizedQuerySuffix, meetsMinimumImageDimensions, memoryCognitionForgetSchema, memoryCognitionRememberSchema, memoryPartitionDeleteSchema, memoryPartitionRecallSchema, memoryPartitionRememberSchema, pickMerchantResult, requestBrightData, resolveSerperShopOfferLinks, serperBusinessReviewsSearchSchema, serperImageSearchSchema, serperNewsSearchSchema, serperPlacesSearchSchema, serperShoppingSearchSchema, serperVideoSearchSchema, serperWebSearchSchema, serperWebpageScrapeSchema, storeHostToken, summarizeContent, summarizeFound, summarizeResults, tbsSizeLabelForPixels, variantRequestSchema, webFetchSchema, withSummary, youtubeVideoSearchSchema };
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.18",
4
+ "version": "0.1.19",
5
5
  "packageManager": "pnpm@11.25.0",
6
6
  "license": "MIT",
7
7
  "type": "module",