@bamdra/bamdra-user-bind 0.1.7 → 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 +19 -3
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
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
|
|
@@ -1369,7 +1369,7 @@ ${notes}
|
|
|
1369
1369
|
function parseProfileMarkdown(markdown) {
|
|
1370
1370
|
const lines = markdown.split(/\r?\n/);
|
|
1371
1371
|
const patch = {};
|
|
1372
|
-
let notes =
|
|
1372
|
+
let notes = null;
|
|
1373
1373
|
let index = 0;
|
|
1374
1374
|
if (lines[index] === "---") {
|
|
1375
1375
|
index += 1;
|
|
@@ -1387,7 +1387,11 @@ function parseProfileMarkdown(markdown) {
|
|
|
1387
1387
|
index += 1;
|
|
1388
1388
|
}
|
|
1389
1389
|
}
|
|
1390
|
-
|
|
1390
|
+
const body = lines.slice(index).join("\n");
|
|
1391
|
+
const notesMatch = body.match(/##\s*备注\s*\n([\s\S]*)$/);
|
|
1392
|
+
if (notesMatch?.[1]) {
|
|
1393
|
+
notes = sanitizeProfileNotes(notesMatch[1]);
|
|
1394
|
+
}
|
|
1391
1395
|
return {
|
|
1392
1396
|
profilePatch: patch,
|
|
1393
1397
|
notes
|
|
@@ -1604,6 +1608,18 @@ function defaultProfileNotes() {
|
|
|
1604
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"
|
|
1605
1609
|
].join("\n");
|
|
1606
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
|
+
}
|
|
1607
1623
|
function escapeFrontmatter(value) {
|
|
1608
1624
|
if (!value) {
|
|
1609
1625
|
return "null";
|
package/openclaw.plugin.json
CHANGED
|
@@ -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.
|
|
6
|
+
"version": "0.1.9",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"skills": ["./skills"],
|
|
9
9
|
"configSchema": {
|
package/package.json
CHANGED