@mistralys/persona-builder 2.4.1 → 2.5.1
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 +7 -4
- package/dist/cli.cjs +19 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +19 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +20 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -3
- package/dist/index.d.ts +27 -3
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -73,7 +73,10 @@ function resolveConditionals(text, context) {
|
|
|
73
73
|
|
|
74
74
|
// src/engine/variables.ts
|
|
75
75
|
function resolveVariables(text, context, filename) {
|
|
76
|
-
return text.replace(
|
|
76
|
+
return text.replace(/(\\?)\{\{(\w+)\}\}/g, (match, escape, varName) => {
|
|
77
|
+
if (escape === "\\") {
|
|
78
|
+
return `{{${varName}}}`;
|
|
79
|
+
}
|
|
77
80
|
if (varName in context && context[varName] !== void 0) {
|
|
78
81
|
return String(context[varName]);
|
|
79
82
|
}
|
|
@@ -103,6 +106,10 @@ function serializeTools(tools) {
|
|
|
103
106
|
function serializeToolsList(tools) {
|
|
104
107
|
return tools.map((t) => `'${t}'`).join(", ");
|
|
105
108
|
}
|
|
109
|
+
function serializeToolsBlock(tools) {
|
|
110
|
+
if (tools.length === 0) return " []";
|
|
111
|
+
return "\n" + tools.map((t) => ` - ${t}`).join("\n");
|
|
112
|
+
}
|
|
106
113
|
async function loadPartials(dir) {
|
|
107
114
|
const entries = await promises.readdir(dir, { withFileTypes: true });
|
|
108
115
|
const mdFiles = entries.filter(
|
|
@@ -211,10 +218,10 @@ tools: [{{tools_list}}]
|
|
|
211
218
|
---`;
|
|
212
219
|
var DEFAULT_FRONTMATTER_CLAUDE_CODE = `---
|
|
213
220
|
name: {{cc_file_name_stem}}
|
|
214
|
-
|
|
221
|
+
description: {{description}}
|
|
215
222
|
model: {{cc_model}}
|
|
216
223
|
memory: {{cc_memory}}
|
|
217
|
-
|
|
224
|
+
tools:{{cc_tools_block}}
|
|
218
225
|
---`;
|
|
219
226
|
var DEFAULT_FRONTMATTER_DEEP_AGENTS = `---
|
|
220
227
|
name: {{name}}
|
|
@@ -443,6 +450,12 @@ function buildContext(options) {
|
|
|
443
450
|
if (!("cc_tools_json" in merged)) {
|
|
444
451
|
merged["cc_tools_json"] = serializeTools(ccTools);
|
|
445
452
|
}
|
|
453
|
+
if (!("tools_block" in merged)) {
|
|
454
|
+
merged["tools_block"] = serializeToolsBlock(tools);
|
|
455
|
+
}
|
|
456
|
+
if (!("cc_tools_block" in merged)) {
|
|
457
|
+
merged["cc_tools_block"] = serializeToolsBlock(ccTools);
|
|
458
|
+
}
|
|
446
459
|
if (!("cc_file_name_stem" in merged) && typeof merged["cc_file_name"] === "string") {
|
|
447
460
|
const ccFileName = merged["cc_file_name"];
|
|
448
461
|
merged["cc_file_name_stem"] = ccFileName.replace(/\.md$/, "");
|
|
@@ -459,6 +472,9 @@ function buildContext(options) {
|
|
|
459
472
|
if (!("da_tools_json" in merged)) {
|
|
460
473
|
merged["da_tools_json"] = serializeTools(daTools);
|
|
461
474
|
}
|
|
475
|
+
if (!("da_tools_block" in merged)) {
|
|
476
|
+
merged["da_tools_block"] = serializeToolsBlock(daTools);
|
|
477
|
+
}
|
|
462
478
|
}
|
|
463
479
|
for (const [key, value] of Object.entries(agentMap)) {
|
|
464
480
|
if (!(key in merged)) {
|
|
@@ -718,6 +734,7 @@ exports.runPostRender = runPostRender;
|
|
|
718
734
|
exports.runSuiteInit = runSuiteInit;
|
|
719
735
|
exports.runValidate = runValidate;
|
|
720
736
|
exports.serializeTools = serializeTools;
|
|
737
|
+
exports.serializeToolsBlock = serializeToolsBlock;
|
|
721
738
|
exports.serializeToolsList = serializeToolsList;
|
|
722
739
|
exports.validateFileName = validateFileName;
|
|
723
740
|
exports.validateStrictMarkers = validateStrictMarkers;
|