@triplef/agent 0.1.24 → 0.1.26
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/{format-zod-shape.helper-C2PB6Sb2.d.ts → format-zod-shape.helper-BQtOJfG6.d.ts} +7 -7
- package/dist/prompts/index.d.ts +25 -10
- package/dist/prompts/index.mjs +167 -58
- package/dist/schemas/index.d.ts +25 -2
- package/dist/schemas/index.mjs +194 -14
- package/dist/tools/index.d.ts +59 -3
- package/dist/tools/index.mjs +91 -9
- package/package.json +2 -2
package/dist/tools/index.mjs
CHANGED
|
@@ -950,6 +950,47 @@ function createVariantRequestTool(variant) {
|
|
|
950
950
|
execute: async () => ({ variant })
|
|
951
951
|
});
|
|
952
952
|
}
|
|
953
|
+
var memoryCognitionDeleteSchema = z.object({
|
|
954
|
+
text: z.string().min(3).max(2e3).optional().describe(
|
|
955
|
+
"The exact stored insight to delete, quoted verbatim from your injected cognition context (the probed insights block). Record texts are the record identity \u2014 no ids needed. Never paraphrase."
|
|
956
|
+
),
|
|
957
|
+
path: z.string().min(3).max(200).optional().describe(
|
|
958
|
+
'One profile routing path ("field.keyword", e.g. "likes.jazz") to prune a standing topic from the structured profile document. Array facets (likes, dislikes, interests, goals, expertise, convictions) drop the matching value; record facets (preferences, corrections) drop the matching key.'
|
|
959
|
+
)
|
|
960
|
+
});
|
|
961
|
+
function createMemoryCognitionDeleteTool(deps) {
|
|
962
|
+
return tool({
|
|
963
|
+
description: 'Delete one targeted piece of your cognition space (memory-cognition): pass the verbatim insight text from your injected cognition context to delete that stored insight, and/or a profile path ("field.keyword", e.g. "likes.jazz") to prune that standing topic from your structured profile. Use when the user asks to forget a preference, an interest, or any other subjective profile datum \u2014 the per-item forget for the cognition lane. To forget EVERYTHING you know about the user instead (profile AND all insights), use memory-cognition-forget. Deletion is permanent; the result confirms exactly what was removed.',
|
|
964
|
+
inputSchema: memoryCognitionDeleteSchema,
|
|
965
|
+
execute: async ({ text, path }) => {
|
|
966
|
+
try {
|
|
967
|
+
if (!text && !path) {
|
|
968
|
+
return {
|
|
969
|
+
deleted: 0,
|
|
970
|
+
pruned: [],
|
|
971
|
+
error: "Pass text (verbatim insight) and/or path (profile topic) \u2014 a targeted delete needs at least one."
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
const outcome = await deps.deleteCognitionRecords({
|
|
975
|
+
memoryCognition: deps.scope.memoryCognition ?? deps.scope.memoryPartition,
|
|
976
|
+
text,
|
|
977
|
+
path
|
|
978
|
+
});
|
|
979
|
+
return outcome.deleted > 0 || outcome.pruned.length > 0 ? { deleted: outcome.deleted, removed: outcome.texts, pruned: outcome.pruned } : {
|
|
980
|
+
deleted: 0,
|
|
981
|
+
pruned: [],
|
|
982
|
+
message: 'No stored insight matches that exact text or path \u2014 quote the insight verbatim from your injected cognition context, or name the profile path exactly (e.g. "likes.jazz").'
|
|
983
|
+
};
|
|
984
|
+
} catch (error) {
|
|
985
|
+
return {
|
|
986
|
+
deleted: 0,
|
|
987
|
+
pruned: [],
|
|
988
|
+
error: error instanceof Error ? error.message : "cognition delete failed"
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
});
|
|
993
|
+
}
|
|
953
994
|
var memoryCognitionForgetSchema = z.object({});
|
|
954
995
|
function createMemoryCognitionForgetTool(deps) {
|
|
955
996
|
return tool({
|
|
@@ -985,7 +1026,7 @@ var memoryCognitionRememberSchema = z.object({
|
|
|
985
1026
|
});
|
|
986
1027
|
function createMemoryCognitionRememberTool(deps) {
|
|
987
1028
|
return tool({
|
|
988
|
-
description: 'Store one
|
|
1029
|
+
description: 'Store one insight into your cognition space (memory-cognition) \u2014 the exclusive store for SUBJECTIVE user data: preferences and interests the user STATES ("the user likes\u2026", "the user is interested in\u2026") plus what you LEARN about them (inferred traits, standing interests, working nuances, connections between facts). Objective facts (contact info, decisions, project details, events) belong in memory-partition-remember, never here. One self-contained third-person sentence per call, lead with the topic. Optionally attach a path (e.g. "likes.cars") when the insight deepens a stored profile value. Restating an insight verbatim updates it in place.',
|
|
989
1030
|
inputSchema: memoryCognitionRememberSchema,
|
|
990
1031
|
execute: async ({ text, path }) => {
|
|
991
1032
|
try {
|
|
@@ -1043,7 +1084,7 @@ var memoryPartitionRecallSchema = z.object({
|
|
|
1043
1084
|
});
|
|
1044
1085
|
function createMemoryPartitionRecallTool(deps) {
|
|
1045
1086
|
return tool({
|
|
1046
|
-
description: `Retrieve from the user's fact partition (memory-partition) \u2014
|
|
1087
|
+
description: `Retrieve from the user's fact partition (memory-partition) \u2014 objective facts they told you in past conversations or asked you to remember (contact details, decisions, project facts, past topics). These are trusted user statements, NOT public facts. Use when the user asks whether you remember something they told you or refers back to a statement from earlier conversations; the results are also the verbatim source for memory-partition-delete. For "where did we leave off" / "what were we doing recently" questions use your injected RECENT CONVERSATIONS notes instead \u2014 this lane holds what the user told you, not the log of your recent activity. For the user's preferences or what you have LEARNED about them, look to your cognition space (the injected profile and insights) \u2014 subjective user data is never stored in this partition. Attribute what you find to the user ("you mentioned\u2026", "you asked me to remember\u2026") and prefer it over web-search results for anything personal. Retrieval is semantic and sentence-aware \u2014 ask in natural language. Optionally restrict by topic tags (e.g. ["contacts"]) or exact phrase containment.`,
|
|
1047
1088
|
inputSchema: memoryPartitionRecallSchema,
|
|
1048
1089
|
execute: async ({ query, tags, contains, topK }) => {
|
|
1049
1090
|
const hits = await deps.searchByText({
|
|
@@ -1070,7 +1111,16 @@ ${lines.join("\n")}`;
|
|
|
1070
1111
|
var memoryPartitionRememberSchema = z.object({
|
|
1071
1112
|
text: z.string().min(1).max(2e3).describe('The fact to remember, as a self-contained statement, e.g. "Sams phone number is 555-1234".'),
|
|
1072
1113
|
category: z.string().min(1).max(40).optional().describe(
|
|
1073
|
-
'One broad lowercase PLURAL category the fact belongs to, e.g. "stocks", "games", "pets", "work" \u2014 a family noun, never a specific entity/product/company/game name ("amd" \u2192 "stocks"; "stellar blade" \u2192 "games"). Always include it.'
|
|
1114
|
+
'One broad lowercase PLURAL category the fact belongs to, e.g. "stocks", "games", "pets", "work" \u2014 the CLUSTER tier: a family noun, never a specific entity/product/company/game name ("amd" \u2192 "stocks"; "stellar blade" \u2192 "games"). Always include it.'
|
|
1115
|
+
),
|
|
1116
|
+
community: z.string().min(1).max(60).optional().describe(
|
|
1117
|
+
'One lowercase PLURAL sub-family narrowing the category, e.g. "survival games" under "games" \u2014 the COMMUNITY tier, one level below the cluster (a genre, project family, or domain branch). Omit it when no sub-family applies; never a specific entity, product, or title.'
|
|
1118
|
+
),
|
|
1119
|
+
subject: z.string().min(1).max(40).optional().describe(
|
|
1120
|
+
'The lowercase SINGULAR entity the fact is about \u2014 the HUB tier, e.g. "project zomboid", "amd", "sam". Name it whenever the fact is about a specific entity; never a plural family label.'
|
|
1121
|
+
),
|
|
1122
|
+
icon: z.string().min(1).max(64).optional().describe(
|
|
1123
|
+
'Lucide icon name for a label you are CREATING in this call (attached to the deepest NEW label: subject first, then community, then category). Only from the curated taxonomy icon set (e.g. "gamepad-2", "book-open", "paw-print"); omit entirely when you adopt existing labels or no icon fits.'
|
|
1074
1124
|
),
|
|
1075
1125
|
tags: z.array(z.string().min(1).max(40)).max(8).optional().describe(
|
|
1076
1126
|
'Optional topic labels (lowercase, reusable, NARROW \u2014 entity/product/game names) so future recall can filter by topic, e.g. ["contacts", "sam"], ["amd"], ["stellar blade"].'
|
|
@@ -1078,9 +1128,9 @@ var memoryPartitionRememberSchema = z.object({
|
|
|
1078
1128
|
});
|
|
1079
1129
|
function createMemoryPartitionRememberTool(deps) {
|
|
1080
1130
|
return tool({
|
|
1081
|
-
description: 'Store into the user\'s fact partition (memory-partition): notable facts about subjects they care about (
|
|
1131
|
+
description: 'Store into the user\'s fact partition (memory-partition) \u2014 OBJECTIVE facts only: notable external-world facts about subjects they care about (projects, followed stocks, games, people, past topics), objective details they state as fact (contact info, decisions, constraints, their setup), and objective facts they explicitly ask you to remember. You MUST NOT store subjective user data here \u2014 preferences, interests, likes/dislikes, behavioral traits, or internal states ("the user likes\u2026") belong to the cognition tier (memory-cognition-remember). Storing gathered knowledge is expected \u2014 do not wait for an explicit "remember" instruction. This memory outlives the conversation and is recalled later with memory-partition-recall. STORAGE MECHANICS: each record is embedded as a whole and matched sentence-by-sentence at recall time \u2014 write ONE self-contained statement per call (a single dense sentence is fine, subject up front), restating a record verbatim updates it in place, tags are the recall filter vocabulary (lowercase, reusable), and the macro-taxonomy routes each record exactly once: `category` one broad PLURAL family label (games, pets, work, health \u2026 \u2014 the cluster tier), `community` one PLURAL sub-family under it when one applies (survival games, action rpgs \u2026), `subject` the SINGULAR entity the fact is about (project zomboid, amd, sam \u2026 \u2014 the hub tier). Always include category; include subject for entity facts; reuse existing labels whenever they fit.',
|
|
1082
1132
|
inputSchema: memoryPartitionRememberSchema,
|
|
1083
|
-
execute: async ({ text, tags, category }) => {
|
|
1133
|
+
execute: async ({ text, tags, category, community, subject, icon }) => {
|
|
1084
1134
|
try {
|
|
1085
1135
|
const id = await deps.storeRecord({
|
|
1086
1136
|
memoryPartition: deps.scope.memoryPartition,
|
|
@@ -1089,7 +1139,10 @@ function createMemoryPartitionRememberTool(deps) {
|
|
|
1089
1139
|
requestId: deps.scope.requestId,
|
|
1090
1140
|
text,
|
|
1091
1141
|
tags,
|
|
1092
|
-
category
|
|
1142
|
+
category,
|
|
1143
|
+
community,
|
|
1144
|
+
subject,
|
|
1145
|
+
icon
|
|
1093
1146
|
});
|
|
1094
1147
|
return { stored: true, id };
|
|
1095
1148
|
} catch (error) {
|
|
@@ -1101,6 +1154,35 @@ function createMemoryPartitionRememberTool(deps) {
|
|
|
1101
1154
|
}
|
|
1102
1155
|
});
|
|
1103
1156
|
}
|
|
1157
|
+
var memoryTaxonomyProbeSchema = z.object({
|
|
1158
|
+
kind: z.enum(["cluster", "community", "hub"]).describe(
|
|
1159
|
+
"Which tier to probe. Top-down order: cluster (PLURAL family noun) \u2192 community (PLURAL sub-family under one cluster) \u2192 hub (SINGULAR main subject entity)."
|
|
1160
|
+
),
|
|
1161
|
+
query: z.string().min(1).max(120).describe(
|
|
1162
|
+
'The label you are considering (e.g. "games", "survival games", "project zomboid") \u2014 scored against the existing taxonomy by name similarity and meaning.'
|
|
1163
|
+
),
|
|
1164
|
+
parentId: z.string().optional().describe(
|
|
1165
|
+
"The adopted node id from the tier ABOVE (community probes pass the adopted cluster id; hub probes pass the adopted community or cluster id). Narrows the candidacy to that parent; omit only when you are about to CREATE the parent."
|
|
1166
|
+
)
|
|
1167
|
+
});
|
|
1168
|
+
function createMemoryTaxonomyProbeTool(deps) {
|
|
1169
|
+
return tool({
|
|
1170
|
+
description: 'Probe the macro-taxonomy before naming a label \u2014 MANDATORY before any community or hub you are not already certain exists. Work top-down: first probe kind="cluster" with the family label you intend; ADOPT a returned candidate by using its name verbatim (keep its id for the next probe), or CREATE when nothing fits. Then probe kind="community" with parentId = the cluster id (omit parentId when you are creating the cluster), then kind="hub" with parentId = the community or cluster id above it. Creation phrasing: cluster/community are PLURAL family nouns, never a specific entity or title; a hub is the SINGULAR main subject entity. The taxonomy is read-only: never invent a near-duplicate of a listed candidate \u2014 name the candidate VERBATIM.',
|
|
1171
|
+
inputSchema: memoryTaxonomyProbeSchema,
|
|
1172
|
+
execute: async (input) => {
|
|
1173
|
+
try {
|
|
1174
|
+
return await deps.probe(input);
|
|
1175
|
+
} catch (error) {
|
|
1176
|
+
return {
|
|
1177
|
+
kind: input.kind,
|
|
1178
|
+
query: input.query,
|
|
1179
|
+
candidates: [],
|
|
1180
|
+
guidance: `Probe failed (${error instanceof Error ? error.message : "unknown error"}) \u2014 fall back to the phrasing rules and create the label.`
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
});
|
|
1185
|
+
}
|
|
1104
1186
|
var serperBusinessReviewsSearchSchema = z.object({
|
|
1105
1187
|
query: z.string().optional().describe(
|
|
1106
1188
|
"The exact business or place name, ideally with its location, named explicitly and resolved from the conversation. Used when neither placeId nor cid is known."
|
|
@@ -1665,8 +1747,8 @@ var defaultSummarize = (data) => {
|
|
|
1665
1747
|
if (typeof data.content === "string") return summarizeContent(data);
|
|
1666
1748
|
return {};
|
|
1667
1749
|
};
|
|
1668
|
-
function withSummary(
|
|
1669
|
-
const t =
|
|
1750
|
+
function withSummary(tool28, summarize = defaultSummarize) {
|
|
1751
|
+
const t = tool28;
|
|
1670
1752
|
t.summarize = summarize;
|
|
1671
1753
|
return t;
|
|
1672
1754
|
}
|
|
@@ -1849,4 +1931,4 @@ function createYoutubeVideoSearch(deps) {
|
|
|
1849
1931
|
});
|
|
1850
1932
|
}
|
|
1851
1933
|
|
|
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 };
|
|
1934
|
+
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, createMemoryCognitionDeleteTool, createMemoryCognitionForgetTool, createMemoryCognitionRememberTool, createMemoryPartitionDeleteTool, createMemoryPartitionRecallTool, createMemoryPartitionRememberTool, createMemoryTaxonomyProbeTool, createSerperBusinessReviewsSearch, createSerperImageSearch, createSerperNewsSearch, createSerperPlacesSearch, createSerperShoppingSearch, createSerperVideoSearch, createSerperWebSearch, createSerperWebpageScrape, createVariantRequestTool, createWebFetchTool, createYoutubeVideoSearch, defaultSummarize, encyclopediaReadSchema, encyclopediaSearchSchema, engineEnabled, extractArticleText, fetchWithTimeout, isGoogleHostUrl, localizedQuerySuffix, meetsMinimumImageDimensions, memoryCognitionDeleteSchema, memoryCognitionForgetSchema, memoryCognitionRememberSchema, memoryPartitionDeleteSchema, memoryPartitionRecallSchema, memoryPartitionRememberSchema, memoryTaxonomyProbeSchema, 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.
|
|
4
|
+
"version": "0.1.26",
|
|
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.93",
|
|
64
64
|
"zod": "^4.5.4"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|