@triplef/agent 0.1.17 → 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.
@@ -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 '../intent.schema-Bp3p7h7P.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
 
@@ -22,6 +23,9 @@ interface EncyclopediaSourceDocument {
22
23
  url?: string;
23
24
  title?: string;
24
25
  content: string;
26
+ mimeType?: string;
27
+ sizeBytes?: number;
28
+ originalHash?: string;
25
29
  }
26
30
  interface EncyclopediaSelectedChunk {
27
31
  url?: string;
@@ -186,11 +190,6 @@ declare const memoryCognitionProfileSchema: z.ZodObject<{
186
190
  corrections: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
187
191
  }, z.core.$strip>;
188
192
  type MemoryCognitionProfile = z.infer<typeof memoryCognitionProfileSchema>;
189
- interface MergedCognitionProfile {
190
- profile?: MemoryCognitionProfile;
191
- removals: string[];
192
- }
193
- declare function mergeCognitionProfiles(current: MemoryCognitionProfile | undefined, patch: MemoryCognitionProfile): MergedCognitionProfile;
194
193
  declare function isAllFieldsNullWipe(current: MemoryCognitionProfile | undefined, patch: MemoryCognitionProfile): boolean;
195
194
  declare function parseStoredProfile(text: string | undefined): MemoryCognitionProfile;
196
195
  declare const memoryProfileInsightSchema: z.ZodObject<{
@@ -267,6 +266,29 @@ declare function clampEpisodeRecencyMidpoint(value: number): number;
267
266
  declare function clampEpisodeProbeLimit(value: number): number;
268
267
  declare function clampEpisodeScoreThreshold(value: number): number;
269
268
 
269
+ interface MergedCognitionProfile {
270
+ profile?: MemoryCognitionProfile;
271
+ removals: string[];
272
+ }
273
+ declare function mergeCognitionProfiles(current: MemoryCognitionProfile | undefined, patch: MemoryCognitionProfile): MergedCognitionProfile;
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
+
270
292
  declare const cardSchema: z.ZodObject<{
271
293
  url: z.ZodString;
272
294
  title: z.ZodOptional<z.ZodString>;
@@ -873,4 +895,4 @@ declare const videolistSchema: z.ZodObject<{
873
895
  }, z.core.$strip>>>;
874
896
  }, z.core.$strip>;
875
897
 
876
- 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, 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",
@@ -629,44 +630,6 @@ var memoryCognitionProfileSchema = z.object({
629
630
  */
630
631
  corrections: z.record(z.string(), z.string()).nullish()
631
632
  });
632
- function normalizeCognitionProfile(profile) {
633
- if (!profile) return void 0;
634
- const cleaned = {};
635
- for (const [key, value] of Object.entries(profile)) {
636
- const kept = cleanProfileValue(value);
637
- if (kept !== void 0) cleaned[key] = kept;
638
- }
639
- return Object.keys(cleaned).length > 0 ? cleaned : void 0;
640
- }
641
- function cleanProfileValue(value) {
642
- if (value === null || value === void 0) return void 0;
643
- if (typeof value === "string") return value.trim() || void 0;
644
- if (Array.isArray(value)) {
645
- const items = value.map((entry) => typeof entry === "string" ? entry.trim() : entry).filter(Boolean);
646
- return items.length > 0 ? items : void 0;
647
- }
648
- if (typeof value !== "object") return void 0;
649
- const inner = Object.fromEntries(
650
- Object.entries(value).map(([k, v]) => [k, cleanProfileValue(v)]).filter(([, v]) => v !== void 0)
651
- );
652
- return Object.keys(inner).length > 0 ? inner : void 0;
653
- }
654
- function mergeCognitionProfiles(current, patch) {
655
- const patchRecord = patch;
656
- const removals = Object.keys(patchRecord).filter(
657
- (key) => patchRecord[key] === null || patchRecord[key] === void 0
658
- );
659
- const base = current ?? {};
660
- const merged = merge(
661
- omit(base, removals),
662
- omit(patch, removals),
663
- true
664
- );
665
- const profile = normalizeCognitionProfile(merged) ?? {};
666
- const before = normalizeCognitionProfile(base) ?? {};
667
- const changed = JSON.stringify(profile) !== JSON.stringify(before);
668
- return { profile: changed ? profile : void 0, removals };
669
- }
670
633
  function isAllFieldsNullWipe(current, patch) {
671
634
  if (!current) return false;
672
635
  const currentKeys = Object.keys(current);
@@ -773,6 +736,61 @@ function clampEpisodeScoreThreshold(value) {
773
736
  if (!Number.isFinite(value)) return EPISODE_SCORE_THRESHOLD_DEFAULT;
774
737
  return Math.min(EPISODE_SCORE_THRESHOLD_MAX, Math.max(EPISODE_SCORE_THRESHOLD_MIN, value));
775
738
  }
739
+ function normalizeCognitionProfile(profile) {
740
+ if (!profile) return void 0;
741
+ const cleaned = {};
742
+ for (const [key, value] of Object.entries(profile)) {
743
+ const kept = cleanProfileValue(value);
744
+ if (kept !== void 0) cleaned[key] = kept;
745
+ }
746
+ return Object.keys(cleaned).length > 0 ? cleaned : void 0;
747
+ }
748
+ function cleanProfileValue(value) {
749
+ if (value === null || value === void 0) return void 0;
750
+ if (typeof value === "string") return value.trim() || void 0;
751
+ if (Array.isArray(value)) {
752
+ const items = value.map((entry) => typeof entry === "string" ? entry.trim() : entry).filter(Boolean);
753
+ return items.length > 0 ? items : void 0;
754
+ }
755
+ if (typeof value !== "object") return void 0;
756
+ const inner = Object.fromEntries(
757
+ Object.entries(value).map(([k, v]) => [k, cleanProfileValue(v)]).filter(([, v]) => v !== void 0)
758
+ );
759
+ return Object.keys(inner).length > 0 ? inner : void 0;
760
+ }
761
+ function mergeCognitionProfiles(current, patch) {
762
+ const patchRecord = patch;
763
+ const removals = Object.keys(patchRecord).filter(
764
+ (key) => patchRecord[key] === null || patchRecord[key] === void 0
765
+ );
766
+ const base = current ?? {};
767
+ const merged = merge(
768
+ omit(base, removals),
769
+ omit(patch, removals),
770
+ true
771
+ );
772
+ const profile = normalizeCognitionProfile(merged) ?? {};
773
+ const before = normalizeCognitionProfile(base) ?? {};
774
+ const changed = JSON.stringify(profile) !== JSON.stringify(before);
775
+ return { profile: changed ? profile : void 0, removals };
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.17",
4
+ "version": "0.1.19",
5
5
  "packageManager": "pnpm@11.25.0",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -60,7 +60,7 @@
60
60
  "turndown": "^7.2.4"
61
61
  },
62
62
  "peerDependencies": {
63
- "ai": "^7.0.90",
63
+ "ai": "^7.0.91",
64
64
  "zod": "^4.5.4"
65
65
  },
66
66
  "peerDependenciesMeta": {