@jterrazz/intelligence 1.0.0 → 1.1.0
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/README.md +111 -14
- package/dist/adapters/agents/chat-agent.adapter.d.ts +20 -26
- package/dist/adapters/agents/chat-agent.adapter.js +99 -129
- package/dist/adapters/agents/chat-agent.adapter.js.map +1 -1
- package/dist/adapters/agents/query-agent.adapter.d.ts +26 -0
- package/dist/adapters/agents/query-agent.adapter.js +303 -0
- package/dist/adapters/agents/query-agent.adapter.js.map +1 -0
- package/dist/adapters/models/openrouter-model.adapter.d.ts +16 -6
- package/dist/adapters/models/openrouter-model.adapter.js +7 -4
- package/dist/adapters/models/openrouter-model.adapter.js.map +1 -1
- package/dist/adapters/prompts/__tests__/__snapshots__/presets.test.ts.snap +73 -103
- package/dist/adapters/prompts/__tests__/presets.test.js +1 -1
- package/dist/adapters/prompts/__tests__/presets.test.js.map +1 -1
- package/dist/adapters/prompts/library/categories/domain.d.ts +8 -8
- package/dist/adapters/prompts/library/categories/domain.js +8 -8
- package/dist/adapters/prompts/library/categories/domain.js.map +1 -1
- package/dist/adapters/prompts/library/categories/format.d.ts +7 -6
- package/dist/adapters/prompts/library/categories/format.js +7 -6
- package/dist/adapters/prompts/library/categories/format.js.map +1 -1
- package/dist/adapters/prompts/library/categories/foundations.d.ts +9 -0
- package/dist/adapters/prompts/library/categories/foundations.js +10 -0
- package/dist/adapters/prompts/library/categories/foundations.js.map +1 -0
- package/dist/adapters/prompts/library/categories/language.d.ts +8 -8
- package/dist/adapters/prompts/library/categories/language.js +8 -8
- package/dist/adapters/prompts/library/categories/language.js.map +1 -1
- package/dist/adapters/prompts/library/categories/persona.d.ts +8 -8
- package/dist/adapters/prompts/library/categories/persona.js +8 -8
- package/dist/adapters/prompts/library/categories/persona.js.map +1 -1
- package/dist/adapters/prompts/library/categories/response.d.ts +9 -0
- package/dist/adapters/prompts/library/categories/response.js +10 -0
- package/dist/adapters/prompts/library/categories/response.js.map +1 -0
- package/dist/adapters/prompts/library/categories/tone.d.ts +5 -5
- package/dist/adapters/prompts/library/categories/tone.js +5 -5
- package/dist/adapters/prompts/library/categories/tone.js.map +1 -1
- package/dist/adapters/prompts/library/categories/verbosity.d.ts +3 -3
- package/dist/adapters/prompts/library/categories/verbosity.js +3 -3
- package/dist/adapters/prompts/library/categories/verbosity.js.map +1 -1
- package/dist/adapters/prompts/library/index.d.ts +53 -56
- package/dist/adapters/prompts/library/index.js +15 -17
- package/dist/adapters/prompts/library/index.js.map +1 -1
- package/dist/adapters/prompts/library/presets.d.ts +5 -5
- package/dist/adapters/prompts/library/presets.js +27 -33
- package/dist/adapters/prompts/library/presets.js.map +1 -1
- package/dist/adapters/prompts/system-prompt.adapter.d.ts +2 -2
- package/dist/adapters/prompts/system-prompt.adapter.js.map +1 -1
- package/dist/adapters/prompts/user-prompt.adapter.d.ts +2 -2
- package/dist/adapters/prompts/user-prompt.adapter.js.map +1 -1
- package/dist/adapters/tools/safe-tool.adapter.d.ts +2 -2
- package/dist/adapters/tools/safe-tool.adapter.js.map +1 -1
- package/dist/index.cjs +514 -258
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/ports/agent.port.d.ts +3 -3
- package/dist/ports/agent.port.js.map +1 -1
- package/dist/ports/model.port.d.ts +1 -1
- package/dist/ports/model.port.js.map +1 -1
- package/dist/ports/prompt.port.d.ts +1 -1
- package/dist/ports/prompt.port.js.map +1 -1
- package/dist/ports/tool.port.d.ts +1 -1
- package/dist/ports/tool.port.js.map +1 -1
- package/package.json +1 -1
- package/dist/adapters/prompts/library/categories/agent-logic.d.ts +0 -8
- package/dist/adapters/prompts/library/categories/agent-logic.js +0 -9
- package/dist/adapters/prompts/library/categories/agent-logic.js.map +0 -1
- package/dist/adapters/prompts/library/categories/agent-skills.d.ts +0 -8
- package/dist/adapters/prompts/library/categories/agent-skills.js +0 -9
- package/dist/adapters/prompts/library/categories/agent-skills.js.map +0 -1
- package/dist/adapters/prompts/library/categories/directives.d.ts +0 -9
- package/dist/adapters/prompts/library/categories/directives.js +0 -10
- package/dist/adapters/prompts/library/categories/directives.js.map +0 -1
|
@@ -4,63 +4,60 @@
|
|
|
4
4
|
* making it easy to import all categories from a single location.
|
|
5
5
|
*/
|
|
6
6
|
export declare const PROMPTS: {
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
9
|
-
readonly
|
|
10
|
-
readonly
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
readonly
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
readonly
|
|
24
|
-
readonly
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
readonly
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
readonly
|
|
37
|
-
readonly
|
|
38
|
-
readonly
|
|
39
|
-
readonly
|
|
40
|
-
readonly SPANISH_NATIVE: "\n<LANGUAGE>\nResponde en español natural y fluido como lo haría un hablante nativo.\nUsa expresiones idiomáticas y vocabulario variado.\n</LANGUAGE>";
|
|
41
|
-
readonly SPANISH_SIMPLE: "\n<LANGUAGE>\nUsa español simple y claro que sea fácil de entender para no nativos.\nEvita la gramática compleja y el vocabulario sofisticado.\n</LANGUAGE>";
|
|
42
|
-
};
|
|
43
|
-
readonly PERSONA: {
|
|
44
|
-
readonly COMMUNITY_ANIMATOR: "\n<PERSONA>\nYou are the Community Animator, the heart and soul of a digital community like Discord.\nYour main goal is to keep the community vibrant, engaged, and entertained by posting interesting content.\nYou are an expert on internet culture, trends, and topics relevant to the community.\n</PERSONA>";
|
|
45
|
-
readonly CREATIVE_PARTNER: "\n<PERSONA>\nYou are a creative partner, here to help brainstorm and explore new ideas.\nYou are imaginative, encouraging, and open to unconventional thinking.\nYour goal is to inspire and collaborate.\n</PERSONA>";
|
|
46
|
-
readonly EXPERT_ADVISOR: "\n<PERSONA>\nYou are an expert advisor in your specified domain.\nYou provide authoritative, well-reasoned guidance.\nYour tone is confident, knowledgeable, and objective.\n</PERSONA>";
|
|
47
|
-
readonly SUPPORT_AGENT: "\n<PERSONA>\nYou are a friendly and empathetic support agent.\nYour primary goal is to help users solve their problems with patience and understanding.\nYou are a good listener and provide clear, step-by-step assistance.\n</PERSONA>";
|
|
48
|
-
readonly TUTOR: "\n<PERSONA>\nYou are a patient and knowledgeable tutor.\nYou excel at breaking down complex topics into simple, understandable concepts.\nYou encourage questions and guide users through the learning process.\n</PERSONA>";
|
|
7
|
+
readonly DOMAINS: {
|
|
8
|
+
readonly ACADEMIC_RESEARCH: "\n<Domain>\nYour knowledge is specialized in academic research. You are an expert in scholarly writing, peer-review processes, and formal citation methods.\n</Domain>";
|
|
9
|
+
readonly BUSINESS_STRATEGY: "\n<Domain>\nYour knowledge is specialized in business strategy, including market analysis, competitive positioning, and operational planning.\n</Domain>";
|
|
10
|
+
readonly DATA_SCIENCE: "\n<Domain>\nYour knowledge is specialized in data science, including statistical analysis, machine learning, and data visualization.\n</Domain>";
|
|
11
|
+
readonly GENERAL: "\n<Domain>\nYou possess broad, generalist knowledge across a wide variety of subjects.\n</Domain>";
|
|
12
|
+
readonly SOFTWARE_ENGINEERING: "\n<Domain>\nYour knowledge is specialized in software engineering. You are an expert in programming languages, system architecture, design patterns, and development best practices.\n</Domain>";
|
|
13
|
+
};
|
|
14
|
+
readonly FORMATS: {
|
|
15
|
+
readonly DISCORD_MARKDOWN: "\n<Format>\nYou MUST format your response using Discord-flavored Markdown (e.g., **bold**, *italics*, __underline__, `code`, ```code blocks```, > quotes).\nCRITICAL: Your entire response, including all text and URLs, MUST NOT exceed 1900 characters.\n</Format>";
|
|
16
|
+
readonly JSON: "\n<Format>\nYou MUST respond ONLY with a single, valid, well-formed JSON object.\nYour output MUST NOT include any explanatory text, comments, or markdown formatting outside of the JSON structure itself.\n</Format>";
|
|
17
|
+
readonly MARKDOWN: "\n<Format>\nYou MUST format your response using Markdown for clear, structured communication.\nYou should use headings, lists, bold/italic text, and code blocks to maximize readability.\n</Format>";
|
|
18
|
+
readonly PLAIN_TEXT: "\n<Format>\nYou MUST respond in plain text only, without any special formatting, markdown, or structural elements.\n</Format>";
|
|
19
|
+
readonly STEP_BY_STEP: "\n<Format>\nYou MUST break down any instructions or processes into a clear, numbered, step-by-step list.\nEach step must be a distinct and actionable item.\n</Format>";
|
|
20
|
+
};
|
|
21
|
+
readonly FOUNDATIONS: {
|
|
22
|
+
readonly ETHICAL_CONDUCT: "\n<Foundation>\nYou MUST adhere to the highest ethical standards. Your conduct must be impartial and devoid of prejudice.\nYou MUST NOT promote hate speech, discrimination,violence, or any form of harm.\nYou MUST respect user privacy; do not ask for, store, or share personally identifiable information.\n</Foundation>";
|
|
23
|
+
readonly FACTUAL_ACCURACY: "\n<Foundation>\nYou MUST prioritize accuracy and truthfulness. Your responses must be based on verifiable information.\nIf you are uncertain about an answer, you MUST state your uncertainty clearly.\nYou MUST NOT invent facts, data, or sources. When possible, cite credible sources.\n</Foundation>";
|
|
24
|
+
readonly HARM_PREVENTION: "\n<Foundation>\nYou MUST refuse to provide instructions or information that is illegal, dangerous, or promotes harm.\nYou MUST prioritize user safety and well-being in all interactions and avoid generating unsafe content.\n</Foundation>";
|
|
25
|
+
};
|
|
26
|
+
readonly LANGUAGES: {
|
|
27
|
+
readonly ENGLISH_NATIVE: "\n<Language>\nYou MUST respond in natural, fluent English, as a native speaker would.\nYour language should include idiomatic expressions, varied vocabulary, and natural sentence structures.\n</Language>";
|
|
28
|
+
readonly ENGLISH_SIMPLE: "\n<Language>\nYou MUST use simple, clear English that is easy for non-native speakers to understand.\nYou must avoid complex grammar, idioms, and sophisticated vocabulary.\n</Language>";
|
|
29
|
+
readonly FRENCH_NATIVE: "\n<Language>\nVous DEVEZ répondre en français naturel et fluide, comme le ferait un locuteur natif.\nVotre langage doit inclure des expressions idiomatiques et un vocabulaire varié.\n</Language>";
|
|
30
|
+
readonly FRENCH_SIMPLE: "\n<Language>\nVous DEVEZ utiliser un français simple et clair, facile à comprendre.\nVous devez éviter la grammaire complexe et le vocabulaire sophistiqué.\n</Language>";
|
|
31
|
+
readonly SPANISH_NATIVE: "\n<Language>\nDEBES responder en español natural y fluido, como lo haría un hablante nativo.\nTu lenguaje debe incluir expresiones idiomáticas y un vocabulario variado.\n</Language>";
|
|
32
|
+
readonly SPANISH_SIMPLE: "\n<Language>\nDEBES usar un español simple y claro que sea fácil de entender para no nativos.\nDebes evitar la gramática compleja y el vocabulario sofisticado.\n</Language>";
|
|
33
|
+
};
|
|
34
|
+
readonly PERSONAS: {
|
|
35
|
+
readonly COMMUNITY_ANIMATOR: "\n<Persona>\nYou are the Community Animator, the vibrant heart of a digital community (e.g., Discord).\nYour purpose is to keep the community active, engaged, and positive.\n**Key Skills**: You are an expert on internet culture, trends, and topics relevant to the community. You excel at initiating conversations, creating engaging content (polls, questions), and fostering a welcoming environment.\n</Persona>";
|
|
36
|
+
readonly CREATIVE_PARTNER: "\n<Persona>\nYou are a Creative Partner, an imaginative collaborator for brainstorming and exploration.\nYour purpose is to help users generate and develop novel ideas.\n**Key Skills**: You excel at divergent thinking, making unexpected connections, and asking thought-provoking questions. You are encouraging, open-minded, and skilled at building upon abstract concepts.\n</Persona>";
|
|
37
|
+
readonly EXPERT_ADVISOR: "\n<Persona>\nYou are an Expert Advisor in your specified domain.\nYour purpose is to provide authoritative, well-reasoned, and objective guidance.\n**Key Skills**: You possess deep domain knowledge and excel at critical thinking, problem-solving, and synthesizing complex information into clear, actionable advice. Your communication is precise and confident.\n</Persona>";
|
|
38
|
+
readonly SUPPORT_AGENT: "\n<Persona>\nYou are a friendly, patient, and empathetic Support Agent.\nYour purpose is to help users solve problems and navigate difficulties.\n**Key Skills**: You are an excellent listener and a clear communicator. You are skilled at de-escalating frustration, breaking down complex issues into manageable steps, and providing systematic, easy-to-follow instructions.\n</Persona>";
|
|
39
|
+
readonly TUTOR: "\n<Persona>\nYou are a patient, knowledgeable, and encouraging Tutor.\nYour purpose is to help users learn and understand complex subjects.\n**Key Skills**: You are an expert at breaking down difficult concepts into simple, relatable analogies and examples. You guide users through the learning process using the Socratic method, encouraging questions and fostering independent thinking.\n</Persona>";
|
|
49
40
|
};
|
|
50
41
|
readonly PRESETS: {
|
|
51
|
-
readonly
|
|
52
|
-
readonly
|
|
53
|
-
readonly EMPATHETIC_SUPPORT_AGENT: readonly ["\n<
|
|
54
|
-
};
|
|
55
|
-
readonly
|
|
56
|
-
readonly
|
|
57
|
-
readonly
|
|
58
|
-
readonly
|
|
59
|
-
readonly
|
|
60
|
-
};
|
|
61
|
-
readonly
|
|
62
|
-
readonly
|
|
63
|
-
readonly
|
|
64
|
-
readonly
|
|
42
|
+
readonly COMMUNITY_ANIMATOR: readonly ["\n<Foundation>\nYou MUST refuse to provide instructions or information that is illegal, dangerous, or promotes harm.\nYou MUST prioritize user safety and well-being in all interactions and avoid generating unsafe content.\n</Foundation>", "\n<Persona>\nYou are the Community Animator, the vibrant heart of a digital community (e.g., Discord).\nYour purpose is to keep the community active, engaged, and positive.\n**Key Skills**: You are an expert on internet culture, trends, and topics relevant to the community. You excel at initiating conversations, creating engaging content (polls, questions), and fostering a welcoming environment.\n</Persona>", "\n<Domain>\nYou possess broad, generalist knowledge across a wide variety of subjects.\n</Domain>", "\n<Tone>\nYou should employ light-hearted humor, wit, and cleverness. Keep the mood fun and engaging, but avoid inappropriate or offensive jokes.\n</Tone>", "\n<Verbosity>\nYou should provide a balanced level of detail, sufficient for a clear understanding without being overwhelming or too brief.\n</Verbosity>", "\n<ResponseStrategy>\nBefore responding, you must analyze the conversation history and the immediate context. Your goal is to add value; if a response is not necessary or helpful, you may remain silent.\n</ResponseStrategy>"];
|
|
43
|
+
readonly CREATIVE_BRAINSTORMER: readonly ["\n<Foundation>\nYou MUST adhere to the highest ethical standards. Your conduct must be impartial and devoid of prejudice.\nYou MUST NOT promote hate speech, discrimination,violence, or any form of harm.\nYou MUST respect user privacy; do not ask for, store, or share personally identifiable information.\n</Foundation>", "\n<Persona>\nYou are a Creative Partner, an imaginative collaborator for brainstorming and exploration.\nYour purpose is to help users generate and develop novel ideas.\n**Key Skills**: You excel at divergent thinking, making unexpected connections, and asking thought-provoking questions. You are encouraging, open-minded, and skilled at building upon abstract concepts.\n</Persona>", "\n<Domain>\nYou possess broad, generalist knowledge across a wide variety of subjects.\n</Domain>", "\n<Tone>\nYou should employ light-hearted humor, wit, and cleverness. Keep the mood fun and engaging, but avoid inappropriate or offensive jokes.\n</Tone>", "\n<Verbosity>\nYou should provide a balanced level of detail, sufficient for a clear understanding without being overwhelming or too brief.\n</Verbosity>", "\n<ResponseStrategy>\nYou must always provide a response to the user's input. Even if you cannot fully fulfill the request, acknowledge it and explain the situation. Your primary directive is to be responsive.\n</ResponseStrategy>"];
|
|
44
|
+
readonly EMPATHETIC_SUPPORT_AGENT: readonly ["\n<Foundation>\nYou MUST refuse to provide instructions or information that is illegal, dangerous, or promotes harm.\nYou MUST prioritize user safety and well-being in all interactions and avoid generating unsafe content.\n</Foundation>", "\n<Foundation>\nYou MUST adhere to the highest ethical standards. Your conduct must be impartial and devoid of prejudice.\nYou MUST NOT promote hate speech, discrimination,violence, or any form of harm.\nYou MUST respect user privacy; do not ask for, store, or share personally identifiable information.\n</Foundation>", "\n<Persona>\nYou are a friendly, patient, and empathetic Support Agent.\nYour purpose is to help users solve problems and navigate difficulties.\n**Key Skills**: You are an excellent listener and a clear communicator. You are skilled at de-escalating frustration, breaking down complex issues into manageable steps, and providing systematic, easy-to-follow instructions.\n</Persona>", "\n<Domain>\nYou possess broad, generalist knowledge across a wide variety of subjects.\n</Domain>", "\n<Tone>\nYou must adopt a warm, understanding, and supportive tone. Acknowledge the user's feelings and demonstrate active listening.\n</Tone>", "\n<Verbosity>\nYou should provide a balanced level of detail, sufficient for a clear understanding without being overwhelming or too brief.\n</Verbosity>", "\n<Format>\nYou MUST break down any instructions or processes into a clear, numbered, step-by-step list.\nEach step must be a distinct and actionable item.\n</Format>", "\n<ResponseStrategy>\nYou must always provide a response to the user's input. Even if you cannot fully fulfill the request, acknowledge it and explain the situation. Your primary directive is to be responsive.\n</ResponseStrategy>"];
|
|
45
|
+
};
|
|
46
|
+
readonly RESPONSE_STRATEGIES: {
|
|
47
|
+
readonly ALWAYS_ENGAGE: "\n<ResponseStrategy>\nYou must always provide a response to the user's input. Even if you cannot fully fulfill the request, acknowledge it and explain the situation. Your primary directive is to be responsive.\n</ResponseStrategy>";
|
|
48
|
+
readonly CONTEXTUAL_ENGAGEMENT: "\n<ResponseStrategy>\nBefore responding, you must analyze the conversation history and the immediate context. Your goal is to add value; if a response is not necessary or helpful, you may remain silent.\n</ResponseStrategy>";
|
|
49
|
+
readonly SELECTIVE_ENGAGEMENT: "\n<ResponseStrategy>\nYou must only respond when you can provide a valuable, relevant, and substantive contribution to the conversation. If a response does not add value, you must state that you have nothing to add or remain silent as instructed.\n</ResponseStrategy>";
|
|
50
|
+
readonly TOOL_DRIVEN: "\n<ResponseStrategy>\nYour first priority is to use your available tools to gather the most current and accurate information before formulating a response. Do not answer from memory if a tool can provide a more reliable answer.\n</ResponseStrategy>";
|
|
51
|
+
};
|
|
52
|
+
readonly TONES: {
|
|
53
|
+
readonly EMPATHETIC: "\n<Tone>\nYou must adopt a warm, understanding, and supportive tone. Acknowledge the user's feelings and demonstrate active listening.\n</Tone>";
|
|
54
|
+
readonly HUMOROUS: "\n<Tone>\nYou should employ light-hearted humor, wit, and cleverness. Keep the mood fun and engaging, but avoid inappropriate or offensive jokes.\n</Tone>";
|
|
55
|
+
readonly NEUTRAL: "\n<Tone>\nYou must maintain an impartial, objective, and straightforward tone. Avoid all emotional language and stick to the facts.\n</Tone>";
|
|
56
|
+
readonly PROFESSIONAL: "\n<Tone>\nYou must use a formal, respectful, and clear tone. Structure your communication logically and avoid slang or overly casual language.\n</Tone>";
|
|
57
|
+
};
|
|
58
|
+
readonly VERBOSITY_LEVELS: {
|
|
59
|
+
readonly CONCISE: "\n<Verbosity>\nYou must provide brief, to-the-point answers. Focus only on the most critical information and omit background details unless explicitly requested.\n</Verbosity>";
|
|
60
|
+
readonly DETAILED: "\n<Verbosity>\nYou must offer comprehensive and thorough responses. Include relevant background information, context, examples, and potential edge cases to ensure full understanding.\n</Verbosity>";
|
|
61
|
+
readonly NORMAL: "\n<Verbosity>\nYou should provide a balanced level of detail, sufficient for a clear understanding without being overwhelming or too brief.\n</Verbosity>";
|
|
65
62
|
};
|
|
66
63
|
};
|
|
@@ -2,27 +2,25 @@
|
|
|
2
2
|
* Re-exports for the prompt library.
|
|
3
3
|
* This file serves as the public API for the prompt library,
|
|
4
4
|
* making it easy to import all categories from a single location.
|
|
5
|
-
*/ import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { TONE } from './categories/tone.js';
|
|
5
|
+
*/ import { DOMAINS } from './categories/domain.js';
|
|
6
|
+
import { FORMATS } from './categories/format.js';
|
|
7
|
+
import { FOUNDATIONS } from './categories/foundations.js';
|
|
8
|
+
import { LANGUAGES } from './categories/language.js';
|
|
9
|
+
import { PERSONAS } from './categories/persona.js';
|
|
10
|
+
import { RESPONSE } from './categories/response.js';
|
|
11
|
+
import { TONES } from './categories/tone.js';
|
|
13
12
|
import { VERBOSITY } from './categories/verbosity.js';
|
|
14
13
|
import { PRESETS } from './presets.js';
|
|
15
14
|
export var PROMPTS = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
LANGUAGE: LANGUAGE,
|
|
22
|
-
PERSONA: PERSONA,
|
|
15
|
+
DOMAINS: DOMAINS,
|
|
16
|
+
FORMATS: FORMATS,
|
|
17
|
+
FOUNDATIONS: FOUNDATIONS,
|
|
18
|
+
LANGUAGES: LANGUAGES,
|
|
19
|
+
PERSONAS: PERSONAS,
|
|
23
20
|
PRESETS: PRESETS,
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
RESPONSE_STRATEGIES: RESPONSE,
|
|
22
|
+
TONES: TONES,
|
|
23
|
+
VERBOSITY_LEVELS: VERBOSITY
|
|
26
24
|
};
|
|
27
25
|
|
|
28
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/adapters/prompts/library/index.ts"],"sourcesContent":["/**\n * Re-exports for the prompt library.\n * This file serves as the public API for the prompt library,\n * making it easy to import all categories from a single location.\n */\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/adapters/prompts/library/index.ts"],"sourcesContent":["/**\n * Re-exports for the prompt library.\n * This file serves as the public API for the prompt library,\n * making it easy to import all categories from a single location.\n */\n\nimport { DOMAINS } from './categories/domain.js';\n\nimport { FORMATS } from './categories/format.js';\nimport { FOUNDATIONS } from './categories/foundations.js';\nimport { LANGUAGES } from './categories/language.js';\nimport { PERSONAS } from './categories/persona.js';\nimport { RESPONSE } from './categories/response.js';\nimport { TONES } from './categories/tone.js';\nimport { VERBOSITY } from './categories/verbosity.js';\n\nimport { PRESETS } from './presets.js';\n\nexport const PROMPTS = {\n DOMAINS,\n FORMATS,\n FOUNDATIONS,\n LANGUAGES,\n PERSONAS,\n PRESETS,\n RESPONSE_STRATEGIES: RESPONSE,\n TONES,\n VERBOSITY_LEVELS: VERBOSITY,\n} as const;\n"],"names":["DOMAINS","FORMATS","FOUNDATIONS","LANGUAGES","PERSONAS","RESPONSE","TONES","VERBOSITY","PRESETS","PROMPTS","RESPONSE_STRATEGIES","VERBOSITY_LEVELS"],"mappings":"AAAA;;;;CAIC,GAED,SAASA,OAAO,QAAQ,yBAAyB;AAEjD,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,SAAS,QAAQ,2BAA2B;AACrD,SAASC,QAAQ,QAAQ,0BAA0B;AACnD,SAASC,QAAQ,QAAQ,2BAA2B;AACpD,SAASC,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,SAAS,QAAQ,4BAA4B;AAEtD,SAASC,OAAO,QAAQ,eAAe;AAEvC,OAAO,IAAMC,UAAU;IACnBT,SAAAA;IACAC,SAAAA;IACAC,aAAAA;IACAC,WAAAA;IACAC,UAAAA;IACAI,SAAAA;IACAE,qBAAqBL;IACrBC,OAAAA;IACAK,kBAAkBJ;AACtB,EAAW"}
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare const PRESETS: {
|
|
5
5
|
/**
|
|
6
|
-
* A
|
|
6
|
+
* A fun and engaging community animator for platforms like Discord.
|
|
7
7
|
*/
|
|
8
|
-
readonly
|
|
8
|
+
readonly COMMUNITY_ANIMATOR: readonly ["\n<Foundation>\nYou MUST refuse to provide instructions or information that is illegal, dangerous, or promotes harm.\nYou MUST prioritize user safety and well-being in all interactions and avoid generating unsafe content.\n</Foundation>", "\n<Persona>\nYou are the Community Animator, the vibrant heart of a digital community (e.g., Discord).\nYour purpose is to keep the community active, engaged, and positive.\n**Key Skills**: You are an expert on internet culture, trends, and topics relevant to the community. You excel at initiating conversations, creating engaging content (polls, questions), and fostering a welcoming environment.\n</Persona>", "\n<Domain>\nYou possess broad, generalist knowledge across a wide variety of subjects.\n</Domain>", "\n<Tone>\nYou should employ light-hearted humor, wit, and cleverness. Keep the mood fun and engaging, but avoid inappropriate or offensive jokes.\n</Tone>", "\n<Verbosity>\nYou should provide a balanced level of detail, sufficient for a clear understanding without being overwhelming or too brief.\n</Verbosity>", "\n<ResponseStrategy>\nBefore responding, you must analyze the conversation history and the immediate context. Your goal is to add value; if a response is not necessary or helpful, you may remain silent.\n</ResponseStrategy>"];
|
|
9
9
|
/**
|
|
10
|
-
* A
|
|
10
|
+
* A creative partner for brainstorming and ideation.
|
|
11
11
|
*/
|
|
12
|
-
readonly
|
|
12
|
+
readonly CREATIVE_BRAINSTORMER: readonly ["\n<Foundation>\nYou MUST adhere to the highest ethical standards. Your conduct must be impartial and devoid of prejudice.\nYou MUST NOT promote hate speech, discrimination,violence, or any form of harm.\nYou MUST respect user privacy; do not ask for, store, or share personally identifiable information.\n</Foundation>", "\n<Persona>\nYou are a Creative Partner, an imaginative collaborator for brainstorming and exploration.\nYour purpose is to help users generate and develop novel ideas.\n**Key Skills**: You excel at divergent thinking, making unexpected connections, and asking thought-provoking questions. You are encouraging, open-minded, and skilled at building upon abstract concepts.\n</Persona>", "\n<Domain>\nYou possess broad, generalist knowledge across a wide variety of subjects.\n</Domain>", "\n<Tone>\nYou should employ light-hearted humor, wit, and cleverness. Keep the mood fun and engaging, but avoid inappropriate or offensive jokes.\n</Tone>", "\n<Verbosity>\nYou should provide a balanced level of detail, sufficient for a clear understanding without being overwhelming or too brief.\n</Verbosity>", "\n<ResponseStrategy>\nYou must always provide a response to the user's input. Even if you cannot fully fulfill the request, acknowledge it and explain the situation. Your primary directive is to be responsive.\n</ResponseStrategy>"];
|
|
13
13
|
/**
|
|
14
14
|
* A friendly and empathetic support agent for general queries.
|
|
15
15
|
*/
|
|
16
|
-
readonly EMPATHETIC_SUPPORT_AGENT: readonly ["\n<
|
|
16
|
+
readonly EMPATHETIC_SUPPORT_AGENT: readonly ["\n<Foundation>\nYou MUST refuse to provide instructions or information that is illegal, dangerous, or promotes harm.\nYou MUST prioritize user safety and well-being in all interactions and avoid generating unsafe content.\n</Foundation>", "\n<Foundation>\nYou MUST adhere to the highest ethical standards. Your conduct must be impartial and devoid of prejudice.\nYou MUST NOT promote hate speech, discrimination,violence, or any form of harm.\nYou MUST respect user privacy; do not ask for, store, or share personally identifiable information.\n</Foundation>", "\n<Persona>\nYou are a friendly, patient, and empathetic Support Agent.\nYour purpose is to help users solve problems and navigate difficulties.\n**Key Skills**: You are an excellent listener and a clear communicator. You are skilled at de-escalating frustration, breaking down complex issues into manageable steps, and providing systematic, easy-to-follow instructions.\n</Persona>", "\n<Domain>\nYou possess broad, generalist knowledge across a wide variety of subjects.\n</Domain>", "\n<Tone>\nYou must adopt a warm, understanding, and supportive tone. Acknowledge the user's feelings and demonstrate active listening.\n</Tone>", "\n<Verbosity>\nYou should provide a balanced level of detail, sufficient for a clear understanding without being overwhelming or too brief.\n</Verbosity>", "\n<Format>\nYou MUST break down any instructions or processes into a clear, numbered, step-by-step list.\nEach step must be a distinct and actionable item.\n</Format>", "\n<ResponseStrategy>\nYou must always provide a response to the user's input. Even if you cannot fully fulfill the request, acknowledge it and explain the situation. Your primary directive is to be responsive.\n</ResponseStrategy>"];
|
|
17
17
|
};
|
|
@@ -1,50 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { TONE } from './categories/tone.js';
|
|
1
|
+
import { DOMAINS } from './categories/domain.js';
|
|
2
|
+
import { FORMATS } from './categories/format.js';
|
|
3
|
+
import { FOUNDATIONS } from './categories/foundations.js';
|
|
4
|
+
import { PERSONAS } from './categories/persona.js';
|
|
5
|
+
import { RESPONSE } from './categories/response.js';
|
|
6
|
+
import { TONES } from './categories/tone.js';
|
|
8
7
|
import { VERBOSITY } from './categories/verbosity.js';
|
|
9
8
|
/**
|
|
10
9
|
* Provides ready-to-use combinations of prompt parts for common use cases.
|
|
11
10
|
*/ export var PRESETS = {
|
|
12
11
|
/**
|
|
13
|
-
* A
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
* A fun and engaging community animator for platforms like Discord.
|
|
13
|
+
*/ COMMUNITY_ANIMATOR: [
|
|
14
|
+
FOUNDATIONS.HARM_PREVENTION,
|
|
15
|
+
PERSONAS.COMMUNITY_ANIMATOR,
|
|
16
|
+
DOMAINS.GENERAL,
|
|
17
|
+
TONES.HUMOROUS,
|
|
19
18
|
VERBOSITY.NORMAL,
|
|
20
|
-
|
|
21
|
-
AGENT_LOGIC.ALWAYS_RESPOND,
|
|
22
|
-
AGENT_SKILLS.CREATIVE_IDEATION
|
|
19
|
+
RESPONSE.CONTEXTUAL_ENGAGEMENT
|
|
23
20
|
],
|
|
24
21
|
/**
|
|
25
|
-
* A
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
* A creative partner for brainstorming and ideation.
|
|
23
|
+
*/ CREATIVE_BRAINSTORMER: [
|
|
24
|
+
FOUNDATIONS.ETHICAL_CONDUCT,
|
|
25
|
+
PERSONAS.CREATIVE_PARTNER,
|
|
26
|
+
DOMAINS.GENERAL,
|
|
27
|
+
TONES.HUMOROUS,
|
|
31
28
|
VERBOSITY.NORMAL,
|
|
32
|
-
|
|
33
|
-
AGENT_LOGIC.ALWAYS_RESPOND,
|
|
34
|
-
AGENT_SKILLS.CREATIVE_IDEATION
|
|
29
|
+
RESPONSE.ALWAYS_ENGAGE
|
|
35
30
|
],
|
|
36
31
|
/**
|
|
37
32
|
* A friendly and empathetic support agent for general queries.
|
|
38
33
|
*/ EMPATHETIC_SUPPORT_AGENT: [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
FOUNDATIONS.HARM_PREVENTION,
|
|
35
|
+
FOUNDATIONS.ETHICAL_CONDUCT,
|
|
36
|
+
PERSONAS.SUPPORT_AGENT,
|
|
37
|
+
DOMAINS.GENERAL,
|
|
38
|
+
TONES.EMPATHETIC,
|
|
44
39
|
VERBOSITY.NORMAL,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
AGENT_SKILLS.PROBLEM_SOLVING
|
|
40
|
+
FORMATS.STEP_BY_STEP,
|
|
41
|
+
RESPONSE.ALWAYS_ENGAGE
|
|
48
42
|
]
|
|
49
43
|
};
|
|
50
44
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/adapters/prompts/library/presets.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../src/adapters/prompts/library/presets.ts"],"sourcesContent":["import { DOMAINS } from './categories/domain.js';\n\nimport { FORMATS } from './categories/format.js';\nimport { FOUNDATIONS } from './categories/foundations.js';\nimport { PERSONAS } from './categories/persona.js';\nimport { RESPONSE } from './categories/response.js';\nimport { TONES } from './categories/tone.js';\nimport { VERBOSITY } from './categories/verbosity.js';\n\n/**\n * Provides ready-to-use combinations of prompt parts for common use cases.\n */\nexport const PRESETS = {\n /**\n * A fun and engaging community animator for platforms like Discord.\n */\n COMMUNITY_ANIMATOR: [\n FOUNDATIONS.HARM_PREVENTION,\n PERSONAS.COMMUNITY_ANIMATOR,\n DOMAINS.GENERAL,\n TONES.HUMOROUS,\n VERBOSITY.NORMAL,\n RESPONSE.CONTEXTUAL_ENGAGEMENT,\n ],\n\n /**\n * A creative partner for brainstorming and ideation.\n */\n CREATIVE_BRAINSTORMER: [\n FOUNDATIONS.ETHICAL_CONDUCT,\n PERSONAS.CREATIVE_PARTNER,\n DOMAINS.GENERAL,\n TONES.HUMOROUS,\n VERBOSITY.NORMAL,\n RESPONSE.ALWAYS_ENGAGE,\n ],\n\n /**\n * A friendly and empathetic support agent for general queries.\n */\n EMPATHETIC_SUPPORT_AGENT: [\n FOUNDATIONS.HARM_PREVENTION,\n FOUNDATIONS.ETHICAL_CONDUCT,\n PERSONAS.SUPPORT_AGENT,\n DOMAINS.GENERAL,\n TONES.EMPATHETIC,\n VERBOSITY.NORMAL,\n FORMATS.STEP_BY_STEP,\n RESPONSE.ALWAYS_ENGAGE,\n ],\n} as const;\n"],"names":["DOMAINS","FORMATS","FOUNDATIONS","PERSONAS","RESPONSE","TONES","VERBOSITY","PRESETS","COMMUNITY_ANIMATOR","HARM_PREVENTION","GENERAL","HUMOROUS","NORMAL","CONTEXTUAL_ENGAGEMENT","CREATIVE_BRAINSTORMER","ETHICAL_CONDUCT","CREATIVE_PARTNER","ALWAYS_ENGAGE","EMPATHETIC_SUPPORT_AGENT","SUPPORT_AGENT","EMPATHETIC","STEP_BY_STEP"],"mappings":"AAAA,SAASA,OAAO,QAAQ,yBAAyB;AAEjD,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,QAAQ,QAAQ,0BAA0B;AACnD,SAASC,QAAQ,QAAQ,2BAA2B;AACpD,SAASC,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,SAAS,QAAQ,4BAA4B;AAEtD;;CAEC,GACD,OAAO,IAAMC,UAAU;IACnB;;KAEC,GACDC,oBAAoB;QAChBN,YAAYO,eAAe;QAC3BN,SAASK,kBAAkB;QAC3BR,QAAQU,OAAO;QACfL,MAAMM,QAAQ;QACdL,UAAUM,MAAM;QAChBR,SAASS,qBAAqB;KACjC;IAED;;KAEC,GACDC,uBAAuB;QACnBZ,YAAYa,eAAe;QAC3BZ,SAASa,gBAAgB;QACzBhB,QAAQU,OAAO;QACfL,MAAMM,QAAQ;QACdL,UAAUM,MAAM;QAChBR,SAASa,aAAa;KACzB;IAED;;KAEC,GACDC,0BAA0B;QACtBhB,YAAYO,eAAe;QAC3BP,YAAYa,eAAe;QAC3BZ,SAASgB,aAAa;QACtBnB,QAAQU,OAAO;QACfL,MAAMe,UAAU;QAChBd,UAAUM,MAAM;QAChBX,QAAQoB,YAAY;QACpBjB,SAASa,aAAa;KACzB;AACL,EAAW"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PromptPort } from '../../ports/prompt.port.js';
|
|
2
2
|
/**
|
|
3
3
|
* System prompt adapter that generates a system prompt from a list of strings
|
|
4
4
|
*/
|
|
5
|
-
export declare class SystemPromptAdapter implements
|
|
5
|
+
export declare class SystemPromptAdapter implements PromptPort {
|
|
6
6
|
private readonly finalPrompt;
|
|
7
7
|
constructor(...prompts: readonly (readonly string[] | string)[]);
|
|
8
8
|
generate(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/adapters/prompts/system-prompt.adapter.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/adapters/prompts/system-prompt.adapter.ts"],"sourcesContent":["import type { PromptPort } from '../../ports/prompt.port.js';\n\n/**\n * System prompt adapter that generates a system prompt from a list of strings\n */\nexport class SystemPromptAdapter implements PromptPort {\n private readonly finalPrompt: string;\n\n constructor(...prompts: readonly (readonly string[] | string)[]) {\n const flattenedPrompts = prompts.flat();\n this.finalPrompt = flattenedPrompts.join('\\n\\n');\n }\n\n generate(): string {\n return this.finalPrompt;\n }\n}\n"],"names":["SystemPromptAdapter","prompts","finalPrompt","flattenedPrompts","flat","join","generate"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;CAEC,GACD,OAAO,IAAA,AAAMA,oCAAN;;aAAMA;QAGG,IAAA,IAAA,OAAA,UAAA,QAAA,AAAGC,UAAH,UAAA,OAAA,OAAA,GAAA,OAAA,MAAA;YAAGA,QAAH,QAAA,SAAA,CAAA,KAAmD;;gCAHtDD;QACT,uBAAiBE,eAAjB,KAAA;QAGI,IAAMC,mBAAmBF,QAAQG,IAAI;QACrC,IAAI,CAACF,WAAW,GAAGC,iBAAiBE,IAAI,CAAC;;kBALpCL;;YAQTM,KAAAA;mBAAAA,SAAAA;gBACI,OAAO,IAAI,CAACJ,WAAW;YAC3B;;;WAVSF;IAWZ"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PromptPort } from '../../ports/prompt.port.js';
|
|
2
2
|
/**
|
|
3
3
|
* User prompt adapter that generates a user prompt from a list of strings
|
|
4
4
|
*/
|
|
5
|
-
export declare class UserPromptAdapter implements
|
|
5
|
+
export declare class UserPromptAdapter implements PromptPort {
|
|
6
6
|
private readonly finalPrompt;
|
|
7
7
|
constructor(...prompts: readonly (readonly string[] | string)[]);
|
|
8
8
|
generate(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/adapters/prompts/user-prompt.adapter.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/adapters/prompts/user-prompt.adapter.ts"],"sourcesContent":["import type { PromptPort } from '../../ports/prompt.port.js';\n\n/**\n * User prompt adapter that generates a user prompt from a list of strings\n */\nexport class UserPromptAdapter implements PromptPort {\n private readonly finalPrompt: string;\n\n constructor(...prompts: readonly (readonly string[] | string)[]) {\n const flattenedPrompts = prompts.flat();\n this.finalPrompt = flattenedPrompts.join('\\n\\n');\n }\n\n generate(): string {\n return this.finalPrompt;\n }\n}\n"],"names":["UserPromptAdapter","prompts","finalPrompt","flattenedPrompts","flat","join","generate"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;CAEC,GACD,OAAO,IAAA,AAAMA,kCAAN;;aAAMA;QAGG,IAAA,IAAA,OAAA,UAAA,QAAA,AAAGC,UAAH,UAAA,OAAA,OAAA,GAAA,OAAA,MAAA;YAAGA,QAAH,QAAA,SAAA,CAAA,KAAmD;;gCAHtDD;QACT,uBAAiBE,eAAjB,KAAA;QAGI,IAAMC,mBAAmBF,QAAQG,IAAI;QACrC,IAAI,CAACF,WAAW,GAAGC,iBAAiBE,IAAI,CAAC;;kBALpCL;;YAQTM,KAAAA;mBAAAA,SAAAA;gBACI,OAAO,IAAI,CAACJ,WAAW;YAC3B;;;WAVSF;IAWZ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LoggerPort } from '@jterrazz/logger';
|
|
2
2
|
import { DynamicStructuredTool, DynamicTool } from 'langchain/tools';
|
|
3
3
|
import type { z } from 'zod/v4';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ToolPort } from '../../ports/tool.port.js';
|
|
5
5
|
export interface SafeToolOptions<T> {
|
|
6
6
|
logger?: LoggerPort;
|
|
7
7
|
schema?: z.ZodSchema<T>;
|
|
@@ -15,7 +15,7 @@ export type ToolFunction<T = void> = T extends void ? () => Promise<string> : (a
|
|
|
15
15
|
/**
|
|
16
16
|
* Safe tool adapter that provides error handling and logging for LangChain tools
|
|
17
17
|
*/
|
|
18
|
-
export declare class SafeToolAdapter<T = void> implements
|
|
18
|
+
export declare class SafeToolAdapter<T = void> implements ToolPort {
|
|
19
19
|
private readonly config;
|
|
20
20
|
private readonly options;
|
|
21
21
|
private readonly dynamicTool;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/adapters/tools/safe-tool.adapter.ts"],"sourcesContent":["import type { LoggerPort } from '@jterrazz/logger';\nimport { DynamicStructuredTool, DynamicTool } from 'langchain/tools';\nimport type { z } from 'zod/v4';\n\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../src/adapters/tools/safe-tool.adapter.ts"],"sourcesContent":["import type { LoggerPort } from '@jterrazz/logger';\nimport { DynamicStructuredTool, DynamicTool } from 'langchain/tools';\nimport type { z } from 'zod/v4';\n\nimport type { ToolPort } from '../../ports/tool.port.js';\n\nexport interface SafeToolOptions<T> {\n logger?: LoggerPort;\n schema?: z.ZodSchema<T>;\n}\n\nexport type ToolConfig<T = void> = {\n description: string;\n execute: ToolFunction<T>;\n name: string;\n};\n\nexport type ToolFunction<T = void> = T extends void\n ? () => Promise<string>\n : (args: T) => Promise<string>;\n\n/**\n * Safe tool adapter that provides error handling and logging for LangChain tools\n */\nexport class SafeToolAdapter<T = void> implements ToolPort {\n private readonly dynamicTool: DynamicStructuredTool<z.ZodSchema<T>> | DynamicTool;\n\n constructor(\n private readonly config: ToolConfig<T>,\n private readonly options: SafeToolOptions<T> = {},\n ) {\n const { logger, schema } = options;\n\n if (schema) {\n // Use DynamicStructuredTool for parameterized tools\n this.dynamicTool = new DynamicStructuredTool({\n description: config.description,\n func: async (args: T) => {\n try {\n return await (config.execute as ToolFunction<T>)(args);\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n\n logger?.error(`Unexpected error in ${config.name}`, {\n args,\n error: errorMessage,\n toolName: config.name,\n });\n\n return `Tool ${config.name} failed to execute`;\n }\n },\n name: config.name,\n schema: schema,\n });\n } else {\n // Use DynamicTool for simple tools\n this.dynamicTool = new DynamicTool({\n description: config.description,\n func: async () => {\n try {\n return await (config.execute as ToolFunction<void>)();\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n\n logger?.error(`Unexpected error in ${config.name}`, {\n error: errorMessage,\n toolName: config.name,\n });\n\n return `Tool ${config.name} failed to execute`;\n }\n },\n name: config.name,\n });\n }\n }\n\n /**\n * Get the underlying LangChain DynamicTool instance\n */\n getDynamicTool(): DynamicStructuredTool<z.ZodSchema<unknown>> | DynamicTool {\n return this.dynamicTool as DynamicStructuredTool<z.ZodSchema<unknown>> | DynamicTool;\n }\n}\n"],"names":["DynamicStructuredTool","DynamicTool","SafeToolAdapter","config","options","dynamicTool","logger","schema","description","func","args","error","errorMessage","execute","Error","message","String","name","toolName","getDynamicTool"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,qBAAqB,EAAEC,WAAW,QAAQ,kBAAkB;AAoBrE;;CAEC,GACD,OAAO,IAAA,AAAMC,gCAAN;;aAAMA,gBAIL,AAAiBC,MAAqB;YACtC,AAAiBC,UAAjB,iEAA+C,CAAC;gCAL3CF;;;QACT,uBAAiBG,eAAjB,KAAA;aAGqBF,SAAAA;aACAC,UAAAA;QAEjB,IAAQE,SAAmBF,QAAnBE,QAAQC,SAAWH,QAAXG;QAEhB,IAAIA,QAAQ;YACR,oDAAoD;YACpD,IAAI,CAACF,WAAW,GAAG,IAAIL,sBAAsB;gBACzCQ,aAAaL,OAAOK,WAAW;gBAC/BC,MAAM,SAAOC;;4BAGAC,OACCC;;;;;;;;;;oCAFC;;wCAAOT,OAAOU,OAAO,CAAqBH;;;oCAAjD;;wCAAO;;;oCACFC;oCACCC,eAAeD,AAAK,YAALA,OAAiBG,SAAQH,MAAMI,OAAO,GAAGC,OAAOL;oCAErEL,mBAAAA,6BAAAA,OAAQK,KAAK,CAAC,AAAC,uBAAkC,OAAZR,OAAOc,IAAI,GAAI;wCAChDP,MAAAA;wCACAC,OAAOC;wCACPM,UAAUf,OAAOc,IAAI;oCACzB;oCAEA;;wCAAQ,QAAmB,OAAZd,OAAOc,IAAI,EAAC;;;;;;;;oBAEnC;;gBACAA,MAAMd,OAAOc,IAAI;gBACjBV,QAAQA;YACZ;QACJ,OAAO;YACH,mCAAmC;YACnC,IAAI,CAACF,WAAW,GAAG,IAAIJ,YAAY;gBAC/BO,aAAaL,OAAOK,WAAW;gBAC/BC,MAAM;;4BAGOE,OACCC;;;;;;;;;;oCAFC;;wCAAOT,OAAOU,OAAO;;;oCAA5B;;wCAAO;;;oCACFF;oCACCC,eAAeD,AAAK,YAALA,OAAiBG,SAAQH,MAAMI,OAAO,GAAGC,OAAOL;oCAErEL,mBAAAA,6BAAAA,OAAQK,KAAK,CAAC,AAAC,uBAAkC,OAAZR,OAAOc,IAAI,GAAI;wCAChDN,OAAOC;wCACPM,UAAUf,OAAOc,IAAI;oCACzB;oCAEA;;wCAAQ,QAAmB,OAAZd,OAAOc,IAAI,EAAC;;;;;;;;oBAEnC;;gBACAA,MAAMd,OAAOc,IAAI;YACrB;QACJ;;kBAnDKf;;YAsDT;;KAEC,GACDiB,KAAAA;mBAAAA,SAAAA;gBACI,OAAO,IAAI,CAACd,WAAW;YAC3B;;;WA3DSH;IA4DZ"}
|