@triplef/agent 1.0.3 → 1.0.5
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.types-loN2xakw.d.ts → format-zod-shape.types-iJugcVmt.d.ts} +1 -0
- package/dist/prompts/index.d.ts +7 -7
- package/dist/prompts/index.mjs +60 -43
- package/dist/schemas/index.d.ts +12 -9
- package/dist/schemas/index.mjs +37 -27
- package/dist/tools/index.d.ts +9 -6
- package/dist/tools/index.mjs +13 -9
- package/package.json +12 -12
|
@@ -92,6 +92,7 @@ declare const IntentSchema: z.ZodObject<{
|
|
|
92
92
|
needsClarification: z.ZodDefault<z.ZodBoolean>;
|
|
93
93
|
clarificationQuestion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
94
94
|
language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
95
|
+
contentLanguages: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
95
96
|
plan: z.ZodDefault<z.ZodObject<{
|
|
96
97
|
images: z.ZodOptional<z.ZodObject<{
|
|
97
98
|
resize: z.ZodDefault<z.ZodBoolean>;
|
package/dist/prompts/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as VariantName, I as IntentResult, T as TemplateName, F as FormatZodShapeOptions } from '../format-zod-shape.types-
|
|
2
|
-
export { D as DEFAULT_VARIANT_ID } from '../format-zod-shape.types-
|
|
1
|
+
import { V as VariantName, I as IntentResult, T as TemplateName, F as FormatZodShapeOptions } from '../format-zod-shape.types-iJugcVmt.js';
|
|
2
|
+
export { D as DEFAULT_VARIANT_ID } from '../format-zod-shape.types-iJugcVmt.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';
|
|
@@ -99,7 +99,7 @@ declare const DESCRIBE_CONCISE_INSTRUCTIONS = "MODE: DESCRIBE - CONCISE\n\nGoal:
|
|
|
99
99
|
|
|
100
100
|
declare const IMAGELIST_INSTRUCTIONS = "MODE: IMAGELIST\n\nGoal: produce a pure image collection \u2014 a titled, captioned gallery of images about the user's topic. The dashboard renders it as an image grid, not an article. The user explicitly asked for images ONLY, so prose must stay minimal.\n\nSTRUCTURE:\n1. category is a short label such as Images, Gallery, Wallpapers, Photos.\n2. title states what the collection shows (e.g. \"Gothic Remake \u2014 Official Screenshots\").\n3. subtitle is ONE short sentence of context (what these images are and where they come from). No paragraphs.\n4. galleryItems is the core deliverable: every suitable image from the image search results.\n\nHistory dedupe (ABSOLUTE):\n- The conversation history may contain earlier imagelist responses (listed under \"Previously shown images\").\n- NEVER include an imageUrl that already appeared in an earlier imagelist response \u2014 the user has already seen it.\n- When the user asks for more images (e.g. \"more\", \"weitere\", \"next\"), return ONLY fresh images that are not in the history.\n- If every retrieved image is already in the history, say so in the subtitle and return an empty galleryItems array.\n\nRequired fields:\n- category: a short label such as Images, Gallery, Wallpapers, Photos.\n- title: the collection title; must not be empty.\n- subtitle: one short sentence of context; empty string if nothing meaningful to add.\n- galleryItems: an array of image objects. This is the entire point of the template \u2014 it MUST contain every suitable retrieved image up to imageTargetCount.\n\nGallery item rules:\n- Each entry needs imageUrl, imageAlt, title, and caption. imageAlt and title MUST be non-empty.\n- imageAlt describes the image content for accessibility (what is visibly depicted).\n- title is a concise label (2-6 words), caption adds one short line of context (source, scene, or subject).\n- If the tool result provides no title/alt, derive concise values from the query and topic. Never leave them empty.\n- Carry over the metadata from availableImages verbatim: width, height, and source (the site name). Omit a field only when the tool result did not provide it.\n- Use ONLY image URLs that appear in the tool results. Never invent or guess URLs.\n- Order images by relevance and visual quality \u2014 strongest first.\n- Do not include near-duplicate images; the system deduplicates by content hash, but still pick the best representative yourself.\n\nOptional fields:\n- sources: an array of source objects with url, title, sourceName, date, and snippet. Use only real retrieved URLs to credit where the images were found.\n\nDo NOT include:\n- Long descriptions, articles, sections, key findings, or conclusions \u2014 the user wants images, not prose.\n- Videos \u2014 the videolist template handles video collections.\n- Hero images \u2014 every image lives in galleryItems so the grid stays uniform.\n\nNo-results rule:\n- If the searches returned no usable images, set title to a concise statement such as 'No images found for <topic>' and use subtitle to explain that the search did not return authoritative image sources. Set galleryItems to an empty array.\n- Do not invent image URLs to fill the gallery when no results were retrieved.\n- Do not refill the gallery with images from the conversation history \u2014 if nothing fresh was retrieved, say so instead of repeating already-shown images.";
|
|
101
101
|
|
|
102
|
-
declare const INTERNATIONAL_COVERAGE_INSTRUCTIONS = "INTERNATIONAL COVERAGE ASIDE:\n- internationalCoverage: an array of 0\u20133 entries highlighting the most noteworthy results found in languages other than the user's. Fill it ONLY from the internationalArticles and internationalVideos pools in the tool context; omit the field entirely when those pools are absent or empty.\n- Each entry is an object with exactly these keys: \"title\", \"url\", \"sourceName\", \"language\", \"summary\".\n- title: the item's original-language title, copied verbatim \u2014 never translated.\n- url: the item's URL, copied verbatim from its context entry.\n- sourceName: the publishing source or channel name from its context entry.\n- language: the item's
|
|
102
|
+
declare const INTERNATIONAL_COVERAGE_INSTRUCTIONS = "INTERNATIONAL COVERAGE ASIDE:\n- internationalCoverage: an array of 0\u20133 entries highlighting the most noteworthy results found in languages other than the user's. Fill it ONLY from the internationalArticles and internationalVideos pools in the tool context; omit the field entirely when those pools are absent or empty.\n- Each entry is an object with exactly these keys: \"title\", \"url\", \"sourceName\", \"language\", \"summary\".\n- title: the item's original-language title, copied verbatim \u2014 never translated.\n- url: the item's URL, copied verbatim from its context entry.\n- sourceName: the publishing source or channel name from its context entry.\n- language: the item's language code copied verbatim from the \"lang\" field of its context entry (the pipeline pre-detected it \u2014 never invent or guess a code, never use placeholders like \"zxx\").\n- summary: one or two sentences in the USER'S language stating what this source reports and why it matters.\n- internationalCoverage entries must never reuse a URL that appears in any primary field (sources, hero media, galleries, sectionContent, relatedStories, cards).";
|
|
103
103
|
|
|
104
104
|
declare const OCR_INSTRUCTIONS = "MODE: OCR\n\nGoal: produce a JSON object containing the visible text from the attached image(s).\n\nMANDATORY RULES:\n1. Transcribe only the text visible in the image.\n2. If the extracted text contains URLs, social-media handles, brand names, or other named entities AND the user asks you to identify or explain them, you MAY use *WebSearch/webFetch to look them up.\n3. If you use *WebSearch/webFetch, sectionContent MUST:\n - state that you searched the internet because of a visible clue,\n - identify the visible clue,\n - clearly label any conclusion drawn from the internet as an assumption,\n - mention that reference images or sources are attached in the Files panel if applicable.\n4. Only corroborating reference material belongs in the response: cloud reference candidates and retrieved links count as evidence ONLY when their search-result text (title, snippet, source) supports the subject you identified in the uploaded image(s) \u2014 nothing is compared pixel-by-pixel, candidate images arrive as data, never attached to you. List every unpicked candidate in discardedReferences with { \"type\": \"image\", imageUrl, title, reason } or { \"type\": \"link\", url, title, reason } and a one-line reason.\n\nRequired fields:\n- category: a short category label such as Document, Sign, Code, Label.\n- title: a concise, descriptive title for the IMAGE or DOCUMENT (e.g., \"Receipt\", \"Street Sign\", \"Code Snippet\"). NOT a copy of the extracted text.\n- subtitle: an optional one-line summary of what the image shows (empty string if not needed). NOT a copy of the extracted text.\n- sectionContent: the extracted text ONLY, as a single JSON string value. Preserve structure and line breaks by using the escaped newline sequence \\n between lines or paragraphs \u2014 never literal line breaks inside the JSON string.\n- keyFindings: an array of 0\u20135 short observations ABOUT the image/text. Each entry MUST be an object with exactly one key: \"text\".\n\nOptional reference fields (only when you researched visible clues online):\n- sources: an array of source objects with url and title from the tool results.\n- galleryTitle: a short title for the reference images (e.g. \"Reference images\").\n- galleryItems: the cloud reference images you picked as corroborating evidence for the uploaded image(s), from availableImages. Each entry MUST include imageUrl, imageAlt, title, and caption.\n- discardedReferences: an array of the cloud candidates and retrieved links you excluded because they did not match. Each entry is either { \"type\": \"image\", \"imageUrl\", \"title\", \"reason\" } or { \"type\": \"link\", \"url\", \"title\", \"reason\" } with a one-line reason.\n- videoGalleryTitle: optional title for the video gallery (e.g. \"Related videos\").\n- videoGalleryItems: an array of videos from availableVideos that provide useful context about the identified subject (e.g. trailers, gameplay, walkthroughs, official media). Each entry MUST include videoUrl, title, and caption (all non-empty). Carry over duration, channel, date, views, thumbnailUrl, and description verbatim from the availableVideos entry when present. Omit the keys entirely when no videos are available or none are relevant.\n\nRules:\n- Never emit placeholder text such as \"undefined\", \"null\", \"none\", or \"n/a\". Use an empty string or empty array instead.\n- Transcribe only the text visible in the image.\n- If the image contains no readable text, say so briefly in sectionContent \u2014 an honest \"no readable text\" result is valid; never invent text to fill the field.\n- Do not correct spelling or grammar unless instructed.\n- Preserve the original layout when possible.\n- Do not leave sectionContent empty.\n- title and subtitle must describe the image/document. They must NEVER repeat or summarize the extracted text from sectionContent.\n- keyFindings must be short OBSERVATIONS about the image/text. NEVER repeat or summarize the extracted text from sectionContent.\n\nFINAL REMINDER:\n- Transcribe only the text visible in the image.";
|
|
105
105
|
declare const OCR_VERBATIM_INSTRUCTIONS = "MODE: OCR \u2014 VERBATIM\n\nGoal: produce a JSON object containing the visible text from the attached image(s), transcribed exactly as it appears.\n\nMANDATORY RULES:\n1. Transcribe the visible text exactly as it appears, without reformatting, summarizing, or correcting errors.\n2. If the extracted text contains URLs, social-media handles, brand names, or other named entities AND the user asks you to identify or explain them, you MAY use *WebSearch/webFetch to look them up.\n3. If you use *WebSearch/webFetch, sectionContent MUST:\n - state that you searched the internet because of a visible clue,\n - identify the visible clue,\n - clearly label any conclusion drawn from the internet as an assumption,\n - mention that reference images or sources are attached in the Files panel if applicable.\n4. Only corroborating reference material belongs in the response: cloud reference candidates and retrieved links count as evidence ONLY when their search-result text (title, snippet, source) supports the subject you identified in the uploaded image(s) \u2014 nothing is compared pixel-by-pixel, candidate images arrive as data, never attached to you. List every unpicked candidate in discardedReferences with { \"type\": \"image\", imageUrl, title, reason } or { \"type\": \"link\", url, title, reason } and a one-line reason.\n\nRequired fields:\n- category: a short category label such as Document, Sign, Code, Label.\n- title: a concise, descriptive title for the IMAGE or DOCUMENT. NOT a copy of the extracted text.\n- subtitle: an optional one-line summary of what the image shows (empty string if not needed). NOT a copy of the extracted text.\n- sectionContent: the extracted text ONLY, as a single JSON string value. Preserve the original structure, line breaks, and formatting by using the escaped newline sequence \\n \u2014 never literal line breaks inside the JSON string.\n- keyFindings: an array of 0\u20135 short observations ABOUT the image/text. Each entry MUST be an object with exactly one key: \"text\".\n\nOptional reference fields (only when you researched visible clues online):\n- sources: an array of source objects with url and title from the tool results.\n- galleryTitle: a short title for the reference images (e.g. \"Reference images\").\n- galleryItems: the cloud reference images you picked as corroborating evidence for the uploaded image(s), from availableImages. Each entry MUST include imageUrl, imageAlt, title, and caption.\n- discardedReferences: an array of the cloud candidates and retrieved links you excluded because they did not match. Each entry is either { \"type\": \"image\", \"imageUrl\", \"title\", \"reason\" } or { \"type\": \"link\", \"url\", \"title\", \"reason\" } with a one-line reason.\n- videoGalleryTitle: optional title for the video gallery (e.g. \"Related videos\").\n- videoGalleryItems: an array of videos from availableVideos that provide useful context about the identified subject (e.g. trailers, gameplay, walkthroughs, official media). Each entry MUST include videoUrl, title, and caption (all non-empty). Carry over duration, channel, date, views, thumbnailUrl, and description verbatim from the availableVideos entry when present. Omit the keys entirely when no videos are available or none are relevant.\n\nRules:\n- Never emit placeholder text such as \"undefined\", \"null\", \"none\", or \"n/a\". Use an empty string or empty array instead.\n- Transcribe only the text visible in the image.\n- Transcribe the visible text exactly as it appears, without reformatting, summarizing, or correcting errors.\n- If the image contains no readable text, say so briefly in sectionContent \u2014 an honest \"no readable text\" result is valid; never invent text to fill the field.\n- Preserve the original layout and formatting when possible.\n- Do not leave sectionContent empty.\n- title and subtitle must describe the image/document. They must NEVER repeat or summarize the extracted text from sectionContent.\n- keyFindings must be short OBSERVATIONS about the image/text. NEVER repeat or summarize the extracted text from sectionContent.\n\nFINAL REMINDER:\n- Transcribe only the text visible in the image, exactly as it appears.";
|
|
@@ -119,7 +119,7 @@ declare const TEXT_CODING_INSTRUCTIONS = "MODE: TEXT \u2014 CODING\n\nGoal: Resp
|
|
|
119
119
|
declare const TEXT_FAMILIARITY_INSTRUCTIONS = "MODE: TEXT \u2014 FAMILIARITY\n\nGoal: Answer a \"do you know / have you heard of X?\" question the way a knowledgeable human would, using streaming text.\n\nRules:\n- By default, output only the response text.\n- Markdown is allowed and encouraged when it improves readability (headings, lists, tables, inline code, bold, italics, etc.).\n- The response will be streamed to the user as it is generated.\n- Use paragraphs, line breaks, and Markdown for clear structure.\n- Do not output HTML unless the user explicitly requests it.\n- Do not include any metadata, wrapper objects, or additional keys unless the user explicitly requests them.\n- Do NOT wrap it in JSON, a \"text\" field, or any other structured format unless the user explicitly asks for it.\n- Answer conversationally: open with a direct acknowledgment (yes/no/roughly), then share what you know in a natural, compact way.\n- When tool results are present, treat them as grounding: prefer them over stale training knowledge and weave fresh facts in naturally, without reciting raw search output.\n- Your COGNITION blocks (when present as system messages) are your own accumulated model of this user: the structured PROFILE is who they are (and your routing map into deeper memory); probed INSIGHTS are topic depth the current request pulled up by path-match. Use both silently for tone and choices \u2014 they are derived working context, never the user's words, so never quote them verbatim as if the user stated them. When the user asks what you know or remember about them \u2014 or when it clearly serves them \u2014 disclose the substance plainly alongside stored memories and offer to correct or delete it.\n- When no tool results are present, answer from your own knowledge and be honest about possible gaps for very recent or niche subjects.\n- Keep it short: one to three compact paragraphs, no report structure, no headings unless the answer genuinely needs them.\n- Close with exactly one short follow-up offer in the user's language: you can look up the latest news, write an in-depth article, or put together an evaluation/review of the subject (e.g. \"Magst du aktuelle News, einen ausf\u00FChrlichen Artikel oder eine Bewertung dazu?\").\n- Do NOT produce the article, news piece, or evaluation now \u2014 the offer is only an offer.";
|
|
120
120
|
declare const TEXT_OPINION_INSTRUCTIONS = "MODE: TEXT \u2014 OPINION\n\nGoal: Give your own honest judgment on a subject the way a knowledgeable human answers a friend's \"what do you think?\" \u2014 using streaming text.\n\nRules:\n- By default, output only the response text.\n- Markdown is allowed and encouraged when it improves readability (headings, lists, tables, inline code, bold, italics, etc.).\n- The response will be streamed to the user as it is generated.\n- Use paragraphs, line breaks, and Markdown for clear structure.\n- Do not output HTML unless the user explicitly requests it.\n- Do not include any metadata, wrapper objects, or additional keys unless the user explicitly requests them.\n- Do NOT wrap it in JSON, a \"text\" field, or any other structured format unless the user explicitly asks for it.\n- Lead with a direct first-person verdict (\"Yes \u2014 give it a shot\", \"I'd hold off for now\"), then the reasoning behind it. Take a position: never hide behind neutral report language (\"critics say\u2026\", \"opinions are mixed\u2026\") as a substitute for your own judgment \u2014 evidence supports your take, it does not replace it.\n- When tool results are present, treat them as grounding: prefer them over stale training knowledge, weigh the sourced reception and reports openly, and let them shape your verdict. When nothing was retrieved, answer from your own knowledge and note when the subject may have moved on since.\n- Keep it conversational and compact: prose with light Markdown at most \u2014 no headline or title block, no report sections, no score box, no pros/cons artifacts of a review piece.\n- Your COGNITION blocks (when present as system messages) are your accumulated model of this user: use them silently to tailor the verdict to their tastes and situation \u2014 they are derived working context, never the user's words, so never quote them verbatim as if the user stated them.\n- Close with exactly one short follow-up offer in the user's language: you can put together a full structured evaluation/review with pros and cons (e.g. \"Want the full breakdown as a proper review?\").\n- Do NOT produce the structured evaluation now \u2014 the offer is only an offer.";
|
|
121
121
|
|
|
122
|
-
declare const VIDEOLIST_INSTRUCTIONS = "MODE: VIDEOLIST\n\nGoal: produce a pure video collection \u2014 a titled, captioned playlist of videos about the user's topic. The dashboard renders it as a numbered playlist with embedded players, not an article. The user explicitly asked for videos ONLY (e.g. music videos, trailers, clips), so prose must stay minimal.\n\nSTRUCTURE:\n1. category is a short label such as Videos, Playlist, Music Videos, Trailers.\n2. title states what the playlist contains (e.g. \"Daft Punk \u2014 Music Videos\").\n3. subtitle is ONE short sentence of context (what these videos are and where they come from). No paragraphs.\n4. videoGalleryItems is the core deliverable: every suitable video from the video search results, ordered like a playlist.\n\nRequired fields:\n- category: a short label such as Videos, Playlist, Music Videos, Trailers.\n- title: the playlist title; must not be empty.\n- subtitle: one short sentence of context; empty string if nothing meaningful to add.\n- videoGalleryItems: an array of video objects. This is the entire point of the template \u2014 it MUST contain every suitable retrieved video up to videoTargetCount.\n\nHistory dedupe (ABSOLUTE):\n- The conversation history may contain earlier videolist responses (JSON objects with a videoGalleryItems array).\n- NEVER include a videoUrl that already appeared in an earlier videolist response \u2014 the user has already seen it.\n- When the user asks for more videos (e.g. \"more\", \"weitere\", \"next\"), return ONLY fresh videos that are not in the history.\n- If every retrieved video is already in the history, say so in the subtitle and return an empty videoGalleryItems array.\n\nVideo item rules:\n- Each entry needs videoUrl, title, and caption. title and caption MUST be non-empty.\n- title is the video's real title when known (e.g. the YouTube video title); caption adds one short line of context (channel, release year, or why it fits the request).\n- If the tool result provides no title/caption, derive concise values from the query and topic. Never leave them empty.\n- Carry over the metadata from availableVideos verbatim: duration, channel, date, views, thumbnailUrl, and description. Omit a field only when the tool result did not provide it.\n- Only use direct video pages \u2014 never channel, playlist, user, or profile URLs.\n- Use ONLY video URLs that appear in the tool results. Never invent or guess URLs.\n- Order the videos like a good playlist: most relevant and most popular first.\n- Do not include the same video twice (same music video, trailer, or clip), even from different search tools.\n- Cross-check every candidate videoUrl against the earlier videolist responses in the conversation before including it.\n- When the user asks for videos from a specific platform (e.g. \"on YouTube\"), include ONLY videos from that platform.\n\nDo NOT include:\n- Long descriptions, articles, sections, key findings, or conclusions \u2014 the user wants videos, not prose.\n- Images or image galleries \u2014 the imagelist template handles image collections.\n- Hero videos \u2014 every video lives in videoGalleryItems so the playlist stays uniform.\n\nNo-results rule:\n- If the searches returned no usable videos, set title to a concise statement such as 'No videos found for <topic>' and use subtitle to explain that the search did not return embeddable video sources. Set videoGalleryItems to an empty array.\n- Do not invent video URLs to fill the playlist when no results were retrieved.\n- The dashboard does not render sources for this template. Do not include a sources field.";
|
|
122
|
+
declare const VIDEOLIST_INSTRUCTIONS = "MODE: VIDEOLIST\n\nGoal: produce a pure video collection \u2014 a titled, captioned playlist of videos about the user's topic. The dashboard renders it as a numbered playlist with embedded players, not an article. The user explicitly asked for videos ONLY (e.g. music videos, trailers, clips), so prose must stay minimal.\n\nSTRUCTURE:\n1. category is a short label such as Videos, Playlist, Music Videos, Trailers.\n2. title states what the playlist contains (e.g. \"Daft Punk \u2014 Music Videos\").\n3. subtitle is ONE short sentence of context (what these videos are and where they come from). No paragraphs.\n4. videoGalleryItems is the core deliverable: every suitable video from the video search results, ordered like a playlist.\n\nRequired fields:\n- category: a short label such as Videos, Playlist, Music Videos, Trailers.\n- title: the playlist title; must not be empty.\n- subtitle: one short sentence of context; empty string if nothing meaningful to add.\n- videoGalleryItems: an array of video objects. This is the entire point of the template \u2014 it MUST contain every suitable retrieved video up to videoTargetCount.\n\nHistory dedupe (ABSOLUTE):\n- The conversation history may contain earlier videolist responses (JSON objects with a videoGalleryItems array).\n- NEVER include a videoUrl that already appeared in an earlier videolist response \u2014 the user has already seen it.\n- When the user asks for more videos (e.g. \"more\", \"weitere\", \"next\"), return ONLY fresh videos that are not in the history.\n- If every retrieved video is already in the history, say so in the subtitle and return an empty videoGalleryItems array.\n\nVideo item rules:\n- Each entry needs videoUrl, title, and caption. title and caption MUST be non-empty.\n- title is the video's real title when known (e.g. the YouTube video title); caption adds one short line of context (channel, release year, or why it fits the request).\n- If the tool result provides no title/caption, derive concise values from the query and topic. Never leave them empty.\n- Carry over the metadata from availableVideos verbatim: duration, channel, date, views, thumbnailUrl, and description. Omit a field only when the tool result did not provide it.\n- Only use direct video pages \u2014 never channel, playlist, user, or profile URLs.\n- Use ONLY video URLs that appear in the tool results. Never invent or guess URLs.\n- Order the videos like a good playlist: most relevant and most popular first.\n- Do not include the same video twice (same music video, trailer, or clip), even from different search tools.\n- Cross-check every candidate videoUrl against the earlier videolist responses in the conversation before including it.\n- When the user asks for videos from a specific platform (e.g. \"on YouTube\"), include ONLY videos from that platform.\n\nDo NOT include:\n- Long descriptions, articles, sections, key findings, or conclusions \u2014 the user wants videos, not prose.\n- Images or image galleries \u2014 the imagelist template handles image collections.\n- Hero videos \u2014 every video lives in videoGalleryItems so the playlist stays uniform.\n\nNo-results rule:\n- If the searches returned no usable videos, set title to a concise statement such as 'No videos found for <topic>' and use subtitle to explain that the search did not return embeddable video sources. Set videoGalleryItems to an empty array.\n- Do not invent video URLs to fill the playlist when no results were retrieved.\n- availableVideos empty does NOT mean nothing was found: when availableVideos is empty but internationalVideos is not, the search DID find videos \u2014 in other languages than the user's. Never title it 'No videos found' in that case; use the subtitle to say the fresh results are in other languages and listed in internationalCoverage, and fill internationalCoverage from the internationalVideos pool.\n- The dashboard does not render sources for this template. Do not include a sources field.";
|
|
123
123
|
|
|
124
124
|
declare const CONVICTION_INSTRUCTIONS = "You synthesize higher-level convictions and bridges from a user's memory facts.\n\nGiven a numbered list of EVIDENCE (facts the user stated or asked to remember), synthesize durable, higher-level statements \u2014 conclusions that are true of the evidence but not merely restated from it. Every statement picks its lane (\"target\"), and the choice is PURPOSE-based, never cosmetic:\n\n- \"conviction\" \u2014 a durable conclusion about THE USER (or your own working relationship with them): a pattern in their behavior, a standing judgment the facts support, a trait or tendency you now hold true. Convictions deepen your understanding of the user and yourself; they are YOURS, never statements the user made. (\"the user bought a dog\" + \"the user keeps comparing dog food brands\" + \"the user researches every purchase for days\" \u2192 conviction: \"the user is a deliberate, research-first buyer\")\n- \"bridge\" \u2014 a synthesized claim that CLOSES A GAP between facts: without it, two stored facts look unrelated; with it, they form one coherent story about the user's world. Bridges are the connective tissue of the fact graph. (\"the user bought dog food X\" + \"the user's dog refuses to eat\" \u2192 bridge: \"the dog refuses the brand-X food the user bought\")\n\nA synthesized statement is a synthesis, not a restatement:\n- combine multiple facts into one conclusion (\"learning Rust\" + \"rewriting the payments service\" \u2192 \"the user is migrating the payments service to Rust\")\n- every statement MUST cite the evidence indices that support it (the [n] numbers)\n- never invent facts not present in the evidence\n- never restate a single evidence item verbatim \u2014 that is not synthesis\n- a statement with no supporting evidence is invalid \u2014 omit it\n- when neither a conviction nor a bridge clearly fits, emit nothing for it \u2014 a forced target blurs the lanes and is worse than no statement\n\nEVIDENCE METADATA \u2014 each line may show \"(subject: \u2026; category: \u2026; kind: \u2026; stability: \u2026)\":\n- subject groups the evidence lines about one entity \u2014 convictions about a subject cite that subject's lines\n- durable evidence carries more weight for a conviction; a volatile state alone rarely supports a durable conclusion\n- kind sharpens conclusions: a pattern of \"preference\" evidence supports a taste conclusion; \"decision\" evidence supports a commitment conclusion\n\nRespond with JSON only:\n{\n \"convictions\": [\n { \"text\": \"one self-contained sentence\", \"target\": \"conviction\", \"evidence\": [0, 2, 5] }\n ]\n}\n\nRules:\n- target is exactly \"conviction\" or \"bridge\" \u2014 every statement carries one\n- evidence indices are the [n] numbers from the EVIDENCE list \u2014 never invent an index\n- return an empty convictions array when the evidence is too thin to synthesize anything\n- keep each statement to one sentence";
|
|
125
125
|
interface ConvictionEvidenceItem {
|
|
@@ -219,7 +219,7 @@ declare function buildMemoryProfilePrompt(params: {
|
|
|
219
219
|
maxPayloadChars?: number;
|
|
220
220
|
}): string;
|
|
221
221
|
|
|
222
|
-
declare const MEMORY_WRITE_INSTRUCTIONS = "MEMORY WRITE JOB \u2014 one purpose: decide whether THIS turn yielded anything worth persisting, and store it in the correct lane via the memory-partition-remember or memory-cognition-remember tool.\n\nTwo lanes, never confused:\n- memory-partition = the OBJECTIVE fact store: external-world facts, factual records, project details, and events the user stated, subjects gathered this turn, or facts the user asked you to remember.\n- memory-cognition = the SUBJECTIVE profile store: every preference, interest, trait, or internal state of the user (stated or inferred) \u2014 YOUR understanding of the user, persona learnings included.\n\nYou receive:\n- USER REQUEST: what the user asked.\n- PRIOR MEMORY: facts already stored for this user (may be empty).\n- PROBED THIS TURN: what memory-partition-recall already surfaced for this turn (may be empty) \u2014 already known, never re-store.\n- GATHERED DATA: summarized tool results from this turn (web searches, lookups).\n\nStore into the PARTITION lane (call memory-partition-remember) only when it is durable, objective, and user-specific:\n- A factual record the user states or asks you to track (contact info, a decision, a project detail, an event, their setup \u2014 however phrased, any language).\n- Knowledge about a subject the user cares about that was gathered this turn and extends what is already in PRIOR MEMORY.\n\nROUTING CONSTRAINT (absolute): extract ONLY objective, external facts to the partition. You MUST NOT store user preferences, behavioral traits, or internal states there (\"the user likes\u2026\", \"the user is interested in\u2026\", \"the user prefers\u2026\"). All user profile and persona data is deferred to the cognition tier.\n\nStore into the COGNITION lane (call memory-cognition-remember) whenever the turn yields SUBJECTIVE user data, stated or derived:\n- A preference or interest the user states outright (favorite X, a like or dislike, a style choice) \u2014 stated preferences live HERE, never in the partition.\n- An inferred trait, a standing interest, a working nuance, or a connection between facts the turn supports.\n- Never an objective fact \u2014 those belong in the partition lane.\n\nSTORAGE MECHANICS \u2014 how your memory works (write for the retriever):\n- Each stored record is embedded as a whole AND matched sentence-by-sentence at recall time (multi-variant retrieval). One self-contained fact per call; a single long, dense sentence is fine, but lead with the subject (\"Sam's phone number is 555-1234\", never \"His number is \u2026\").\n- Restating a record verbatim OVERWRITES it in place \u2014 updates are restatements of the full corrected statement, not diffs.\n- tags are the ONLY topic-filter vocabulary at recall \u2014 reuse stable, lowercase topic labels (partition lane only). Tags are NARROW and specific: entity names, product names, game titles (\"amd\", \"stellar blade\", \"stellar blade blood rain\").\n- The macro-taxonomy routes a fact into its family hierarchy (partition lane only), top-down: CLUSTER \u2192 COMMUNITY \u2192 HUB \u2192 NODE (the NODE is the stored record itself \u2014 never named):\n - category (CLUSTER): ONE lowercase PLURAL family noun \u2014 stocks, games, pets, work, health, finance, contacts \u2026\n - community (COMMUNITY): ONE lowercase PLURAL sub-family narrowing the category (\"survival games\" under \"games\", \"tv shows\" under \"shows\"); omit when no sub-family applies.\n - subject (HUB): the lowercase SINGULAR main subject entity the fact is about (\"project zomboid\", \"amd\", \"sam\") \u2014 a specific name, never pluralized; always include when the fact is about a specific entity.\n A category or community is NEVER a specific entity, product, company, or game title: \"amd\" is a subject under the category \"stocks\"; \"stellar blade\" is a subject under the category \"games\"; a show/work title like \"breaking-bad\" is a tag or hub, never a community. Always include category; reuse the existing labels whenever they fit.\n- PERSONA & FICTION CONTENT (absolute): content about an adopted persona, a roleplay, or a fictional/entertainment work routes by its real-world MEDIUM, never by in-universe domains \u2014 a TV persona's biography, family, or career belongs under the medium family (category \"shows\", community \"tv shows\", hub the show's title or the persona name); never \"family\", \"education\", \"business\", or \"science\" for invented content.\n\nTAXONOMY PROBING (pick first, create if necessary): before naming a
|
|
222
|
+
declare const MEMORY_WRITE_INSTRUCTIONS = "MEMORY WRITE JOB \u2014 one purpose: decide whether THIS turn yielded anything worth persisting, and store it in the correct lane via the memory-partition-remember or memory-cognition-remember tool.\n\nTwo lanes, never confused:\n- memory-partition = the OBJECTIVE fact store: external-world facts, factual records, project details, and events the user stated, subjects gathered this turn, or facts the user asked you to remember.\n- memory-cognition = the SUBJECTIVE profile store: every preference, interest, trait, or internal state of the user (stated or inferred) \u2014 YOUR understanding of the user, persona learnings included.\n\nYou receive:\n- USER REQUEST: what the user asked.\n- PRIOR MEMORY: facts already stored for this user (may be empty).\n- PROBED THIS TURN: what memory-partition-recall already surfaced for this turn (may be empty) \u2014 already known, never re-store.\n- GATHERED DATA: summarized tool results from this turn (web searches, lookups).\n\nStore into the PARTITION lane (call memory-partition-remember) only when it is durable, objective, and user-specific:\n- A factual record the user states or asks you to track (contact info, a decision, a project detail, an event, their setup \u2014 however phrased, any language).\n- Knowledge about a subject the user cares about that was gathered this turn and extends what is already in PRIOR MEMORY.\n\nROUTING CONSTRAINT (absolute): extract ONLY objective, external facts to the partition. You MUST NOT store user preferences, behavioral traits, or internal states there (\"the user likes\u2026\", \"the user is interested in\u2026\", \"the user prefers\u2026\"). All user profile and persona data is deferred to the cognition tier.\n\nStore into the COGNITION lane (call memory-cognition-remember) whenever the turn yields SUBJECTIVE user data, stated or derived:\n- A preference or interest the user states outright (favorite X, a like or dislike, a style choice) \u2014 stated preferences live HERE, never in the partition.\n- An inferred trait, a standing interest, a working nuance, or a connection between facts the turn supports.\n- Never an objective fact \u2014 those belong in the partition lane.\n\nSTORAGE MECHANICS \u2014 how your memory works (write for the retriever):\n- Each stored record is embedded as a whole AND matched sentence-by-sentence at recall time (multi-variant retrieval). One self-contained fact per call; a single long, dense sentence is fine, but lead with the subject (\"Sam's phone number is 555-1234\", never \"His number is \u2026\").\n- Restating a record verbatim OVERWRITES it in place \u2014 updates are restatements of the full corrected statement, not diffs.\n- tags are the ONLY topic-filter vocabulary at recall \u2014 reuse stable, lowercase topic labels (partition lane only). Tags are NARROW and specific: entity names, product names, game titles (\"amd\", \"stellar blade\", \"stellar blade blood rain\").\n- The macro-taxonomy routes a fact into its family hierarchy (partition lane only), top-down: CLUSTER \u2192 COMMUNITY \u2192 HUB \u2192 NODE (the NODE is the stored record itself \u2014 never named):\n - category (CLUSTER): ONE lowercase PLURAL family noun \u2014 stocks, games, pets, work, health, finance, contacts \u2026\n - community (COMMUNITY): ONE lowercase PLURAL sub-family narrowing the category (\"survival games\" under \"games\", \"tv shows\" under \"shows\"); omit when no sub-family applies.\n - subject (HUB): the lowercase SINGULAR main subject entity the fact is about (\"project zomboid\", \"amd\", \"sam\") \u2014 a specific name, never pluralized; always include when the fact is about a specific entity.\n A category or community is NEVER a specific entity, product, company, or game title: \"amd\" is a subject under the category \"stocks\"; \"stellar blade\" is a subject under the category \"games\"; a show/work title like \"breaking-bad\" is a tag or hub, never a community. Always include category; reuse the existing labels whenever they fit.\n- PERSONA & FICTION CONTENT (absolute): content about an adopted persona, a roleplay, or a fictional/entertainment work routes by its real-world MEDIUM, never by in-universe domains \u2014 a TV persona's biography, family, or career belongs under the medium family (category \"shows\", community \"tv shows\", hub the show's title or the persona name); never \"family\", \"education\", \"business\", or \"science\" for invented content.\n\nTAXONOMY PROBING (pick first, create if necessary): before naming a tier label you are not certain exists, call memory-taxonomy-probe top-down \u2014 cluster \u2192 community \u2192 hub \u2192 node \u2014 and ADOPT a returned candidate by naming it VERBATIM in the remember call (its id becomes the next probe's parentId). CREATE a new label only when every candidate misses the meaning \u2014 then follow the phrasing rules (plural family/sub-family, singular hub, singular node aspect) and optionally pass an \"icon\" from the curated set for the label you create. The known-vocabulary section below already lists likely fits; probing confirms them or finds better ones.\n\nDo NOT store:\n- Public facts merely fetched this turn that do not relate to the user (e.g. generic web results).\n- Anything already covered by PRIOR MEMORY or PROBED THIS TURN \u2014 extend or update it via the remember call; do not repeat.\n- Tool artifacts: URLs, search scores, image metadata, raw JSON keys.\n- Inferred, assumed, or extrapolated details about the user that neither their words nor GATHERED DATA support \u2014 if the user did not state it (or clearly imply it), it is not memory; when in doubt, answer \"none\".\n\nRules:\n- Each remember call stores ONE self-contained statement (stand-alone, understandable weeks later without this conversation's context).\n- Call each remember tool once per distinct durable item \u2014 no more.\n- If nothing durable surfaced, produce a one-word text answer (\"none\") and make NO tool call. An empty memory write is a correct outcome, never a failure.";
|
|
223
223
|
declare function buildMemoryWritePrompt(params: {
|
|
224
224
|
userRequest: string;
|
|
225
225
|
priorMemory?: string;
|
|
@@ -243,9 +243,9 @@ declare function buildResearchTriagePrompt(gaps: Array<{
|
|
|
243
243
|
snippet: string;
|
|
244
244
|
}>, maxPayloadChars?: number): string;
|
|
245
245
|
|
|
246
|
-
declare const TAXONOMY_RECONCILE_INSTRUCTIONS = "TAXONOMY RECONCILIATION \u2014 one purpose: decide whether two EXISTING taxonomy labels of the same tier name the same concept and should merge into one.\n\nThe macro-taxonomy, top-down: CLUSTER (plural family, e.g. \"games\") \u2192 COMMUNITY (plural sub-family, e.g. \"survival-games\") \u2192 HUB (singular subject entity, e.g. \"project zomboid\") \u2192 plus TAG labels (narrow recall vocabulary).\n\nMerge ONLY wording variants of one concept: casing/formatting drift (\"Video Games\" / \"video-games\"), singular/plural drift inside a family tier (\"survival game\" / \"survival-games\"), abbreviation with identical expansion (\"nlp\" / \"natural-language-processing\").\nNEVER merge: two entities that merely share a word (\"apple\" the company vs \"apple\" the fruit), a parent and its child (\"games\" vs \"survival-games\"), a broad tier and a specific entity (\"games\" vs \"project zomboid\"), or two genuinely different topics that happen to look similar. When in doubt, answer DISTINCT \u2014 a missed merge is cleaned up later; a wrong merge destroys both labels' meaning forever.";
|
|
246
|
+
declare const TAXONOMY_RECONCILE_INSTRUCTIONS = "TAXONOMY RECONCILIATION \u2014 one purpose: decide whether two EXISTING taxonomy labels of the same tier name the same concept and should merge into one.\n\nThe macro-taxonomy, top-down: CLUSTER (plural family, e.g. \"games\") \u2192 COMMUNITY (plural sub-family, e.g. \"survival-games\") \u2192 HUB (singular subject entity, e.g. \"project zomboid\") \u2192 NODE (singular aspect under the hub, e.g. \"base building\") \u2192 plus TAG labels (narrow recall vocabulary).\n\nMerge ONLY wording variants of one concept: casing/formatting drift (\"Video Games\" / \"video-games\"), singular/plural drift inside a family tier (\"survival game\" / \"survival-games\"), abbreviation with identical expansion (\"nlp\" / \"natural-language-processing\").\nNEVER merge: two entities that merely share a word (\"apple\" the company vs \"apple\" the fruit), a parent and its child (\"games\" vs \"survival-games\"), a broad tier and a specific entity (\"games\" vs \"project zomboid\"), or two genuinely different topics that happen to look similar. When in doubt, answer DISTINCT \u2014 a missed merge is cleaned up later; a wrong merge destroys both labels' meaning forever.";
|
|
247
247
|
declare function buildTaxonomyPairPrompt(params: {
|
|
248
|
-
kind: 'cluster' | 'community' | 'hub' | 'tag';
|
|
248
|
+
kind: 'cluster' | 'community' | 'hub' | 'node' | 'tag';
|
|
249
249
|
labelA: string;
|
|
250
250
|
labelB: string;
|
|
251
251
|
countA: number;
|
package/dist/prompts/index.mjs
CHANGED
|
@@ -600,7 +600,7 @@ var INTERNATIONAL_COVERAGE_INSTRUCTIONS = `INTERNATIONAL COVERAGE ASIDE:
|
|
|
600
600
|
- title: the item's original-language title, copied verbatim \u2014 never translated.
|
|
601
601
|
- url: the item's URL, copied verbatim from its context entry.
|
|
602
602
|
- sourceName: the publishing source or channel name from its context entry.
|
|
603
|
-
- language: the item's
|
|
603
|
+
- language: the item's language code copied verbatim from the "lang" field of its context entry (the pipeline pre-detected it \u2014 never invent or guess a code, never use placeholders like "zxx").
|
|
604
604
|
- summary: one or two sentences in the USER'S language stating what this source reports and why it matters.
|
|
605
605
|
- internationalCoverage entries must never reuse a URL that appears in any primary field (sources, hero media, galleries, sectionContent, relatedStories, cards).`;
|
|
606
606
|
|
|
@@ -1466,6 +1466,9 @@ var IntentSchema = z.object({
|
|
|
1466
1466
|
language: z.string().nullable().optional().describe(
|
|
1467
1467
|
"Two-letter ISO language code of the latest user message (e.g. 'en', 'de', 'ja', 'es'). Detect from the user's text."
|
|
1468
1468
|
),
|
|
1469
|
+
contentLanguages: z.array(z.string()).default([]).describe(
|
|
1470
|
+
`Two-letter ISO codes of languages the requested CONTENT is expected to be in, beyond the language of the user's message. Set ONLY when the request explicitly targets foreign-language content: "japanese dark trap music" \u2192 ["ja"], "russian news sites" \u2192 ["ru"]. Music/audio topics count \u2014 a mix or song in another language is still the requested content. Default []: foreign-language results then stay a side note, never primary content.`
|
|
1471
|
+
),
|
|
1469
1472
|
plan: z.object({
|
|
1470
1473
|
images: ImagePlanSchema.optional().describe("Image processing plan. Only present when images are attached.")
|
|
1471
1474
|
}).default({}).describe("Execution plan for the response step.")
|
|
@@ -2160,6 +2163,7 @@ Do NOT include:
|
|
|
2160
2163
|
No-results rule:
|
|
2161
2164
|
- If the searches returned no usable videos, set title to a concise statement such as 'No videos found for <topic>' and use subtitle to explain that the search did not return embeddable video sources. Set videoGalleryItems to an empty array.
|
|
2162
2165
|
- Do not invent video URLs to fill the playlist when no results were retrieved.
|
|
2166
|
+
- availableVideos empty does NOT mean nothing was found: when availableVideos is empty but internationalVideos is not, the search DID find videos \u2014 in other languages than the user's. Never title it 'No videos found' in that case; use the subtitle to say the fresh results are in other languages and listed in internationalCoverage, and fill internationalCoverage from the internationalVideos pool.
|
|
2163
2167
|
- The dashboard does not render sources for this template. Do not include a sources field.`;
|
|
2164
2168
|
|
|
2165
2169
|
// src/prompts/harness/variant-instructions.registry.ts
|
|
@@ -2395,6 +2399,7 @@ When needsClarification=true:
|
|
|
2395
2399
|
// src/prompts/harness/intent-selection/language-rules.prompt.ts
|
|
2396
2400
|
var LANGUAGE_NOISE_IMMUNITY_RULES = `- Individual foreign words, loanwords, scientific or medical terms, brand or proper names, and quoted fragments must NOT change the detected language.
|
|
2397
2401
|
- Example: "Why do English speakers say 'd\xE9j\xE0 vu'?" \u2192 language "en" (one French phrase inside an English sentence \u2014 not "fr").`;
|
|
2402
|
+
var CONTENT_LANGUAGE_RULE = `- If the user explicitly asks for foreign-language CONTENT (e.g. "japanese dark trap music" from an English speaker, "russian news sites"), fill "contentLanguages" with those ISO codes \u2014 this covers MUSIC and mixes too, not just text. Otherwise leave "contentLanguages" empty.`;
|
|
2398
2403
|
var INTENT_LANGUAGE_FIELD_RULE = "Judge by the DOMINANT language of the full sentence or paragraph \u2014 individual foreign words, loanwords, scientific or medical terms, brand or proper names, and quoted fragments must NOT change the detected language.";
|
|
2399
2404
|
function buildIntentLanguageRules(language) {
|
|
2400
2405
|
const code = language?.trim().toLowerCase() ?? "";
|
|
@@ -2406,7 +2411,8 @@ function buildIntentLanguageRules(language) {
|
|
|
2406
2411
|
- If the latest user message is in mixed languages, use the language that appears to be primary.
|
|
2407
2412
|
- Judge the language by the DOMINANT language of the full sentence or paragraph, never by individual words.
|
|
2408
2413
|
${LANGUAGE_NOISE_IMMUNITY_RULES}
|
|
2409
|
-
- Do not use English for clarification questions, reasoning, or summaries unless the user wrote in English
|
|
2414
|
+
- Do not use English for clarification questions, reasoning, or summaries unless the user wrote in English.
|
|
2415
|
+
${CONTENT_LANGUAGE_RULE}`;
|
|
2410
2416
|
}
|
|
2411
2417
|
const name = resolveLanguageName(code);
|
|
2412
2418
|
const languageLabel = name === code ? `"${code}"` : `"${code}" (${name})`;
|
|
@@ -2419,7 +2425,8 @@ ${LANGUAGE_NOISE_IMMUNITY_RULES}
|
|
|
2419
2425
|
- Never default to English unless the browser language is English or the user explicitly requests English.
|
|
2420
2426
|
- If the user explicitly requests a language, judge it by the DOMINANT language of the full sentence or paragraph, never by individual words.
|
|
2421
2427
|
${LANGUAGE_NOISE_IMMUNITY_RULES}
|
|
2422
|
-
- Do not use English for clarification questions, reasoning, or summaries unless the browser language is English or the user explicitly requests English
|
|
2428
|
+
- Do not use English for clarification questions, reasoning, or summaries unless the browser language is English or the user explicitly requests English.
|
|
2429
|
+
${CONTENT_LANGUAGE_RULE}`;
|
|
2423
2430
|
}
|
|
2424
2431
|
|
|
2425
2432
|
// src/prompts/harness/intent-selection/memory-rules.prompt.ts
|
|
@@ -3061,14 +3068,14 @@ var EncyclopediaClassifySchema = z.object({
|
|
|
3061
3068
|
*/
|
|
3062
3069
|
category: z.string(),
|
|
3063
3070
|
/**
|
|
3064
|
-
* One lowercase PLURAL sub-family
|
|
3071
|
+
* One lowercase PLURAL sub-family narrowing the category (e.g.
|
|
3065
3072
|
* `survival-games` under `games`, `tv-shows` under `shows`) — the
|
|
3066
|
-
* constellation's COMMUNITY tier, one level below the cluster.
|
|
3067
|
-
*
|
|
3068
|
-
* company, or title — a show/work title like `breaking-bad` is a
|
|
3069
|
-
*
|
|
3073
|
+
* constellation's COMMUNITY tier, one level below the cluster. The chain
|
|
3074
|
+
* is strict, so community is always present. Never a specific entity,
|
|
3075
|
+
* product, company, or title — a show/work title like `breaking-bad` is a
|
|
3076
|
+
* hub, never a community.
|
|
3070
3077
|
*/
|
|
3071
|
-
community: z.string()
|
|
3078
|
+
community: z.string(),
|
|
3072
3079
|
/**
|
|
3073
3080
|
* The narrow SINGULAR subject entity the document is about (e.g.
|
|
3074
3081
|
* `wuthering waves`, `q3 budget`) — the constellation's HUB tier. A short,
|
|
@@ -3076,11 +3083,13 @@ var EncyclopediaClassifySchema = z.object({
|
|
|
3076
3083
|
*/
|
|
3077
3084
|
topic: z.string(),
|
|
3078
3085
|
/**
|
|
3079
|
-
*
|
|
3080
|
-
*
|
|
3081
|
-
*
|
|
3082
|
-
*
|
|
3086
|
+
* The SINGULAR aspect of the document under its hub (e.g. `base building`
|
|
3087
|
+
* under `project zomboid`, `department spend` under `q3 budget`) — the
|
|
3088
|
+
* constellation's NODE tier, one level below the hub: a named sub-entity
|
|
3089
|
+
* or topic branch the chunks file under. Reuse the known vocabulary
|
|
3090
|
+
* instead of minting near-variants.
|
|
3083
3091
|
*/
|
|
3092
|
+
node: z.string(),
|
|
3084
3093
|
icon: z.string().optional()
|
|
3085
3094
|
});
|
|
3086
3095
|
|
|
@@ -3119,24 +3128,25 @@ function buildEncyclopediaClassifyPrompt(vocabulary = {}) {
|
|
|
3119
3128
|
after: `
|
|
3120
3129
|
YOUR TASK \u2014 label one stored source document with its place in the macro-taxonomy:
|
|
3121
3130
|
|
|
3122
|
-
TAXONOMY HIERARCHY (top-down): CLUSTER \u2192 COMMUNITY \u2192 HUB \u2192 NODE
|
|
3131
|
+
TAXONOMY HIERARCHY (top-down): CLUSTER \u2192 COMMUNITY \u2192 HUB \u2192 NODE \u2192 LEAF
|
|
3123
3132
|
- CLUSTER = a broad PLURAL family noun ("games", "work", "health") \u2014 the highest logical bucket.
|
|
3124
3133
|
- COMMUNITY = a PLURAL sub-family under one cluster ("survival-games" under "games") \u2014 a genre or domain branch.
|
|
3125
3134
|
- HUB = the SINGULAR main subject entity anchoring the document ("project zomboid", "wuthering waves") \u2014 a specific name, never pluralized.
|
|
3126
|
-
- NODE = the
|
|
3135
|
+
- NODE = the SINGULAR aspect of the document under its hub ("base building" under "project zomboid", "department spend" under "q3 budget") \u2014 a named sub-entity or topic branch; the document's chunks are the LEAVES filed under it. The chain is strict: ALL FOUR labels are always present.
|
|
3127
3136
|
|
|
3128
3137
|
- The document may be a fetched web page, an uploaded file, or a search-result snippet. Classify by its CONTENT, never by its source shape \u2014 a file has no domain, and that must not matter.
|
|
3129
3138
|
- FICTION & ENTERTAINMENT CONTENT (absolute): a document about an entertainment work or fictional universe classifies by its real-world MEDIUM, never by the work's in-universe domains. A TV episode page about a character's family or career is NOT "family", "education", "business", or "science" \u2014 the category is the medium family (e.g. "shows"), the community a true plural sub-family (e.g. "tv-shows"), and the work's title is the topic (e.g. "breaking bad"), never the community.
|
|
3130
3139
|
- category (CLUSTER): ONE broad lowercase PLURAL family noun (e.g. "games", "work", "health", "finance") that groups the topic into a family. It labels the TOPIC \u2014 never a side theme or an incidental mention on the page. Never a specific entity, product, company, or title.
|
|
3131
|
-
- community (COMMUNITY
|
|
3140
|
+
- community (COMMUNITY): ONE lowercase PLURAL sub-family narrowing the category (e.g. "survival-games" under "games"). Always present; never a specific entity, product, company, or title \u2014 a show/work title like "breaking-bad" is a hub, never a community.
|
|
3132
3141
|
- topic (HUB): the document's MAIN subject entity \u2014 what the whole source is about (e.g. "wuthering waves", "q3 budget", "rust borrow checker") \u2014 SINGULAR and specific. A short, reusable label \u2014 not a sentence, not a URL, not a filename, never a domain or a site name. Never a sub-part of the main subject (a chapter, a location, one feature) and never an adjacent proper noun (a publisher, an author, a related event) \u2014 when a title-level entity exists, it is the topic.
|
|
3142
|
+
- node (NODE): the SINGULAR aspect of the document under its hub \u2014 the named sub-entity or topic branch the source focuses on (e.g. "base building" under "project zomboid"). Short and reusable \u2014 never a sentence, never a URL.
|
|
3133
3143
|
- When the document is about a KNOWN TOPIC, output that label VERBATIM \u2014 prefer "neverness to everness" over minting a variant like "nte".
|
|
3134
|
-
- TAXONOMY PROBING (pick first, create if necessary): when the memory-taxonomy-probe tool is available, probe top-down \u2014 cluster \u2192 community \u2192 hub \u2014 before answering, and ADOPT returned candidates VERBATIM (a candidate's id becomes the next probe's parentId). CREATE a new label only when no candidate fits; on creation you may pass one "icon" from the curated taxonomy icon set for the deepest NEW label.
|
|
3144
|
+
- TAXONOMY PROBING (pick first, create if necessary): when the memory-taxonomy-probe tool is available, probe top-down \u2014 cluster \u2192 community \u2192 hub \u2192 node \u2014 before answering, and ADOPT returned candidates VERBATIM (a candidate's id becomes the next probe's parentId). CREATE a new label only when no candidate fits; on creation you may pass one "icon" from the curated taxonomy icon set for the deepest NEW label.
|
|
3135
3145
|
${buildVocabularySection(vocabulary)}
|
|
3136
3146
|
RULES:
|
|
3137
3147
|
- Return ONLY a single valid JSON object matching the exact schema above.
|
|
3138
3148
|
- No markdown code fences, no explanations, preamble, or postscript.
|
|
3139
|
-
- Never output undefined or null. "category"
|
|
3149
|
+
- Never output undefined or null. "category", "community", "topic", and "node" are always present; "icon" is omitted when it doesn't apply.
|
|
3140
3150
|
|
|
3141
3151
|
FINAL REMINDER:
|
|
3142
3152
|
- Output ONLY valid JSON matching the exact schema above. No markdown code fences, no explanations, preamble, or postscript.`
|
|
@@ -3541,7 +3551,7 @@ STORAGE MECHANICS \u2014 how your memory works (write for the retriever):
|
|
|
3541
3551
|
A category or community is NEVER a specific entity, product, company, or game title: "amd" is a subject under the category "stocks"; "stellar blade" is a subject under the category "games"; a show/work title like "breaking-bad" is a tag or hub, never a community. Always include category; reuse the existing labels whenever they fit.
|
|
3542
3552
|
- PERSONA & FICTION CONTENT (absolute): content about an adopted persona, a roleplay, or a fictional/entertainment work routes by its real-world MEDIUM, never by in-universe domains \u2014 a TV persona's biography, family, or career belongs under the medium family (category "shows", community "tv shows", hub the show's title or the persona name); never "family", "education", "business", or "science" for invented content.
|
|
3543
3553
|
|
|
3544
|
-
TAXONOMY PROBING (pick first, create if necessary): before naming a
|
|
3554
|
+
TAXONOMY PROBING (pick first, create if necessary): before naming a tier label you are not certain exists, call memory-taxonomy-probe top-down \u2014 cluster \u2192 community \u2192 hub \u2192 node \u2014 and ADOPT a returned candidate by naming it VERBATIM in the remember call (its id becomes the next probe's parentId). CREATE a new label only when every candidate misses the meaning \u2014 then follow the phrasing rules (plural family/sub-family, singular hub, singular node aspect) and optionally pass an "icon" from the curated set for the label you create. The known-vocabulary section below already lists likely fits; probing confirms them or finds better ones.
|
|
3545
3555
|
|
|
3546
3556
|
Do NOT store:
|
|
3547
3557
|
- Public facts merely fetched this turn that do not relate to the user (e.g. generic web results).
|
|
@@ -3674,7 +3684,7 @@ var TaxonomyPairVerdictSchema = z.object({
|
|
|
3674
3684
|
// src/prompts/memory/taxonomy-reconcile-prompt.constant.ts
|
|
3675
3685
|
var TAXONOMY_RECONCILE_INSTRUCTIONS = `TAXONOMY RECONCILIATION \u2014 one purpose: decide whether two EXISTING taxonomy labels of the same tier name the same concept and should merge into one.
|
|
3676
3686
|
|
|
3677
|
-
The macro-taxonomy, top-down: CLUSTER (plural family, e.g. "games") \u2192 COMMUNITY (plural sub-family, e.g. "survival-games") \u2192 HUB (singular subject entity, e.g. "project zomboid") \u2192 plus TAG labels (narrow recall vocabulary).
|
|
3687
|
+
The macro-taxonomy, top-down: CLUSTER (plural family, e.g. "games") \u2192 COMMUNITY (plural sub-family, e.g. "survival-games") \u2192 HUB (singular subject entity, e.g. "project zomboid") \u2192 NODE (singular aspect under the hub, e.g. "base building") \u2192 plus TAG labels (narrow recall vocabulary).
|
|
3678
3688
|
|
|
3679
3689
|
Merge ONLY wording variants of one concept: casing/formatting drift ("Video Games" / "video-games"), singular/plural drift inside a family tier ("survival game" / "survival-games"), abbreviation with identical expansion ("nlp" / "natural-language-processing").
|
|
3680
3690
|
NEVER merge: two entities that merely share a word ("apple" the company vs "apple" the fruit), a parent and its child ("games" vs "survival-games"), a broad tier and a specific entity ("games" vs "project zomboid"), or two genuinely different topics that happen to look similar. When in doubt, answer DISTINCT \u2014 a missed merge is cleaned up later; a wrong merge destroys both labels' meaning forever.`;
|
|
@@ -3714,31 +3724,35 @@ var ExtractedFactSchema = z.object({
|
|
|
3714
3724
|
*/
|
|
3715
3725
|
text: z.string(),
|
|
3716
3726
|
/**
|
|
3717
|
-
* The lowercase entity the fact is about
|
|
3718
|
-
*
|
|
3719
|
-
*
|
|
3720
|
-
|
|
3727
|
+
* The lowercase entity the fact is about — the chain's HUB tier:
|
|
3728
|
+
* singular, specific, stable. Maintenance adjudication only ever
|
|
3729
|
+
* compares facts about the SAME subject.
|
|
3730
|
+
*/
|
|
3731
|
+
subject: z.string(),
|
|
3732
|
+
/**
|
|
3733
|
+
* The lowercase singular ASPECT the fact addresses under its subject —
|
|
3734
|
+
* the chain's NODE tier (e.g. `base building` under `project zomboid`,
|
|
3735
|
+
* `ryzen 9950x3d` under `amd`). Names WHERE under the hub the fact is
|
|
3736
|
+
* filed; reuse the known vocabulary instead of minting near-variants.
|
|
3721
3737
|
*/
|
|
3722
|
-
|
|
3738
|
+
node: z.string(),
|
|
3723
3739
|
/**
|
|
3724
3740
|
* One broad lowercase PLURAL family label for THIS fact (e.g. `stocks`,
|
|
3725
|
-
* `pets`, `games`) — the
|
|
3726
|
-
* turn-side category when omitted. Never
|
|
3741
|
+
* `pets`, `games`) — the chain's CLUSTER tier. Never
|
|
3727
3742
|
* a specific entity, product, company, or game title. Persona/roleplay or
|
|
3728
3743
|
* fictional content classifies by its real-world medium (a TV persona's
|
|
3729
3744
|
* biography belongs under `shows`), never by in-universe domains (`family`,
|
|
3730
3745
|
* `education`, `business` describe reality, not an invented life).
|
|
3731
3746
|
*/
|
|
3732
|
-
category: z.string()
|
|
3747
|
+
category: z.string(),
|
|
3733
3748
|
/**
|
|
3734
3749
|
* One lowercase PLURAL sub-family label narrowing THIS fact's category
|
|
3735
3750
|
* (e.g. `survival-games` under `games`, `tv-shows` under `shows`) — the
|
|
3736
|
-
*
|
|
3737
|
-
*
|
|
3738
|
-
*
|
|
3739
|
-
* `breaking-bad` is a tag or hub, never a community.
|
|
3751
|
+
* chain's COMMUNITY tier, one level below the cluster. Never a specific
|
|
3752
|
+
* entity, product, or title — a show/work title like
|
|
3753
|
+
* `breaking-bad` is a hub or tag, never a community.
|
|
3740
3754
|
*/
|
|
3741
|
-
community: z.string()
|
|
3755
|
+
community: z.string(),
|
|
3742
3756
|
/** What kind of durable thing this is (see FACT_KINDS). */
|
|
3743
3757
|
kind: z.enum(FACT_KINDS),
|
|
3744
3758
|
/** Whether a newer statement is expected to replace this one (see FACT_STABILITIES). */
|
|
@@ -3776,10 +3790,11 @@ var ExtractionSchema = z.object({
|
|
|
3776
3790
|
* One lowercase PLURAL sub-family label narrowing the turn-side category
|
|
3777
3791
|
* (e.g. `survival-games` under `games`, `tv-shows` under `shows`) — the
|
|
3778
3792
|
* constellation's COMMUNITY tier: a genre, project family, or domain branch
|
|
3779
|
-
*
|
|
3780
|
-
*
|
|
3781
|
-
*
|
|
3782
|
-
*
|
|
3793
|
+
* One broad lowercase PLURAL sub-family label narrowing the turn-side
|
|
3794
|
+
* category (e.g. `survival-games` under `games`, `tv-shows` under
|
|
3795
|
+
* `shows`) — the COMMUNITY tier between the cluster and the hub.
|
|
3796
|
+
* Never a specific entity, product, or title — a show/work title like
|
|
3797
|
+
* `breaking-bad` is a hub or tag, never a community.
|
|
3783
3798
|
*/
|
|
3784
3799
|
community: z.string().optional()
|
|
3785
3800
|
});
|
|
@@ -3805,16 +3820,18 @@ ${sourceVoiceRules}
|
|
|
3805
3820
|
- Storage mechanics: each fact is embedded as a whole and matched sentence-by-sentence at recall time (multi-variant retrieval). One dense sentence is fine \u2014 put the subject up front ("The payments service runs PostgreSQL 16", not "It runs that version").
|
|
3806
3821
|
- Skip transient content: greetings, small talk, one-off instructions, filler \u2014 anything with no future recall value. When in doubt about whether a detail is durable, keep it: a durable detail is cheaper to store than to lose. When in doubt about whether a detail is SUBJECTIVE, drop it \u2014 the cognition tier captures preferences and profile data.
|
|
3807
3822
|
|
|
3808
|
-
FACT METADATA \u2014 every fact object carries the fields the maintenance passes (consolidate/reflect/conviction) interpret. Labels place the fact in the macro-taxonomy, top-down: CLUSTER \u2192 COMMUNITY \u2192 HUB \u2192 NODE, where the
|
|
3823
|
+
FACT METADATA \u2014 every fact object carries the fields the maintenance passes (consolidate/reflect/conviction) interpret. Labels place the fact in the macro-taxonomy, top-down: CLUSTER \u2192 COMMUNITY \u2192 HUB \u2192 NODE \u2192 LEAF, where the LEAF is the fact's text itself and every tier above it is a NAMED label that narrows where it is filed. The chain is strict: a fact is emitted with ALL FOUR labels or not at all.
|
|
3809
3824
|
- CLUSTER (category): a broad PLURAL family noun ("games", "stocks", "pets").
|
|
3810
3825
|
- COMMUNITY (community): a PLURAL sub-family under one cluster ("survival-games" under "games") \u2014 a genre or domain branch.
|
|
3811
3826
|
- HUB (subject): the SINGULAR main subject entity anchoring the fact ("project zomboid", "amd", "sam") \u2014 a specific name, never pluralized.
|
|
3827
|
+
- NODE (node): the SINGULAR aspect under the hub that the fact addresses ("base building" under "project zomboid", "ryzen 9950x3d" under "amd") \u2014 a specific sub-entity or topic branch, never pluralized, never a sentence.
|
|
3812
3828
|
PERSONA & FICTION CONTENT (absolute): facts about an adopted persona, a roleplay, or a fictional/entertainment work classify by the content's real-world MEDIUM, never by its in-universe domains. A TV persona's biography, family, career, or studies are NOT real-world walk-of-life categories \u2014 never "family", "education", "business", or "science" for invented content: the cluster is the medium family (e.g. "shows"), the community a true plural sub-family (e.g. "tv-shows"), and the show's title goes to the hub or the tags ("breaking bad"), never to the community.
|
|
3813
3829
|
Fields:
|
|
3814
3830
|
- text: the statement itself.
|
|
3815
|
-
- subject (
|
|
3816
|
-
-
|
|
3817
|
-
-
|
|
3831
|
+
- subject (required): the lowercase SINGULAR entity the fact is about \u2014 the HUB tier \u2014 a person, product, project, or the user's own name ("sam", "stellar blade", "payments service"). Maintenance only ever compares facts about the SAME subject, so name it whenever the fact is about a specific entity.
|
|
3832
|
+
- node (required): the lowercase SINGULAR aspect of the fact under its hub \u2014 the NODE tier \u2014 ("base building", "ryzen 9950x3d", "vocal range"). Reuse the known vocabulary rather than minting near-variants.
|
|
3833
|
+
- category (required): ONE broad lowercase PLURAL family label for this fact \u2014 the CLUSTER tier \u2014 reusing the known vocabulary.
|
|
3834
|
+
- community (required): ONE broad lowercase PLURAL sub-family narrowing the fact's category \u2014 the COMMUNITY tier, one level below the cluster (a genre, project family, or domain branch \u2014 "survival-games" under "games").
|
|
3818
3835
|
- kind (required): what kind of durable thing it is:
|
|
3819
3836
|
- preference \u2014 RESERVED, never emit: likes, dislikes, wants, and interests are subjective user data owned by the cognition tier (see ROUTING BOUNDARY)
|
|
3820
3837
|
- decision \u2014 a choice that was made (adoptions, migrations, purchases committed to)
|
|
@@ -3827,7 +3844,7 @@ Fields:
|
|
|
3827
3844
|
- stability (required): "durable" \u2014 a long-term truth that should survive until contradicted (decisions, traits, history) \u2014 or "volatile" \u2014 a current state a newer statement is EXPECTED to replace (location, tooling, versions). When in doubt, choose durable.
|
|
3828
3845
|
- Tags: 2 to 6 stable, reusable, lowercase topic labels describing what the text is about (e.g. "work", "rust", "contacts", "amd", "stellar blade"). Tags are NARROW and specific \u2014 entity names, product names, game titles. They are the vocabulary for topic-filtered recall later.
|
|
3829
3846
|
- Category: ONE broad lowercase PLURAL family noun for the whole text (e.g. "stocks", "pets", "games", "health") \u2014 the CLUSTER tier \u2014 that groups the narrow tags into one topic family. A category is NEVER a specific entity, product, company, or game title: "amd" belongs under "stocks"; "stellar blade" and "stellar blade blood rain" belong under "games". Persona/fictional content follows the PERSONA & FICTION rule above (medium family, not in-universe domains). Always include it when facts are emitted; omit it when nothing durable is found.
|
|
3830
|
-
- Community: ONE broad lowercase PLURAL sub-family that narrows the category (e.g. "survival-games", "action-rpgs" under "games"; "tv-shows" under "shows") \u2014 the COMMUNITY tier between the cluster and the hub.
|
|
3847
|
+
- Community: ONE broad lowercase PLURAL sub-family that narrows the category (e.g. "survival-games", "action-rpgs" under "games"; "tv-shows" under "shows") \u2014 the COMMUNITY tier between the cluster and the hub. Always include it when facts are emitted; never a specific entity, product, or title \u2014 a show/work title like "breaking-bad" is a tag or hub, never a community.
|
|
3831
3848
|
- If nothing durable is found, return an empty facts array; tags may still label the topic when useful.
|
|
3832
3849
|
${buildVocabularySection(vocabulary)}
|
|
3833
3850
|
PRIOR MEMORY (when the user message ends with an "ALREADY STORED IN MEMORY" section):
|
|
@@ -3851,7 +3868,7 @@ Error: ${error}
|
|
|
3851
3868
|
|
|
3852
3869
|
Return ONLY a single valid JSON object matching the extraction schema exactly:
|
|
3853
3870
|
${formatZodShape(ExtractionSchema)}
|
|
3854
|
-
All object keys must be quoted with double quotes. "subject"
|
|
3871
|
+
All object keys must be quoted with double quotes. Per fact, "subject", "node", "category", and "community" are required alongside "kind" and "stability".
|
|
3855
3872
|
Do not add markdown code fences, explanations, placeholders, or extra text.
|
|
3856
3873
|
|
|
3857
3874
|
FINAL REMINDER:
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export { E as EncyclopediaDocumentInput, a as EncyclopediaDocumentResult, b as EncyclopediaSearchHit, c as EncyclopediaSearchInput } from '../encyclopedia-search.model-oFW8_rUT.js';
|
|
3
|
-
import { F as FormatZodShapeOptions } from '../format-zod-shape.types-
|
|
4
|
-
export { B as BROWSER_TOOL_NAMES, D as DEFAULT_VARIANT_ID, E as ENCYCLOPEDIA_TOOL_NAMES, a as IMAGE_TASK_TEMPLATES, b as ImageTaskTemplate, I as IntentResult, c as IntentSchema, M as MEMORY_TOOL_NAMES, d as TOOL_DESCRIPTIONS, e as TOOL_NAMES, T as TemplateName, f as ToolName, g as VARIANT_NAMES, V as VariantName, i as isImageTaskTemplate } from '../format-zod-shape.types-
|
|
3
|
+
import { F as FormatZodShapeOptions } from '../format-zod-shape.types-iJugcVmt.js';
|
|
4
|
+
export { B as BROWSER_TOOL_NAMES, D as DEFAULT_VARIANT_ID, E as ENCYCLOPEDIA_TOOL_NAMES, a as IMAGE_TASK_TEMPLATES, b as ImageTaskTemplate, I as IntentResult, c as IntentSchema, M as MEMORY_TOOL_NAMES, d as TOOL_DESCRIPTIONS, e as TOOL_NAMES, T as TemplateName, f as ToolName, g as VARIANT_NAMES, V as VariantName, i as isImageTaskTemplate } from '../format-zod-shape.types-iJugcVmt.js';
|
|
5
5
|
|
|
6
6
|
declare const BLOCKED_IMAGE_HOSTS: Set<string>;
|
|
7
7
|
|
|
@@ -16,8 +16,9 @@ declare const NON_PAGE_EXTENSIONS: RegExp;
|
|
|
16
16
|
|
|
17
17
|
declare const EncyclopediaClassifySchema: z.ZodObject<{
|
|
18
18
|
category: z.ZodString;
|
|
19
|
-
community: z.
|
|
19
|
+
community: z.ZodString;
|
|
20
20
|
topic: z.ZodString;
|
|
21
|
+
node: z.ZodString;
|
|
21
22
|
icon: z.ZodOptional<z.ZodString>;
|
|
22
23
|
}, z.core.$strip>;
|
|
23
24
|
type EncyclopediaClassification = z.infer<typeof EncyclopediaClassifySchema>;
|
|
@@ -247,9 +248,10 @@ declare const FACT_KINDS: readonly ["preference", "decision", "state", "contact"
|
|
|
247
248
|
declare const FACT_STABILITIES: readonly ["durable", "volatile"];
|
|
248
249
|
declare const ExtractedFactSchema: z.ZodObject<{
|
|
249
250
|
text: z.ZodString;
|
|
250
|
-
subject: z.
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
subject: z.ZodString;
|
|
252
|
+
node: z.ZodString;
|
|
253
|
+
category: z.ZodString;
|
|
254
|
+
community: z.ZodString;
|
|
253
255
|
kind: z.ZodEnum<{
|
|
254
256
|
preference: "preference";
|
|
255
257
|
decision: "decision";
|
|
@@ -269,9 +271,10 @@ type ExtractedFact = z.infer<typeof ExtractedFactSchema>;
|
|
|
269
271
|
declare const ExtractionSchema: z.ZodObject<{
|
|
270
272
|
facts: z.ZodArray<z.ZodObject<{
|
|
271
273
|
text: z.ZodString;
|
|
272
|
-
subject: z.
|
|
273
|
-
|
|
274
|
-
|
|
274
|
+
subject: z.ZodString;
|
|
275
|
+
node: z.ZodString;
|
|
276
|
+
category: z.ZodString;
|
|
277
|
+
community: z.ZodString;
|
|
275
278
|
kind: z.ZodEnum<{
|
|
276
279
|
preference: "preference";
|
|
277
280
|
decision: "decision";
|
package/dist/schemas/index.mjs
CHANGED
|
@@ -78,14 +78,14 @@ var EncyclopediaClassifySchema = z.object({
|
|
|
78
78
|
*/
|
|
79
79
|
category: z.string(),
|
|
80
80
|
/**
|
|
81
|
-
* One lowercase PLURAL sub-family
|
|
81
|
+
* One lowercase PLURAL sub-family narrowing the category (e.g.
|
|
82
82
|
* `survival-games` under `games`, `tv-shows` under `shows`) — the
|
|
83
|
-
* constellation's COMMUNITY tier, one level below the cluster.
|
|
84
|
-
*
|
|
85
|
-
* company, or title — a show/work title like `breaking-bad` is a
|
|
86
|
-
*
|
|
83
|
+
* constellation's COMMUNITY tier, one level below the cluster. The chain
|
|
84
|
+
* is strict, so community is always present. Never a specific entity,
|
|
85
|
+
* product, company, or title — a show/work title like `breaking-bad` is a
|
|
86
|
+
* hub, never a community.
|
|
87
87
|
*/
|
|
88
|
-
community: z.string()
|
|
88
|
+
community: z.string(),
|
|
89
89
|
/**
|
|
90
90
|
* The narrow SINGULAR subject entity the document is about (e.g.
|
|
91
91
|
* `wuthering waves`, `q3 budget`) — the constellation's HUB tier. A short,
|
|
@@ -93,11 +93,13 @@ var EncyclopediaClassifySchema = z.object({
|
|
|
93
93
|
*/
|
|
94
94
|
topic: z.string(),
|
|
95
95
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
96
|
+
* The SINGULAR aspect of the document under its hub (e.g. `base building`
|
|
97
|
+
* under `project zomboid`, `department spend` under `q3 budget`) — the
|
|
98
|
+
* constellation's NODE tier, one level below the hub: a named sub-entity
|
|
99
|
+
* or topic branch the chunks file under. Reuse the known vocabulary
|
|
100
|
+
* instead of minting near-variants.
|
|
100
101
|
*/
|
|
102
|
+
node: z.string(),
|
|
101
103
|
icon: z.string().optional()
|
|
102
104
|
});
|
|
103
105
|
|
|
@@ -513,6 +515,9 @@ var IntentSchema = z.object({
|
|
|
513
515
|
language: z.string().nullable().optional().describe(
|
|
514
516
|
"Two-letter ISO language code of the latest user message (e.g. 'en', 'de', 'ja', 'es'). Detect from the user's text."
|
|
515
517
|
),
|
|
518
|
+
contentLanguages: z.array(z.string()).default([]).describe(
|
|
519
|
+
`Two-letter ISO codes of languages the requested CONTENT is expected to be in, beyond the language of the user's message. Set ONLY when the request explicitly targets foreign-language content: "japanese dark trap music" \u2192 ["ja"], "russian news sites" \u2192 ["ru"]. Music/audio topics count \u2014 a mix or song in another language is still the requested content. Default []: foreign-language results then stay a side note, never primary content.`
|
|
520
|
+
),
|
|
516
521
|
plan: z.object({
|
|
517
522
|
images: ImagePlanSchema.optional().describe("Image processing plan. Only present when images are attached.")
|
|
518
523
|
}).default({}).describe("Execution plan for the response step.")
|
|
@@ -628,31 +633,35 @@ var ExtractedFactSchema = z.object({
|
|
|
628
633
|
*/
|
|
629
634
|
text: z.string(),
|
|
630
635
|
/**
|
|
631
|
-
* The lowercase entity the fact is about
|
|
632
|
-
*
|
|
633
|
-
*
|
|
634
|
-
|
|
636
|
+
* The lowercase entity the fact is about — the chain's HUB tier:
|
|
637
|
+
* singular, specific, stable. Maintenance adjudication only ever
|
|
638
|
+
* compares facts about the SAME subject.
|
|
639
|
+
*/
|
|
640
|
+
subject: z.string(),
|
|
641
|
+
/**
|
|
642
|
+
* The lowercase singular ASPECT the fact addresses under its subject —
|
|
643
|
+
* the chain's NODE tier (e.g. `base building` under `project zomboid`,
|
|
644
|
+
* `ryzen 9950x3d` under `amd`). Names WHERE under the hub the fact is
|
|
645
|
+
* filed; reuse the known vocabulary instead of minting near-variants.
|
|
635
646
|
*/
|
|
636
|
-
|
|
647
|
+
node: z.string(),
|
|
637
648
|
/**
|
|
638
649
|
* One broad lowercase PLURAL family label for THIS fact (e.g. `stocks`,
|
|
639
|
-
* `pets`, `games`) — the
|
|
640
|
-
* turn-side category when omitted. Never
|
|
650
|
+
* `pets`, `games`) — the chain's CLUSTER tier. Never
|
|
641
651
|
* a specific entity, product, company, or game title. Persona/roleplay or
|
|
642
652
|
* fictional content classifies by its real-world medium (a TV persona's
|
|
643
653
|
* biography belongs under `shows`), never by in-universe domains (`family`,
|
|
644
654
|
* `education`, `business` describe reality, not an invented life).
|
|
645
655
|
*/
|
|
646
|
-
category: z.string()
|
|
656
|
+
category: z.string(),
|
|
647
657
|
/**
|
|
648
658
|
* One lowercase PLURAL sub-family label narrowing THIS fact's category
|
|
649
659
|
* (e.g. `survival-games` under `games`, `tv-shows` under `shows`) — the
|
|
650
|
-
*
|
|
651
|
-
*
|
|
652
|
-
*
|
|
653
|
-
* `breaking-bad` is a tag or hub, never a community.
|
|
660
|
+
* chain's COMMUNITY tier, one level below the cluster. Never a specific
|
|
661
|
+
* entity, product, or title — a show/work title like
|
|
662
|
+
* `breaking-bad` is a hub or tag, never a community.
|
|
654
663
|
*/
|
|
655
|
-
community: z.string()
|
|
664
|
+
community: z.string(),
|
|
656
665
|
/** What kind of durable thing this is (see FACT_KINDS). */
|
|
657
666
|
kind: z.enum(FACT_KINDS),
|
|
658
667
|
/** Whether a newer statement is expected to replace this one (see FACT_STABILITIES). */
|
|
@@ -690,10 +699,11 @@ var ExtractionSchema = z.object({
|
|
|
690
699
|
* One lowercase PLURAL sub-family label narrowing the turn-side category
|
|
691
700
|
* (e.g. `survival-games` under `games`, `tv-shows` under `shows`) — the
|
|
692
701
|
* constellation's COMMUNITY tier: a genre, project family, or domain branch
|
|
693
|
-
*
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
*
|
|
702
|
+
* One broad lowercase PLURAL sub-family label narrowing the turn-side
|
|
703
|
+
* category (e.g. `survival-games` under `games`, `tv-shows` under
|
|
704
|
+
* `shows`) — the COMMUNITY tier between the cluster and the hub.
|
|
705
|
+
* Never a specific entity, product, or title — a show/work title like
|
|
706
|
+
* `breaking-bad` is a hub or tag, never a community.
|
|
697
707
|
*/
|
|
698
708
|
community: z.string().optional()
|
|
699
709
|
});
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -475,9 +475,10 @@ declare function createMemoryPartitionRecallTool(deps: MemoryPartitionRecallDeps
|
|
|
475
475
|
|
|
476
476
|
declare const memoryPartitionRememberSchema: z.ZodObject<{
|
|
477
477
|
text: z.ZodString;
|
|
478
|
-
category: z.
|
|
479
|
-
community: z.
|
|
480
|
-
subject: z.
|
|
478
|
+
category: z.ZodString;
|
|
479
|
+
community: z.ZodString;
|
|
480
|
+
subject: z.ZodString;
|
|
481
|
+
node: z.ZodString;
|
|
481
482
|
icon: z.ZodOptional<z.ZodString>;
|
|
482
483
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
483
484
|
}, z.core.$strip>;
|
|
@@ -492,9 +493,10 @@ interface MemoryPartitionRememberDeps {
|
|
|
492
493
|
requestId?: string;
|
|
493
494
|
text: string;
|
|
494
495
|
tags?: string[];
|
|
495
|
-
category
|
|
496
|
-
community
|
|
497
|
-
subject
|
|
496
|
+
category: string;
|
|
497
|
+
community: string;
|
|
498
|
+
subject: string;
|
|
499
|
+
node: string;
|
|
498
500
|
icon?: string;
|
|
499
501
|
}) => Promise<string>;
|
|
500
502
|
}
|
|
@@ -503,6 +505,7 @@ declare function createMemoryPartitionRememberTool(deps: MemoryPartitionRemember
|
|
|
503
505
|
declare const memoryTaxonomyProbeSchema: z.ZodObject<{
|
|
504
506
|
kind: z.ZodEnum<{
|
|
505
507
|
community: "community";
|
|
508
|
+
node: "node";
|
|
506
509
|
cluster: "cluster";
|
|
507
510
|
hub: "hub";
|
|
508
511
|
}>;
|
package/dist/tools/index.mjs
CHANGED
|
@@ -1154,15 +1154,18 @@ ${lines.join("\n")}`;
|
|
|
1154
1154
|
}
|
|
1155
1155
|
var memoryPartitionRememberSchema = z.object({
|
|
1156
1156
|
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".'),
|
|
1157
|
-
category: z.string().min(1).max(40).
|
|
1157
|
+
category: z.string().min(1).max(40).describe(
|
|
1158
1158
|
'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"). Persona/roleplay or fictional content classifies by its real-world medium (a TV persona\u2019s biography \u2192 "shows"), never by in-universe domains ("family", "education", "business" describe reality, not an invented life). Always include it.'
|
|
1159
1159
|
),
|
|
1160
|
-
community: z.string().min(1).max(60).
|
|
1161
|
-
'One lowercase PLURAL sub-family narrowing the category, e.g. "survival games" under "games", "tv shows" under "shows" \u2014 the COMMUNITY tier, one level below the cluster (a genre, project family, or domain branch).
|
|
1160
|
+
community: z.string().min(1).max(60).describe(
|
|
1161
|
+
'One lowercase PLURAL sub-family narrowing the category, e.g. "survival games" under "games", "tv shows" under "shows" \u2014 the COMMUNITY tier, one level below the cluster (a genre, project family, or domain branch). Always present; never a specific entity, product, or title \u2014 a show/work title like "breaking-bad" is a hub, never a community.'
|
|
1162
1162
|
),
|
|
1163
|
-
subject: z.string().min(1).max(40).
|
|
1163
|
+
subject: z.string().min(1).max(40).describe(
|
|
1164
1164
|
'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.'
|
|
1165
1165
|
),
|
|
1166
|
+
node: z.string().min(1).max(120).describe(
|
|
1167
|
+
'The lowercase SINGULAR aspect the fact addresses under its hub \u2014 the NODE tier, e.g. "base building" under "project zomboid", "ryzen 9950x3d" under "amd". Reuse existing labels whenever they fit; never pluralized, never a sentence.'
|
|
1168
|
+
),
|
|
1166
1169
|
icon: z.string().min(1).max(64).optional().describe(
|
|
1167
1170
|
'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.'
|
|
1168
1171
|
),
|
|
@@ -1172,9 +1175,9 @@ var memoryPartitionRememberSchema = z.object({
|
|
|
1172
1175
|
});
|
|
1173
1176
|
function createMemoryPartitionRememberTool(deps) {
|
|
1174
1177
|
return tool({
|
|
1175
|
-
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
|
|
1178
|
+
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 down its strict chain: `category` one broad PLURAL family label (games, pets, work, health \u2026 \u2014 the cluster tier), `community` one PLURAL sub-family under it (survival games, action rpgs \u2026), `subject` the SINGULAR entity the fact is about (project zomboid, amd, sam \u2026 \u2014 the hub tier), `node` the SINGULAR aspect under the hub (base building, ryzen 9950x3d \u2026 \u2014 the node tier). ALL FOUR labels are always required; reuse existing labels whenever they fit.',
|
|
1176
1179
|
inputSchema: memoryPartitionRememberSchema,
|
|
1177
|
-
execute: async ({ text, tags, category, community, subject, icon }) => {
|
|
1180
|
+
execute: async ({ text, tags, category, community, subject, node, icon }) => {
|
|
1178
1181
|
try {
|
|
1179
1182
|
const id = await deps.storeRecord({
|
|
1180
1183
|
memoryPartition: deps.scope.memoryPartition,
|
|
@@ -1186,6 +1189,7 @@ function createMemoryPartitionRememberTool(deps) {
|
|
|
1186
1189
|
category,
|
|
1187
1190
|
community,
|
|
1188
1191
|
subject,
|
|
1192
|
+
node,
|
|
1189
1193
|
icon
|
|
1190
1194
|
});
|
|
1191
1195
|
return { stored: true, id };
|
|
@@ -1199,14 +1203,14 @@ function createMemoryPartitionRememberTool(deps) {
|
|
|
1199
1203
|
});
|
|
1200
1204
|
}
|
|
1201
1205
|
var memoryTaxonomyProbeSchema = z.object({
|
|
1202
|
-
kind: z.enum(["cluster", "community", "hub"]).describe(
|
|
1203
|
-
"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)."
|
|
1206
|
+
kind: z.enum(["cluster", "community", "hub", "node"]).describe(
|
|
1207
|
+
"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) \u2192 node (SINGULAR aspect under the hub)."
|
|
1204
1208
|
),
|
|
1205
1209
|
query: z.string().min(1).max(120).describe(
|
|
1206
1210
|
'The label you are considering (e.g. "games", "survival games", "project zomboid") \u2014 scored against the existing taxonomy by name similarity and meaning.'
|
|
1207
1211
|
),
|
|
1208
1212
|
parentId: z.string().optional().describe(
|
|
1209
|
-
"The adopted
|
|
1213
|
+
"The adopted label id from the tier ABOVE (community probes pass the adopted cluster id; hub probes the adopted community id; node probes the adopted hub id). Narrows the candidacy to that parent; omit only when you are about to CREATE the parent."
|
|
1210
1214
|
)
|
|
1211
1215
|
});
|
|
1212
1216
|
function createMemoryTaxonomyProbeTool(deps) {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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": "1.0.
|
|
5
|
-
"packageManager": "pnpm@12.
|
|
4
|
+
"version": "1.0.5",
|
|
5
|
+
"packageManager": "pnpm@12.15.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"exports": {
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@mozilla/readability": "^0.6.0",
|
|
58
58
|
"@triplef/helpers": "^1.6.1",
|
|
59
|
-
"linkedom": "^0.18.
|
|
59
|
+
"linkedom": "^0.18.14",
|
|
60
60
|
"turndown": "^7.2.4"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"ai": "^7.0.
|
|
64
|
-
"zod": "^4.6.
|
|
63
|
+
"ai": "^7.0.148",
|
|
64
|
+
"zod": "^4.6.7"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
67
67
|
"ai": {
|
|
@@ -74,25 +74,25 @@
|
|
|
74
74
|
"@types/eslint": "^9.6.1",
|
|
75
75
|
"@types/node": "^26.6.5",
|
|
76
76
|
"@types/turndown": "^5.0.6",
|
|
77
|
-
"@vitest/coverage-v8": "5.0.
|
|
77
|
+
"@vitest/coverage-v8": "5.0.5",
|
|
78
78
|
"depcheck": "^1.4.7",
|
|
79
|
-
"dependency-cruiser": "^18.
|
|
80
|
-
"eslint": "^10.
|
|
79
|
+
"dependency-cruiser": "^18.7.0",
|
|
80
|
+
"eslint": "^10.13.0",
|
|
81
81
|
"eslint-config-prettier": "^10.1.8",
|
|
82
|
-
"eslint-plugin-prettier": "^5.5.
|
|
82
|
+
"eslint-plugin-prettier": "^5.5.7",
|
|
83
83
|
"eslint-plugin-simple-import-sort": "^14.0.0",
|
|
84
84
|
"eslint-plugin-sonarjs": "^4.2.2",
|
|
85
85
|
"globals": "^17.13.0",
|
|
86
86
|
"husky": "^9.1.7",
|
|
87
87
|
"jiti": "^2.7.0",
|
|
88
88
|
"lint-staged": "^17.6.0",
|
|
89
|
-
"npm-check-updates": "^23.1.
|
|
89
|
+
"npm-check-updates": "^23.1.1",
|
|
90
90
|
"prettier": "^3.9.10",
|
|
91
91
|
"rimraf": "^6.1.3",
|
|
92
92
|
"ts-unused-exports": "^11.0.1",
|
|
93
93
|
"tsup": "^8.5.1",
|
|
94
94
|
"typescript": "^5.9.3",
|
|
95
|
-
"typescript-eslint": "^8.
|
|
96
|
-
"vitest": "^5.0.
|
|
95
|
+
"typescript-eslint": "^8.72.0",
|
|
96
|
+
"vitest": "^5.0.5"
|
|
97
97
|
}
|
|
98
98
|
}
|