@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.d.cts
CHANGED
|
@@ -86,7 +86,7 @@ declare function resolveConditionals(text: string, context: Record<string, unkno
|
|
|
86
86
|
* variables.ts
|
|
87
87
|
*
|
|
88
88
|
* Pure template-engine function for resolving variable substitutions.
|
|
89
|
-
* Handles {{varName}} syntax. No file-system I/O.
|
|
89
|
+
* Handles {{varName}} substitution and \{{varName}} escape syntax. No file-system I/O.
|
|
90
90
|
*/
|
|
91
91
|
/**
|
|
92
92
|
* Resolve variable substitutions in a template string.
|
|
@@ -96,6 +96,10 @@ declare function resolveConditionals(text: string, context: Record<string, unkno
|
|
|
96
96
|
* the original marker is preserved and a warning is emitted via
|
|
97
97
|
* `console.warn`, identifying the file by `filename` for easier debugging.
|
|
98
98
|
*
|
|
99
|
+
* **Escape syntax:** prefix a marker with a backslash (`\{{varName}}`) to
|
|
100
|
+
* emit the literal `{{varName}}` text in the output without performing any
|
|
101
|
+
* lookup or triggering an unresolved-variable warning.
|
|
102
|
+
*
|
|
99
103
|
* Note: this step must run AFTER `resolvePartials` and `resolveConditionals`
|
|
100
104
|
* so that only plain variable markers remain.
|
|
101
105
|
*
|
|
@@ -179,6 +183,26 @@ declare function serializeTools(tools: string[]): string;
|
|
|
179
183
|
* serializeToolsList([]) // => ""
|
|
180
184
|
*/
|
|
181
185
|
declare function serializeToolsList(tools: string[]): string;
|
|
186
|
+
/**
|
|
187
|
+
* Serialize a tools array as a YAML block sequence.
|
|
188
|
+
*
|
|
189
|
+
* Output format (non-empty):
|
|
190
|
+
* `\n - tool1\n - tool2`
|
|
191
|
+
*
|
|
192
|
+
* Output format (empty):
|
|
193
|
+
* ` []`
|
|
194
|
+
*
|
|
195
|
+
* Designed for use in frontmatter templates as `tools:{{tools_block}}`
|
|
196
|
+
* (no space between the colon and the variable).
|
|
197
|
+
*
|
|
198
|
+
* @param tools - Array of tool name strings
|
|
199
|
+
* @returns YAML block sequence string (includes leading newline for non-empty arrays)
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* serializeToolsBlock(['Bash', 'Read']) // => "\n - Bash\n - Read"
|
|
203
|
+
* serializeToolsBlock([]) // => " []"
|
|
204
|
+
*/
|
|
205
|
+
declare function serializeToolsBlock(tools: string[]): string;
|
|
182
206
|
|
|
183
207
|
/**
|
|
184
208
|
* src/loaders/partials-loader.ts
|
|
@@ -748,7 +772,7 @@ declare const DEFAULT_FRONTMATTER_VSCODE = "---\nname: '{{name}} v{{version}}'\n
|
|
|
748
772
|
* Minimal fields that work for standalone personas. Projects using numbered
|
|
749
773
|
* workflows should inject a richer template via a plugin.
|
|
750
774
|
*/
|
|
751
|
-
declare const DEFAULT_FRONTMATTER_CLAUDE_CODE = "---\nname: {{cc_file_name_stem}}\
|
|
775
|
+
declare const DEFAULT_FRONTMATTER_CLAUDE_CODE = "---\nname: {{cc_file_name_stem}}\ndescription: {{description}}\nmodel: {{cc_model}}\nmemory: {{cc_memory}}\ntools:{{cc_tools_block}}\n---";
|
|
752
776
|
/**
|
|
753
777
|
* Default Deep Agents frontmatter template.
|
|
754
778
|
*
|
|
@@ -1316,4 +1340,4 @@ declare const defaultRegistry: TargetRegistry;
|
|
|
1316
1340
|
|
|
1317
1341
|
declare const VERSION: string;
|
|
1318
1342
|
|
|
1319
|
-
export { type BuildConfig, type BuildResult, type BuildSummary, DEFAULT_FRONTMATTER_CLAUDE_CODE, DEFAULT_FRONTMATTER_DEEP_AGENTS, DEFAULT_FRONTMATTER_VSCODE, type PersonaBuildPlugin, type PersonaMetadata, type SuiteConfig, TARGET_CLAUDE_CODE, TARGET_DEEP_AGENTS, TARGET_VSCODE, type TargetDefinition, TargetRegistry, type TargetType, VERSION, type ValidationResult, build, buildPersona, buildSuite, collapseBlankLines, defaultRegistry, discoverPersonaYamls, ensureBlankLineBeforeHeadings, escapeRegExp, loadContent, loadMetadata, loadPartials, normalizeNewlines, renderFrontmatter, resolveConditionals, resolveFrontmatterTemplate, resolvePartials, resolveVariables, runBuildContext, runPartials, runPersonaPartials, runPostRender, runSuiteInit, runValidate, serializeTools, serializeToolsList, validateFileName, validateStrictMarkers };
|
|
1343
|
+
export { type BuildConfig, type BuildResult, type BuildSummary, DEFAULT_FRONTMATTER_CLAUDE_CODE, DEFAULT_FRONTMATTER_DEEP_AGENTS, DEFAULT_FRONTMATTER_VSCODE, type PersonaBuildPlugin, type PersonaMetadata, type SuiteConfig, TARGET_CLAUDE_CODE, TARGET_DEEP_AGENTS, TARGET_VSCODE, type TargetDefinition, TargetRegistry, type TargetType, VERSION, type ValidationResult, build, buildPersona, buildSuite, collapseBlankLines, defaultRegistry, discoverPersonaYamls, ensureBlankLineBeforeHeadings, escapeRegExp, loadContent, loadMetadata, loadPartials, normalizeNewlines, renderFrontmatter, resolveConditionals, resolveFrontmatterTemplate, resolvePartials, resolveVariables, runBuildContext, runPartials, runPersonaPartials, runPostRender, runSuiteInit, runValidate, serializeTools, serializeToolsBlock, serializeToolsList, validateFileName, validateStrictMarkers };
|
package/dist/index.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ declare function resolveConditionals(text: string, context: Record<string, unkno
|
|
|
86
86
|
* variables.ts
|
|
87
87
|
*
|
|
88
88
|
* Pure template-engine function for resolving variable substitutions.
|
|
89
|
-
* Handles {{varName}} syntax. No file-system I/O.
|
|
89
|
+
* Handles {{varName}} substitution and \{{varName}} escape syntax. No file-system I/O.
|
|
90
90
|
*/
|
|
91
91
|
/**
|
|
92
92
|
* Resolve variable substitutions in a template string.
|
|
@@ -96,6 +96,10 @@ declare function resolveConditionals(text: string, context: Record<string, unkno
|
|
|
96
96
|
* the original marker is preserved and a warning is emitted via
|
|
97
97
|
* `console.warn`, identifying the file by `filename` for easier debugging.
|
|
98
98
|
*
|
|
99
|
+
* **Escape syntax:** prefix a marker with a backslash (`\{{varName}}`) to
|
|
100
|
+
* emit the literal `{{varName}}` text in the output without performing any
|
|
101
|
+
* lookup or triggering an unresolved-variable warning.
|
|
102
|
+
*
|
|
99
103
|
* Note: this step must run AFTER `resolvePartials` and `resolveConditionals`
|
|
100
104
|
* so that only plain variable markers remain.
|
|
101
105
|
*
|
|
@@ -179,6 +183,26 @@ declare function serializeTools(tools: string[]): string;
|
|
|
179
183
|
* serializeToolsList([]) // => ""
|
|
180
184
|
*/
|
|
181
185
|
declare function serializeToolsList(tools: string[]): string;
|
|
186
|
+
/**
|
|
187
|
+
* Serialize a tools array as a YAML block sequence.
|
|
188
|
+
*
|
|
189
|
+
* Output format (non-empty):
|
|
190
|
+
* `\n - tool1\n - tool2`
|
|
191
|
+
*
|
|
192
|
+
* Output format (empty):
|
|
193
|
+
* ` []`
|
|
194
|
+
*
|
|
195
|
+
* Designed for use in frontmatter templates as `tools:{{tools_block}}`
|
|
196
|
+
* (no space between the colon and the variable).
|
|
197
|
+
*
|
|
198
|
+
* @param tools - Array of tool name strings
|
|
199
|
+
* @returns YAML block sequence string (includes leading newline for non-empty arrays)
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* serializeToolsBlock(['Bash', 'Read']) // => "\n - Bash\n - Read"
|
|
203
|
+
* serializeToolsBlock([]) // => " []"
|
|
204
|
+
*/
|
|
205
|
+
declare function serializeToolsBlock(tools: string[]): string;
|
|
182
206
|
|
|
183
207
|
/**
|
|
184
208
|
* src/loaders/partials-loader.ts
|
|
@@ -748,7 +772,7 @@ declare const DEFAULT_FRONTMATTER_VSCODE = "---\nname: '{{name}} v{{version}}'\n
|
|
|
748
772
|
* Minimal fields that work for standalone personas. Projects using numbered
|
|
749
773
|
* workflows should inject a richer template via a plugin.
|
|
750
774
|
*/
|
|
751
|
-
declare const DEFAULT_FRONTMATTER_CLAUDE_CODE = "---\nname: {{cc_file_name_stem}}\
|
|
775
|
+
declare const DEFAULT_FRONTMATTER_CLAUDE_CODE = "---\nname: {{cc_file_name_stem}}\ndescription: {{description}}\nmodel: {{cc_model}}\nmemory: {{cc_memory}}\ntools:{{cc_tools_block}}\n---";
|
|
752
776
|
/**
|
|
753
777
|
* Default Deep Agents frontmatter template.
|
|
754
778
|
*
|
|
@@ -1316,4 +1340,4 @@ declare const defaultRegistry: TargetRegistry;
|
|
|
1316
1340
|
|
|
1317
1341
|
declare const VERSION: string;
|
|
1318
1342
|
|
|
1319
|
-
export { type BuildConfig, type BuildResult, type BuildSummary, DEFAULT_FRONTMATTER_CLAUDE_CODE, DEFAULT_FRONTMATTER_DEEP_AGENTS, DEFAULT_FRONTMATTER_VSCODE, type PersonaBuildPlugin, type PersonaMetadata, type SuiteConfig, TARGET_CLAUDE_CODE, TARGET_DEEP_AGENTS, TARGET_VSCODE, type TargetDefinition, TargetRegistry, type TargetType, VERSION, type ValidationResult, build, buildPersona, buildSuite, collapseBlankLines, defaultRegistry, discoverPersonaYamls, ensureBlankLineBeforeHeadings, escapeRegExp, loadContent, loadMetadata, loadPartials, normalizeNewlines, renderFrontmatter, resolveConditionals, resolveFrontmatterTemplate, resolvePartials, resolveVariables, runBuildContext, runPartials, runPersonaPartials, runPostRender, runSuiteInit, runValidate, serializeTools, serializeToolsList, validateFileName, validateStrictMarkers };
|
|
1343
|
+
export { type BuildConfig, type BuildResult, type BuildSummary, DEFAULT_FRONTMATTER_CLAUDE_CODE, DEFAULT_FRONTMATTER_DEEP_AGENTS, DEFAULT_FRONTMATTER_VSCODE, type PersonaBuildPlugin, type PersonaMetadata, type SuiteConfig, TARGET_CLAUDE_CODE, TARGET_DEEP_AGENTS, TARGET_VSCODE, type TargetDefinition, TargetRegistry, type TargetType, VERSION, type ValidationResult, build, buildPersona, buildSuite, collapseBlankLines, defaultRegistry, discoverPersonaYamls, ensureBlankLineBeforeHeadings, escapeRegExp, loadContent, loadMetadata, loadPartials, normalizeNewlines, renderFrontmatter, resolveConditionals, resolveFrontmatterTemplate, resolvePartials, resolveVariables, runBuildContext, runPartials, runPersonaPartials, runPostRender, runSuiteInit, runValidate, serializeTools, serializeToolsBlock, serializeToolsList, validateFileName, validateStrictMarkers };
|
package/dist/index.js
CHANGED
|
@@ -65,7 +65,10 @@ function resolveConditionals(text, context) {
|
|
|
65
65
|
|
|
66
66
|
// src/engine/variables.ts
|
|
67
67
|
function resolveVariables(text, context, filename) {
|
|
68
|
-
return text.replace(
|
|
68
|
+
return text.replace(/(\\?)\{\{(\w+)\}\}/g, (match, escape, varName) => {
|
|
69
|
+
if (escape === "\\") {
|
|
70
|
+
return `{{${varName}}}`;
|
|
71
|
+
}
|
|
69
72
|
if (varName in context && context[varName] !== void 0) {
|
|
70
73
|
return String(context[varName]);
|
|
71
74
|
}
|
|
@@ -95,6 +98,10 @@ function serializeTools(tools) {
|
|
|
95
98
|
function serializeToolsList(tools) {
|
|
96
99
|
return tools.map((t) => `'${t}'`).join(", ");
|
|
97
100
|
}
|
|
101
|
+
function serializeToolsBlock(tools) {
|
|
102
|
+
if (tools.length === 0) return " []";
|
|
103
|
+
return "\n" + tools.map((t) => ` - ${t}`).join("\n");
|
|
104
|
+
}
|
|
98
105
|
async function loadPartials(dir) {
|
|
99
106
|
const entries = await readdir(dir, { withFileTypes: true });
|
|
100
107
|
const mdFiles = entries.filter(
|
|
@@ -203,10 +210,10 @@ tools: [{{tools_list}}]
|
|
|
203
210
|
---`;
|
|
204
211
|
var DEFAULT_FRONTMATTER_CLAUDE_CODE = `---
|
|
205
212
|
name: {{cc_file_name_stem}}
|
|
206
|
-
|
|
213
|
+
description: {{description}}
|
|
207
214
|
model: {{cc_model}}
|
|
208
215
|
memory: {{cc_memory}}
|
|
209
|
-
|
|
216
|
+
tools:{{cc_tools_block}}
|
|
210
217
|
---`;
|
|
211
218
|
var DEFAULT_FRONTMATTER_DEEP_AGENTS = `---
|
|
212
219
|
name: {{name}}
|
|
@@ -435,6 +442,12 @@ function buildContext(options) {
|
|
|
435
442
|
if (!("cc_tools_json" in merged)) {
|
|
436
443
|
merged["cc_tools_json"] = serializeTools(ccTools);
|
|
437
444
|
}
|
|
445
|
+
if (!("tools_block" in merged)) {
|
|
446
|
+
merged["tools_block"] = serializeToolsBlock(tools);
|
|
447
|
+
}
|
|
448
|
+
if (!("cc_tools_block" in merged)) {
|
|
449
|
+
merged["cc_tools_block"] = serializeToolsBlock(ccTools);
|
|
450
|
+
}
|
|
438
451
|
if (!("cc_file_name_stem" in merged) && typeof merged["cc_file_name"] === "string") {
|
|
439
452
|
const ccFileName = merged["cc_file_name"];
|
|
440
453
|
merged["cc_file_name_stem"] = ccFileName.replace(/\.md$/, "");
|
|
@@ -451,6 +464,9 @@ function buildContext(options) {
|
|
|
451
464
|
if (!("da_tools_json" in merged)) {
|
|
452
465
|
merged["da_tools_json"] = serializeTools(daTools);
|
|
453
466
|
}
|
|
467
|
+
if (!("da_tools_block" in merged)) {
|
|
468
|
+
merged["da_tools_block"] = serializeToolsBlock(daTools);
|
|
469
|
+
}
|
|
454
470
|
}
|
|
455
471
|
for (const [key, value] of Object.entries(agentMap)) {
|
|
456
472
|
if (!(key in merged)) {
|
|
@@ -678,6 +694,6 @@ function escapeRegExp(str) {
|
|
|
678
694
|
var _pkgRequire = createRequire(import.meta.url);
|
|
679
695
|
var VERSION = _pkgRequire("../package.json").version;
|
|
680
696
|
|
|
681
|
-
export { DEFAULT_FRONTMATTER_CLAUDE_CODE, DEFAULT_FRONTMATTER_DEEP_AGENTS, DEFAULT_FRONTMATTER_VSCODE, TARGET_CLAUDE_CODE, TARGET_DEEP_AGENTS, TARGET_VSCODE, TargetRegistry, VERSION, build, buildPersona, buildSuite, collapseBlankLines, defaultRegistry, discoverPersonaYamls, ensureBlankLineBeforeHeadings, escapeRegExp, loadContent, loadMetadata, loadPartials, normalizeNewlines, renderFrontmatter, resolveConditionals, resolveFrontmatterTemplate, resolvePartials, resolveVariables, runBuildContext, runPartials, runPersonaPartials, runPostRender, runSuiteInit, runValidate, serializeTools, serializeToolsList, validateFileName, validateStrictMarkers };
|
|
697
|
+
export { DEFAULT_FRONTMATTER_CLAUDE_CODE, DEFAULT_FRONTMATTER_DEEP_AGENTS, DEFAULT_FRONTMATTER_VSCODE, TARGET_CLAUDE_CODE, TARGET_DEEP_AGENTS, TARGET_VSCODE, TargetRegistry, VERSION, build, buildPersona, buildSuite, collapseBlankLines, defaultRegistry, discoverPersonaYamls, ensureBlankLineBeforeHeadings, escapeRegExp, loadContent, loadMetadata, loadPartials, normalizeNewlines, renderFrontmatter, resolveConditionals, resolveFrontmatterTemplate, resolvePartials, resolveVariables, runBuildContext, runPartials, runPersonaPartials, runPostRender, runSuiteInit, runValidate, serializeTools, serializeToolsBlock, serializeToolsList, validateFileName, validateStrictMarkers };
|
|
682
698
|
//# sourceMappingURL=index.js.map
|
|
683
699
|
//# sourceMappingURL=index.js.map
|