@jterrazz/intelligence 1.6.1 → 3.0.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 +69 -165
- package/dist/index.cjs +649 -1625
- package/dist/index.d.ts +5 -12
- package/dist/index.js +5 -12
- package/dist/index.js.map +1 -1
- package/dist/middleware/__tests__/logging.middleware.test.js +390 -0
- package/dist/middleware/__tests__/logging.middleware.test.js.map +1 -0
- package/dist/middleware/logging.middleware.d.ts +21 -0
- package/dist/middleware/logging.middleware.js +296 -0
- package/dist/middleware/logging.middleware.js.map +1 -0
- package/dist/parsing/__tests__/create-schema-prompt.test.js +53 -0
- package/dist/parsing/__tests__/create-schema-prompt.test.js.map +1 -0
- package/dist/parsing/__tests__/parse-object.test.d.ts +1 -0
- package/dist/parsing/__tests__/parse-object.test.js +193 -0
- package/dist/parsing/__tests__/parse-object.test.js.map +1 -0
- package/dist/parsing/__tests__/parse-text.test.d.ts +1 -0
- package/dist/parsing/__tests__/parse-text.test.js +159 -0
- package/dist/parsing/__tests__/parse-text.test.js.map +1 -0
- package/dist/parsing/create-schema-prompt.d.ts +28 -0
- package/dist/parsing/create-schema-prompt.js +42 -0
- package/dist/parsing/create-schema-prompt.js.map +1 -0
- package/dist/parsing/parse-object.d.ts +33 -0
- package/dist/parsing/parse-object.js +360 -0
- package/dist/parsing/parse-object.js.map +1 -0
- package/dist/parsing/parse-text.d.ts +14 -0
- package/dist/parsing/parse-text.js +80 -0
- package/dist/parsing/parse-text.js.map +1 -0
- package/dist/providers/openrouter.provider.d.ts +36 -0
- package/dist/providers/openrouter.provider.js +58 -0
- package/dist/providers/openrouter.provider.js.map +1 -0
- package/package.json +15 -14
- package/dist/adapters/agents/autonomous-agent.adapter.d.ts +0 -30
- package/dist/adapters/agents/autonomous-agent.adapter.js +0 -400
- package/dist/adapters/agents/autonomous-agent.adapter.js.map +0 -1
- package/dist/adapters/agents/basic-agent.adapter.d.ts +0 -27
- package/dist/adapters/agents/basic-agent.adapter.js +0 -339
- package/dist/adapters/agents/basic-agent.adapter.js.map +0 -1
- package/dist/adapters/agents/retryable-agent.adapter.d.ts +0 -20
- package/dist/adapters/agents/retryable-agent.adapter.js +0 -263
- package/dist/adapters/agents/retryable-agent.adapter.js.map +0 -1
- package/dist/adapters/models/openrouter-model.adapter.d.ts +0 -38
- package/dist/adapters/models/openrouter-model.adapter.js +0 -89
- package/dist/adapters/models/openrouter-model.adapter.js.map +0 -1
- package/dist/adapters/prompts/__tests__/__snapshots__/presets.test.ts.snap +0 -120
- package/dist/adapters/prompts/__tests__/presets.test.js +0 -31
- package/dist/adapters/prompts/__tests__/presets.test.js.map +0 -1
- package/dist/adapters/prompts/library/categories/domain.d.ts +0 -11
- package/dist/adapters/prompts/library/categories/domain.js +0 -12
- package/dist/adapters/prompts/library/categories/domain.js.map +0 -1
- package/dist/adapters/prompts/library/categories/format.d.ts +0 -10
- package/dist/adapters/prompts/library/categories/format.js +0 -11
- package/dist/adapters/prompts/library/categories/format.js.map +0 -1
- package/dist/adapters/prompts/library/categories/foundations.d.ts +0 -12
- package/dist/adapters/prompts/library/categories/foundations.js +0 -13
- package/dist/adapters/prompts/library/categories/foundations.js.map +0 -1
- package/dist/adapters/prompts/library/categories/language.d.ts +0 -11
- package/dist/adapters/prompts/library/categories/language.js +0 -12
- package/dist/adapters/prompts/library/categories/language.js.map +0 -1
- package/dist/adapters/prompts/library/categories/persona.d.ts +0 -13
- package/dist/adapters/prompts/library/categories/persona.js +0 -14
- package/dist/adapters/prompts/library/categories/persona.js.map +0 -1
- package/dist/adapters/prompts/library/categories/response.d.ts +0 -9
- package/dist/adapters/prompts/library/categories/response.js +0 -10
- package/dist/adapters/prompts/library/categories/response.js.map +0 -1
- package/dist/adapters/prompts/library/categories/tone.d.ts +0 -9
- package/dist/adapters/prompts/library/categories/tone.js +0 -10
- package/dist/adapters/prompts/library/categories/tone.js.map +0 -1
- package/dist/adapters/prompts/library/categories/verbosity.d.ts +0 -8
- package/dist/adapters/prompts/library/categories/verbosity.js +0 -9
- package/dist/adapters/prompts/library/categories/verbosity.js.map +0 -1
- package/dist/adapters/prompts/library/index.d.ts +0 -68
- package/dist/adapters/prompts/library/index.js +0 -26
- package/dist/adapters/prompts/library/index.js.map +0 -1
- package/dist/adapters/prompts/library/presets.d.ts +0 -17
- package/dist/adapters/prompts/library/presets.js +0 -45
- package/dist/adapters/prompts/library/presets.js.map +0 -1
- package/dist/adapters/prompts/system-prompt.adapter.d.ts +0 -9
- package/dist/adapters/prompts/system-prompt.adapter.js +0 -57
- package/dist/adapters/prompts/system-prompt.adapter.js.map +0 -1
- package/dist/adapters/prompts/user-prompt.adapter.d.ts +0 -9
- package/dist/adapters/prompts/user-prompt.adapter.js +0 -57
- package/dist/adapters/prompts/user-prompt.adapter.js.map +0 -1
- package/dist/adapters/tools/safe-tool.adapter.d.ts +0 -27
- package/dist/adapters/tools/safe-tool.adapter.js +0 -283
- package/dist/adapters/tools/safe-tool.adapter.js.map +0 -1
- package/dist/adapters/utils/__tests__/ai-response-parser.test.js +0 -289
- package/dist/adapters/utils/__tests__/ai-response-parser.test.js.map +0 -1
- package/dist/adapters/utils/ai-response-parser-error.d.ts +0 -8
- package/dist/adapters/utils/ai-response-parser-error.js +0 -136
- package/dist/adapters/utils/ai-response-parser-error.js.map +0 -1
- package/dist/adapters/utils/ai-response-parser.d.ts +0 -60
- package/dist/adapters/utils/ai-response-parser.js +0 -347
- package/dist/adapters/utils/ai-response-parser.js.map +0 -1
- package/dist/ports/agent.port.d.ts +0 -17
- package/dist/ports/agent.port.js +0 -7
- package/dist/ports/agent.port.js.map +0 -1
- package/dist/ports/model.port.d.ts +0 -10
- package/dist/ports/model.port.js +0 -5
- package/dist/ports/model.port.js.map +0 -1
- package/dist/ports/prompt.port.d.ts +0 -9
- package/dist/ports/prompt.port.js +0 -5
- package/dist/ports/prompt.port.js.map +0 -1
- package/dist/ports/tool.port.d.ts +0 -11
- package/dist/ports/tool.port.js +0 -5
- package/dist/ports/tool.port.js.map +0 -1
- /package/dist/{adapters/prompts/__tests__/presets.test.d.ts → middleware/__tests__/logging.middleware.test.d.ts} +0 -0
- /package/dist/{adapters/utils/__tests__/ai-response-parser.test.d.ts → parsing/__tests__/create-schema-prompt.test.d.ts} +0 -0
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Re-exports for the prompt library.
|
|
3
|
-
* This file serves as the public API for the prompt library,
|
|
4
|
-
* making it easy to import all categories from a single location.
|
|
5
|
-
*/
|
|
6
|
-
export declare const PROMPT_LIBRARY: {
|
|
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 CONTEXTUAL_ONLY: "\n<Foundation>\nYou MUST ONLY use the information provided in the context to answer questions.\nYou MUST NOT use any other information, including your own knowledge, to answer questions.\n</Foundation>";
|
|
23
|
-
readonly CONTEXTUAL_REASONING: "\n<Foundation>\nYou MUST synthesize information from the provided context, tools, and conversation history to form well-reasoned conclusions.\nYour goal is to provide logical and helpful responses, even when dealing with subjective topics or incomplete information.\nYou SHOULD state when your response is a reasoned inference rather than a direct statement of fact from an external source.\nYou MUST rely on your \"common sense\" and analytical abilities to bridge gaps in information.\n</Foundation>";
|
|
24
|
-
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>";
|
|
25
|
-
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>";
|
|
26
|
-
readonly FIRST_PRINCIPLES_THINKING: "\n<Foundation>\nYou MUST break down complex problems into their fundamental, indivisible truths (first principles).\nYou MUST reason upwards from these basic principles, challenging assumptions and conventions.\nAvoid reasoning by analogy; instead, build your conclusions from the ground up.\n</Foundation>";
|
|
27
|
-
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>";
|
|
28
|
-
};
|
|
29
|
-
readonly LANGUAGES: {
|
|
30
|
-
readonly ENGLISH_NATIVE: "\n<Language>\nYou MUST write your entire output in natural, fluent English. This is a strict requirement; do not use any other language.\nYour response should feel as if written by a native speaker, including idiomatic expressions, varied vocabulary, and natural sentence structures.\n</Language>";
|
|
31
|
-
readonly ENGLISH_SIMPLE: "\n<Language>\nYou MUST write your entire output in simple, clear English. This is a strict requirement; do not use any other language.\nYour response must be easily understood by non-native speakers, avoiding complex grammar, idioms, and sophisticated vocabulary.\n</Language>";
|
|
32
|
-
readonly FRENCH_NATIVE: "\n<Language>\nVous DEVEZ IMPÉRATIVEMENT rédiger toute votre sortie en français naturel et fluide. C'est une exigence stricte ; n'utilisez aucune autre langue.\nVotre réponse doit donner l'impression d'avoir été écrite par un locuteur natif, en incluant des expressions idiomatiques et un vocabulaire varié.\n</Language>";
|
|
33
|
-
readonly FRENCH_SIMPLE: "\n<Language>\nVous DEVEZ IMPÉRATIVEMENT rédiger toute votre sortie en français simple et clair. C'est une exigence stricte ; n'utilisez aucune autre langue.\nVotre réponse doit être facile à comprendre pour des non-natifs, en évitant la grammaire complexe et le vocabulaire sophistiqué.\n</Language>";
|
|
34
|
-
readonly SPANISH_NATIVE: "\n<Language>\nDEBES OBLIGATORIAMENTE escribir todo tu resultado en un español natural y fluido. Este es un requisito estricto; no utilices ningún otro idioma.\nTu respuesta debe parecer escrita por un hablante nativo, incluyendo expresiones idiomáticas y un vocabulario variado.\n</Language>";
|
|
35
|
-
readonly SPANISH_SIMPLE: "\n<Language>\nDEBES OBLIGATORIAMENTE escribir todo tu resultado en un español simple y claro. Este es un requisito estricto; no utilices ningún otro idioma.\nTu respuesta debe ser fácil de entender para hablantes no nativos, evitando gramática compleja y vocabulario sofisticado.\n</Language>";
|
|
36
|
-
};
|
|
37
|
-
readonly PERSONAS: {
|
|
38
|
-
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>";
|
|
39
|
-
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>";
|
|
40
|
-
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>";
|
|
41
|
-
readonly HUMAN_LIKE_CONTRIBUTOR: "\n<Persona>\nYou are a Human-Like Contributor, a thoughtful and engaging participant in a group chat.\nYour purpose is to interact in a way that is indistinguishable from a human, fostering natural and coherent conversations.\n**Key Skills**: You excel at maintaining conversational context, ensuring your contributions are a logical continuation of past interactions. You avoid repetition and can proactively initiate new topics when appropriate. Your style is natural, personal, and adaptive.\n</Persona>";
|
|
42
|
-
readonly JOURNALIST: "\n<Persona>\nYou are a Journalist, a skilled writer who crafts engaging, informative, and well-structured articles.\nYour purpose is to provide users with valuable, well-researched, and well-written content.\n**Key Skills**: You excel at writing clear, concise, and engaging articles. You are skilled at researching and gathering information, and you are able to write in a way that is both informative and entertaining.\n</Persona>";
|
|
43
|
-
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>";
|
|
44
|
-
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>";
|
|
45
|
-
};
|
|
46
|
-
readonly PRESETS: {
|
|
47
|
-
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>"];
|
|
48
|
-
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>"];
|
|
49
|
-
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>"];
|
|
50
|
-
};
|
|
51
|
-
readonly RESPONSES: {
|
|
52
|
-
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>";
|
|
53
|
-
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>";
|
|
54
|
-
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>";
|
|
55
|
-
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>";
|
|
56
|
-
};
|
|
57
|
-
readonly TONES: {
|
|
58
|
-
readonly EMPATHETIC: "\n<Tone>\nYou must adopt a warm, understanding, and supportive tone. Acknowledge the user's feelings and demonstrate active listening.\n</Tone>";
|
|
59
|
-
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>";
|
|
60
|
-
readonly NEUTRAL: "\n<Tone>\nYou must maintain an impartial, objective, and straightforward tone. Avoid all emotional language and stick to the facts.\n</Tone>";
|
|
61
|
-
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>";
|
|
62
|
-
};
|
|
63
|
-
readonly VERBOSITY: {
|
|
64
|
-
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>";
|
|
65
|
-
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>";
|
|
66
|
-
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>";
|
|
67
|
-
};
|
|
68
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Re-exports for the prompt library.
|
|
3
|
-
* This file serves as the public API for the prompt library,
|
|
4
|
-
* making it easy to import all categories from a single location.
|
|
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 { RESPONSES } from './categories/response.js';
|
|
11
|
-
import { TONES } from './categories/tone.js';
|
|
12
|
-
import { VERBOSITY } from './categories/verbosity.js';
|
|
13
|
-
import { PRESETS } from './presets.js';
|
|
14
|
-
export var PROMPT_LIBRARY = {
|
|
15
|
-
DOMAINS: DOMAINS,
|
|
16
|
-
FORMATS: FORMATS,
|
|
17
|
-
FOUNDATIONS: FOUNDATIONS,
|
|
18
|
-
LANGUAGES: LANGUAGES,
|
|
19
|
-
PERSONAS: PERSONAS,
|
|
20
|
-
PRESETS: PRESETS,
|
|
21
|
-
RESPONSES: RESPONSES,
|
|
22
|
-
TONES: TONES,
|
|
23
|
-
VERBOSITY: VERBOSITY
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 { RESPONSES } 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 PROMPT_LIBRARY = {\n DOMAINS,\n FORMATS,\n FOUNDATIONS,\n LANGUAGES,\n PERSONAS,\n PRESETS,\n RESPONSES,\n TONES,\n VERBOSITY,\n} as const;\n"],"names":["DOMAINS","FORMATS","FOUNDATIONS","LANGUAGES","PERSONAS","RESPONSES","TONES","VERBOSITY","PRESETS","PROMPT_LIBRARY"],"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,SAAS,QAAQ,2BAA2B;AACrD,SAASC,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,SAAS,QAAQ,4BAA4B;AAEtD,SAASC,OAAO,QAAQ,eAAe;AAEvC,OAAO,IAAMC,iBAAiB;IAC1BT,SAAAA;IACAC,SAAAA;IACAC,aAAAA;IACAC,WAAAA;IACAC,UAAAA;IACAI,SAAAA;IACAH,WAAAA;IACAC,OAAAA;IACAC,WAAAA;AACJ,EAAW"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Provides ready-to-use combinations of prompt parts for common use cases.
|
|
3
|
-
*/
|
|
4
|
-
export declare const PRESETS: {
|
|
5
|
-
/**
|
|
6
|
-
* A fun and engaging community animator for platforms like Discord.
|
|
7
|
-
*/
|
|
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
|
-
/**
|
|
10
|
-
* A creative partner for brainstorming and ideation.
|
|
11
|
-
*/
|
|
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
|
-
/**
|
|
14
|
-
* A friendly and empathetic support agent for general queries.
|
|
15
|
-
*/
|
|
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
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
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 { RESPONSES } from './categories/response.js';
|
|
6
|
-
import { TONES } from './categories/tone.js';
|
|
7
|
-
import { VERBOSITY } from './categories/verbosity.js';
|
|
8
|
-
/**
|
|
9
|
-
* Provides ready-to-use combinations of prompt parts for common use cases.
|
|
10
|
-
*/ export var PRESETS = {
|
|
11
|
-
/**
|
|
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,
|
|
18
|
-
VERBOSITY.NORMAL,
|
|
19
|
-
RESPONSES.CONTEXTUAL_ENGAGEMENT
|
|
20
|
-
],
|
|
21
|
-
/**
|
|
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,
|
|
28
|
-
VERBOSITY.NORMAL,
|
|
29
|
-
RESPONSES.ALWAYS_ENGAGE
|
|
30
|
-
],
|
|
31
|
-
/**
|
|
32
|
-
* A friendly and empathetic support agent for general queries.
|
|
33
|
-
*/ EMPATHETIC_SUPPORT_AGENT: [
|
|
34
|
-
FOUNDATIONS.HARM_PREVENTION,
|
|
35
|
-
FOUNDATIONS.ETHICAL_CONDUCT,
|
|
36
|
-
PERSONAS.SUPPORT_AGENT,
|
|
37
|
-
DOMAINS.GENERAL,
|
|
38
|
-
TONES.EMPATHETIC,
|
|
39
|
-
VERBOSITY.NORMAL,
|
|
40
|
-
FORMATS.STEP_BY_STEP,
|
|
41
|
-
RESPONSES.ALWAYS_ENGAGE
|
|
42
|
-
]
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
//# sourceMappingURL=presets.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 { RESPONSES } 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 RESPONSES.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 RESPONSES.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 RESPONSES.ALWAYS_ENGAGE,\n ],\n} as const;\n"],"names":["DOMAINS","FORMATS","FOUNDATIONS","PERSONAS","RESPONSES","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,SAAS,QAAQ,2BAA2B;AACrD,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,UAAUS,qBAAqB;KAClC;IAED;;KAEC,GACDC,uBAAuB;QACnBZ,YAAYa,eAAe;QAC3BZ,SAASa,gBAAgB;QACzBhB,QAAQU,OAAO;QACfL,MAAMM,QAAQ;QACdL,UAAUM,MAAM;QAChBR,UAAUa,aAAa;KAC1B;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,UAAUa,aAAa;KAC1B;AACL,EAAW"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { PromptPort } from '../../ports/prompt.port.js';
|
|
2
|
-
/**
|
|
3
|
-
* System prompt adapter that generates a system prompt from a list of strings
|
|
4
|
-
*/
|
|
5
|
-
export declare class SystemPromptAdapter implements PromptPort {
|
|
6
|
-
private readonly finalPrompt;
|
|
7
|
-
constructor(...prompts: readonly (readonly string[] | string)[]);
|
|
8
|
-
generate(): string;
|
|
9
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
function _class_call_check(instance, Constructor) {
|
|
2
|
-
if (!(instance instanceof Constructor)) {
|
|
3
|
-
throw new TypeError("Cannot call a class as a function");
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
function _defineProperties(target, props) {
|
|
7
|
-
for(var i = 0; i < props.length; i++){
|
|
8
|
-
var descriptor = props[i];
|
|
9
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
-
descriptor.configurable = true;
|
|
11
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
12
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
16
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
|
-
return Constructor;
|
|
19
|
-
}
|
|
20
|
-
function _define_property(obj, key, value) {
|
|
21
|
-
if (key in obj) {
|
|
22
|
-
Object.defineProperty(obj, key, {
|
|
23
|
-
value: value,
|
|
24
|
-
enumerable: true,
|
|
25
|
-
configurable: true,
|
|
26
|
-
writable: true
|
|
27
|
-
});
|
|
28
|
-
} else {
|
|
29
|
-
obj[key] = value;
|
|
30
|
-
}
|
|
31
|
-
return obj;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* System prompt adapter that generates a system prompt from a list of strings
|
|
35
|
-
*/ export var SystemPromptAdapter = /*#__PURE__*/ function() {
|
|
36
|
-
"use strict";
|
|
37
|
-
function SystemPromptAdapter() {
|
|
38
|
-
for(var _len = arguments.length, prompts = new Array(_len), _key = 0; _key < _len; _key++){
|
|
39
|
-
prompts[_key] = arguments[_key];
|
|
40
|
-
}
|
|
41
|
-
_class_call_check(this, SystemPromptAdapter);
|
|
42
|
-
_define_property(this, "finalPrompt", void 0);
|
|
43
|
-
var flattenedPrompts = prompts.flat();
|
|
44
|
-
this.finalPrompt = flattenedPrompts.join('\n\n');
|
|
45
|
-
}
|
|
46
|
-
_create_class(SystemPromptAdapter, [
|
|
47
|
-
{
|
|
48
|
-
key: "generate",
|
|
49
|
-
value: function generate() {
|
|
50
|
-
return this.finalPrompt;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
]);
|
|
54
|
-
return SystemPromptAdapter;
|
|
55
|
-
}();
|
|
56
|
-
|
|
57
|
-
//# sourceMappingURL=system-prompt.adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,9 +0,0 @@
|
|
|
1
|
-
import type { PromptPort } from '../../ports/prompt.port.js';
|
|
2
|
-
/**
|
|
3
|
-
* User prompt adapter that generates a user prompt from a list of strings
|
|
4
|
-
*/
|
|
5
|
-
export declare class UserPromptAdapter implements PromptPort {
|
|
6
|
-
private readonly finalPrompt;
|
|
7
|
-
constructor(...prompts: readonly (readonly string[] | string)[]);
|
|
8
|
-
generate(): string;
|
|
9
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
function _class_call_check(instance, Constructor) {
|
|
2
|
-
if (!(instance instanceof Constructor)) {
|
|
3
|
-
throw new TypeError("Cannot call a class as a function");
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
function _defineProperties(target, props) {
|
|
7
|
-
for(var i = 0; i < props.length; i++){
|
|
8
|
-
var descriptor = props[i];
|
|
9
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
-
descriptor.configurable = true;
|
|
11
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
12
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
16
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
|
-
return Constructor;
|
|
19
|
-
}
|
|
20
|
-
function _define_property(obj, key, value) {
|
|
21
|
-
if (key in obj) {
|
|
22
|
-
Object.defineProperty(obj, key, {
|
|
23
|
-
value: value,
|
|
24
|
-
enumerable: true,
|
|
25
|
-
configurable: true,
|
|
26
|
-
writable: true
|
|
27
|
-
});
|
|
28
|
-
} else {
|
|
29
|
-
obj[key] = value;
|
|
30
|
-
}
|
|
31
|
-
return obj;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* User prompt adapter that generates a user prompt from a list of strings
|
|
35
|
-
*/ export var UserPromptAdapter = /*#__PURE__*/ function() {
|
|
36
|
-
"use strict";
|
|
37
|
-
function UserPromptAdapter() {
|
|
38
|
-
for(var _len = arguments.length, prompts = new Array(_len), _key = 0; _key < _len; _key++){
|
|
39
|
-
prompts[_key] = arguments[_key];
|
|
40
|
-
}
|
|
41
|
-
_class_call_check(this, UserPromptAdapter);
|
|
42
|
-
_define_property(this, "finalPrompt", void 0);
|
|
43
|
-
var flattenedPrompts = prompts.flat();
|
|
44
|
-
this.finalPrompt = flattenedPrompts.join('\n\n');
|
|
45
|
-
}
|
|
46
|
-
_create_class(UserPromptAdapter, [
|
|
47
|
-
{
|
|
48
|
-
key: "generate",
|
|
49
|
-
value: function generate() {
|
|
50
|
-
return this.finalPrompt;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
]);
|
|
54
|
-
return UserPromptAdapter;
|
|
55
|
-
}();
|
|
56
|
-
|
|
57
|
-
//# sourceMappingURL=user-prompt.adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,27 +0,0 @@
|
|
|
1
|
-
import type { LoggerPort } from '@jterrazz/logger';
|
|
2
|
-
import { DynamicStructuredTool, DynamicTool } from 'langchain/tools';
|
|
3
|
-
import type { z } from 'zod/v4';
|
|
4
|
-
import type { ToolPort } from '../../ports/tool.port.js';
|
|
5
|
-
export interface SafeToolOptions<T> {
|
|
6
|
-
logger?: LoggerPort;
|
|
7
|
-
schema?: z.ZodSchema<T>;
|
|
8
|
-
}
|
|
9
|
-
export type ToolConfig<T = void> = {
|
|
10
|
-
description: string;
|
|
11
|
-
execute: ToolFunction<T>;
|
|
12
|
-
name: string;
|
|
13
|
-
};
|
|
14
|
-
export type ToolFunction<T = void> = T extends void ? () => Promise<string> : (args: T) => Promise<string>;
|
|
15
|
-
/**
|
|
16
|
-
* Safe tool adapter that provides error handling and logging for LangChain tools
|
|
17
|
-
*/
|
|
18
|
-
export declare class SafeToolAdapter<T = void> implements ToolPort {
|
|
19
|
-
private readonly config;
|
|
20
|
-
private readonly options;
|
|
21
|
-
private readonly dynamicTool;
|
|
22
|
-
constructor(config: ToolConfig<T>, options?: SafeToolOptions<T>);
|
|
23
|
-
/**
|
|
24
|
-
* Get the underlying LangChain DynamicTool instance
|
|
25
|
-
*/
|
|
26
|
-
getDynamicTool(): DynamicStructuredTool<z.ZodSchema<unknown>> | DynamicTool;
|
|
27
|
-
}
|