@bamdra/bamdra-user-bind 0.1.8 → 0.1.9

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/dist/index.js CHANGED
@@ -1346,7 +1346,7 @@ function renderProfileMarkdown(profile) {
1346
1346
  `updatedAt: ${escapeFrontmatter(profile.updatedAt)}`,
1347
1347
  "---"
1348
1348
  ].join("\n");
1349
- const notes = profile.notes ?? defaultProfileNotes();
1349
+ const notes = sanitizeProfileNotes(profile.notes) ?? defaultProfileNotes();
1350
1350
  return `${frontmatter}
1351
1351
 
1352
1352
  # \u7528\u6237\u753B\u50CF
@@ -1390,7 +1390,7 @@ function parseProfileMarkdown(markdown) {
1390
1390
  const body = lines.slice(index).join("\n");
1391
1391
  const notesMatch = body.match(/##\s*备注\s*\n([\s\S]*)$/);
1392
1392
  if (notesMatch?.[1]) {
1393
- notes = notesMatch[1].trim() || null;
1393
+ notes = sanitizeProfileNotes(notesMatch[1]);
1394
1394
  }
1395
1395
  return {
1396
1396
  profilePatch: patch,
@@ -1608,6 +1608,18 @@ function defaultProfileNotes() {
1608
1608
  "- \u4F60\u53EF\u4EE5\u5728\u8FD9\u91CC\u7EE7\u7EED\u8865\u5145\u5DE5\u4F5C\u80CC\u666F\u3001\u8868\u8FBE\u4E60\u60EF\u3001\u7981\u5FCC\u548C\u957F\u671F\u504F\u597D\u3002"
1609
1609
  ].join("\n");
1610
1610
  }
1611
+ function sanitizeProfileNotes(notes) {
1612
+ const value = typeof notes === "string" ? notes.trim() : "";
1613
+ if (!value) {
1614
+ return null;
1615
+ }
1616
+ const normalized = value.replace(/\r/g, "");
1617
+ const marker = "## \u5907\u6CE8";
1618
+ const lastMarkerIndex = normalized.lastIndexOf(marker);
1619
+ const sliced = lastMarkerIndex >= 0 ? normalized.slice(lastMarkerIndex + marker.length) : normalized;
1620
+ const cleaned = sliced.replace(/^[::\s\n-]+/, "").replace(/^#\s*用户画像[\s\S]*?##\s*备注\s*/m, "").trim();
1621
+ return cleaned || null;
1622
+ }
1611
1623
  function escapeFrontmatter(value) {
1612
1624
  if (!value) {
1613
1625
  return "null";
@@ -3,7 +3,7 @@
3
3
  "type": "tool",
4
4
  "name": "Bamdra User Bind",
5
5
  "description": "Identity resolution, user profile binding, and admin profile tools for OpenClaw channels.",
6
- "version": "0.1.8",
6
+ "version": "0.1.9",
7
7
  "main": "./dist/index.js",
8
8
  "skills": ["./skills"],
9
9
  "configSchema": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamdra/bamdra-user-bind",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Identity resolution, user profile binding, and admin-safe profile tools for OpenClaw channels.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.bamdra.com",