@rowan-agent/agent 0.25.0 → 0.25.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.
Files changed (2) hide show
  1. package/dist/index.js +11 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9,12 +9,15 @@ import Schema2 from "typebox/schema";
9
9
  function escapeXml(value) {
10
10
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
11
11
  }
12
+ function escapeXmlText(value) {
13
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
14
+ }
12
15
  function buildStructuredSection(tag, items) {
13
16
  const lines = [];
14
17
  for (const item of items) {
15
18
  lines.push(` <${tag}>`);
16
19
  for (const [key, value] of Object.entries(item)) {
17
- lines.push(` <${key}>${escapeXml(value)}</${key}>`);
20
+ lines.push(` <${key}>${escapeXmlText(value)}</${key}>`);
18
21
  }
19
22
  lines.push(` </${tag}>`);
20
23
  }
@@ -26,9 +29,9 @@ function buildSkillsDescription(skills) {
26
29
  const lines = ["<available_skills>"];
27
30
  for (const skill of visibleSkills) {
28
31
  lines.push(" <skill>");
29
- lines.push(` <name>${escapeXml(skill.name)}</name>`);
30
- lines.push(` <description>${escapeXml(skill.description)}</description>`);
31
- lines.push(` <location>${escapeXml(skill.filePath)}</location>`);
32
+ lines.push(` <name>${escapeXmlText(skill.name)}</name>`);
33
+ lines.push(` <description>${escapeXmlText(skill.description)}</description>`);
34
+ lines.push(` <location>${escapeXmlText(skill.filePath)}</location>`);
32
35
  lines.push(" </skill>");
33
36
  }
34
37
  lines.push("</available_skills>");
@@ -67,7 +70,7 @@ function detectResourceType(filePath) {
67
70
  function jsonToXml(value, depth) {
68
71
  const indent = " ".repeat(depth);
69
72
  if (value === null || value === void 0) return "";
70
- if (typeof value !== "object") return `${indent}${escapeXml(String(value))}`;
73
+ if (typeof value !== "object") return `${indent}${escapeXmlText(String(value))}`;
71
74
  if (Array.isArray(value)) {
72
75
  return value.map((item) => {
73
76
  if (typeof item === "object" && item !== null) {
@@ -75,7 +78,7 @@ function jsonToXml(value, depth) {
75
78
  ${jsonToXml(item, depth + 1)}
76
79
  ${indent}</item>`;
77
80
  }
78
- return `${indent}<item>${escapeXml(String(item))}</item>`;
81
+ return `${indent}<item>${escapeXmlText(String(item))}</item>`;
79
82
  }).join("\n");
80
83
  }
81
84
  return Object.entries(value).map(([key, val]) => {
@@ -85,7 +88,7 @@ ${indent}</item>`;
85
88
  ${jsonToXml(val, depth + 1)}
86
89
  ${indent}</${tag}>`;
87
90
  }
88
- return `${indent}<${tag}>${escapeXml(String(val))}</${tag}>`;
91
+ return `${indent}<${tag}>${escapeXmlText(String(val))}</${tag}>`;
89
92
  }).join("\n");
90
93
  }
91
94
  function buildPhaseDirectiveMessage(phase, output) {
@@ -102,7 +105,7 @@ function buildPhaseDirectiveMessage(phase, output) {
102
105
  if (output.results && output.results.length > 0 || output.instruction) {
103
106
  parts.push(` <prev_phase_outputs>`);
104
107
  if (output.instruction) {
105
- parts.push(` <instruction>${escapeXml(output.instruction)}</instruction>`);
108
+ parts.push(` <instruction>${escapeXmlText(output.instruction)}</instruction>`);
106
109
  }
107
110
  for (const r of output.results ?? []) {
108
111
  parts.push(` <phase name="${escapeXml(r.name)}">`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowan-agent/agent",
3
- "version": "0.25.0",
3
+ "version": "0.25.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",