@triplef/agent 0.1.17 → 0.1.18
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.
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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 '../
|
|
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';
|
|
3
3
|
|
|
4
4
|
declare const BLOCKED_IMAGE_HOSTS: Set<string>;
|
|
5
5
|
|
|
@@ -22,6 +22,9 @@ interface EncyclopediaSourceDocument {
|
|
|
22
22
|
url?: string;
|
|
23
23
|
title?: string;
|
|
24
24
|
content: string;
|
|
25
|
+
mimeType?: string;
|
|
26
|
+
sizeBytes?: number;
|
|
27
|
+
originalHash?: string;
|
|
25
28
|
}
|
|
26
29
|
interface EncyclopediaSelectedChunk {
|
|
27
30
|
url?: string;
|
|
@@ -186,11 +189,6 @@ declare const memoryCognitionProfileSchema: z.ZodObject<{
|
|
|
186
189
|
corrections: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
187
190
|
}, z.core.$strip>;
|
|
188
191
|
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
192
|
declare function isAllFieldsNullWipe(current: MemoryCognitionProfile | undefined, patch: MemoryCognitionProfile): boolean;
|
|
195
193
|
declare function parseStoredProfile(text: string | undefined): MemoryCognitionProfile;
|
|
196
194
|
declare const memoryProfileInsightSchema: z.ZodObject<{
|
|
@@ -267,6 +265,12 @@ declare function clampEpisodeRecencyMidpoint(value: number): number;
|
|
|
267
265
|
declare function clampEpisodeProbeLimit(value: number): number;
|
|
268
266
|
declare function clampEpisodeScoreThreshold(value: number): number;
|
|
269
267
|
|
|
268
|
+
interface MergedCognitionProfile {
|
|
269
|
+
profile?: MemoryCognitionProfile;
|
|
270
|
+
removals: string[];
|
|
271
|
+
}
|
|
272
|
+
declare function mergeCognitionProfiles(current: MemoryCognitionProfile | undefined, patch: MemoryCognitionProfile): MergedCognitionProfile;
|
|
273
|
+
|
|
270
274
|
declare const cardSchema: z.ZodObject<{
|
|
271
275
|
url: z.ZodString;
|
|
272
276
|
title: z.ZodOptional<z.ZodString>;
|
|
@@ -873,4 +877,4 @@ declare const videolistSchema: z.ZodObject<{
|
|
|
873
877
|
}, z.core.$strip>>>;
|
|
874
878
|
}, z.core.$strip>;
|
|
875
879
|
|
|
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 };
|
|
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 };
|
package/dist/schemas/index.mjs
CHANGED
|
@@ -629,44 +629,6 @@ var memoryCognitionProfileSchema = z.object({
|
|
|
629
629
|
*/
|
|
630
630
|
corrections: z.record(z.string(), z.string()).nullish()
|
|
631
631
|
});
|
|
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
632
|
function isAllFieldsNullWipe(current, patch) {
|
|
671
633
|
if (!current) return false;
|
|
672
634
|
const currentKeys = Object.keys(current);
|
|
@@ -773,6 +735,44 @@ function clampEpisodeScoreThreshold(value) {
|
|
|
773
735
|
if (!Number.isFinite(value)) return EPISODE_SCORE_THRESHOLD_DEFAULT;
|
|
774
736
|
return Math.min(EPISODE_SCORE_THRESHOLD_MAX, Math.max(EPISODE_SCORE_THRESHOLD_MIN, value));
|
|
775
737
|
}
|
|
738
|
+
function normalizeCognitionProfile(profile) {
|
|
739
|
+
if (!profile) return void 0;
|
|
740
|
+
const cleaned = {};
|
|
741
|
+
for (const [key, value] of Object.entries(profile)) {
|
|
742
|
+
const kept = cleanProfileValue(value);
|
|
743
|
+
if (kept !== void 0) cleaned[key] = kept;
|
|
744
|
+
}
|
|
745
|
+
return Object.keys(cleaned).length > 0 ? cleaned : void 0;
|
|
746
|
+
}
|
|
747
|
+
function cleanProfileValue(value) {
|
|
748
|
+
if (value === null || value === void 0) return void 0;
|
|
749
|
+
if (typeof value === "string") return value.trim() || void 0;
|
|
750
|
+
if (Array.isArray(value)) {
|
|
751
|
+
const items = value.map((entry) => typeof entry === "string" ? entry.trim() : entry).filter(Boolean);
|
|
752
|
+
return items.length > 0 ? items : void 0;
|
|
753
|
+
}
|
|
754
|
+
if (typeof value !== "object") return void 0;
|
|
755
|
+
const inner = Object.fromEntries(
|
|
756
|
+
Object.entries(value).map(([k, v]) => [k, cleanProfileValue(v)]).filter(([, v]) => v !== void 0)
|
|
757
|
+
);
|
|
758
|
+
return Object.keys(inner).length > 0 ? inner : void 0;
|
|
759
|
+
}
|
|
760
|
+
function mergeCognitionProfiles(current, patch) {
|
|
761
|
+
const patchRecord = patch;
|
|
762
|
+
const removals = Object.keys(patchRecord).filter(
|
|
763
|
+
(key) => patchRecord[key] === null || patchRecord[key] === void 0
|
|
764
|
+
);
|
|
765
|
+
const base = current ?? {};
|
|
766
|
+
const merged = merge(
|
|
767
|
+
omit(base, removals),
|
|
768
|
+
omit(patch, removals),
|
|
769
|
+
true
|
|
770
|
+
);
|
|
771
|
+
const profile = normalizeCognitionProfile(merged) ?? {};
|
|
772
|
+
const before = normalizeCognitionProfile(base) ?? {};
|
|
773
|
+
const changed = JSON.stringify(profile) !== JSON.stringify(before);
|
|
774
|
+
return { profile: changed ? profile : void 0, removals };
|
|
775
|
+
}
|
|
776
776
|
var cardSchema = z.object(
|
|
777
777
|
{
|
|
778
778
|
url: safeUrl({ message: "cards entries must have a valid url" }),
|
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.
|
|
4
|
+
"version": "0.1.18",
|
|
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.
|
|
63
|
+
"ai": "^7.0.91",
|
|
64
64
|
"zod": "^4.5.4"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
@@ -98,11 +98,6 @@ type ProviderConfig = {
|
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
-
interface FormatZodShapeOptions {
|
|
102
|
-
overrides?: Record<string, string>;
|
|
103
|
-
}
|
|
104
|
-
declare function formatZodShape(schema: z.ZodType, options?: FormatZodShapeOptions): string;
|
|
105
|
-
|
|
106
101
|
declare const DEFAULT_VARIANT_ID = "default";
|
|
107
102
|
declare const TEMPLATES: readonly ["article", "news", "describe", "compare", "ocr", "summary", "evaluation", "product", "shoplist", "imagelist", "videolist", "stockmarketitem", "stockmarketlist", "merge", "text"];
|
|
108
103
|
type TemplateName = (typeof TEMPLATES)[number];
|
|
@@ -111,21 +106,21 @@ type ImageTaskTemplate = (typeof IMAGE_TASK_TEMPLATES)[number];
|
|
|
111
106
|
declare function isImageTaskTemplate(template: string): template is ImageTaskTemplate;
|
|
112
107
|
declare const IntentSchema: z.ZodObject<{
|
|
113
108
|
template: z.ZodEnum<{
|
|
109
|
+
text: "text";
|
|
110
|
+
summary: "summary";
|
|
114
111
|
article: "article";
|
|
112
|
+
evaluation: "evaluation";
|
|
113
|
+
merge: "merge";
|
|
115
114
|
news: "news";
|
|
115
|
+
stockmarketitem: "stockmarketitem";
|
|
116
|
+
stockmarketlist: "stockmarketlist";
|
|
116
117
|
describe: "describe";
|
|
117
118
|
compare: "compare";
|
|
118
119
|
ocr: "ocr";
|
|
119
|
-
summary: "summary";
|
|
120
|
-
evaluation: "evaluation";
|
|
121
120
|
product: "product";
|
|
122
121
|
shoplist: "shoplist";
|
|
123
122
|
imagelist: "imagelist";
|
|
124
123
|
videolist: "videolist";
|
|
125
|
-
stockmarketitem: "stockmarketitem";
|
|
126
|
-
stockmarketlist: "stockmarketlist";
|
|
127
|
-
merge: "merge";
|
|
128
|
-
text: "text";
|
|
129
124
|
}>;
|
|
130
125
|
prompt: z.ZodDefault<z.ZodString>;
|
|
131
126
|
tools: z.ZodArray<z.ZodEnum<{
|
|
@@ -200,4 +195,9 @@ declare const IntentSchema: z.ZodObject<{
|
|
|
200
195
|
}, z.core.$strip>;
|
|
201
196
|
type IntentResult = z.infer<typeof IntentSchema>;
|
|
202
197
|
|
|
198
|
+
interface FormatZodShapeOptions {
|
|
199
|
+
overrides?: Record<string, string>;
|
|
200
|
+
}
|
|
201
|
+
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 };
|