libp2p-mesh 2026.6.14 → 2026.6.15

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 CHANGED
@@ -476,6 +476,18 @@ There are two sources:
476
476
  - `USER.md` tags are extracted read-only at gateway startup. The plugin never edits `USER.md`.
477
477
  - `user-profile.json` stores manually managed structured attributes such as group, project, role, skill, or a custom key.
478
478
 
479
+ By default, `USER.md` is read from:
480
+
481
+ ```text
482
+ ~/.openclaw/workspace/USER.md
483
+ ```
484
+
485
+ When `OPENCLAW_STATE_DIR` is set, the plugin reads:
486
+
487
+ ```text
488
+ $OPENCLAW_STATE_DIR/workspace/USER.md
489
+ ```
490
+
479
491
  Run the profile wizard to manage structured attributes:
480
492
 
481
493
  ```bash
@@ -6,6 +6,7 @@ export type UserMdAttributeSource = {
6
6
  warn?: (message: string) => void;
7
7
  };
8
8
  };
9
+ export declare function resolveUserMdPath(customPath?: string): string;
9
10
  export declare function extractUserMdTags(markdown: string): UserPublicAttribute[];
10
11
  export declare function createUserMdAttributeSource(options?: UserMdAttributeSource): {
11
12
  loadTags(): Promise<UserPublicAttribute[]>;
@@ -1,4 +1,5 @@
1
1
  import { readFile } from "node:fs/promises";
2
+ import { homedir } from "node:os";
2
3
  import path from "node:path";
3
4
  import { normalizeAttributeValue } from "./user-attributes.js";
4
5
  const MAX_TAGS = 10;
@@ -42,6 +43,16 @@ const ENGLISH_TAG_FIELDS = new Set([
42
43
  "interest",
43
44
  "interests",
44
45
  ]);
46
+ export function resolveUserMdPath(customPath) {
47
+ if (customPath) {
48
+ return customPath;
49
+ }
50
+ const stateDir = process.env.OPENCLAW_STATE_DIR;
51
+ if (stateDir) {
52
+ return path.join(stateDir, "workspace", "USER.md");
53
+ }
54
+ return path.join(homedir(), ".openclaw", "workspace", "USER.md");
55
+ }
45
56
  function isTemplateText(value) {
46
57
  const trimmed = value.trim();
47
58
  return trimmed.length === 0 || TEMPLATE_PATTERN.test(trimmed) || /^\[[^\]]+\]$/.test(trimmed);
@@ -183,7 +194,7 @@ export function extractUserMdTags(markdown) {
183
194
  return tags;
184
195
  }
185
196
  export function createUserMdAttributeSource(options) {
186
- const filePath = options?.path ?? path.join(process.cwd(), "USER.md");
197
+ const filePath = resolveUserMdPath(options?.path);
187
198
  const logger = options?.logger;
188
199
  return {
189
200
  async loadTags() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libp2p-mesh",
3
- "version": "2026.6.14",
3
+ "version": "2026.6.15",
4
4
  "description": "OpenClaw libp2p P2P mesh network plugin for cross-instance agent communication",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,4 +1,5 @@
1
1
  import { readFile } from "node:fs/promises";
2
+ import { homedir } from "node:os";
2
3
  import path from "node:path";
3
4
 
4
5
  import type { UserPublicAttribute } from "./types.js";
@@ -59,6 +60,19 @@ export type UserMdAttributeSource = {
59
60
  };
60
61
  };
61
62
 
63
+ export function resolveUserMdPath(customPath?: string): string {
64
+ if (customPath) {
65
+ return customPath;
66
+ }
67
+
68
+ const stateDir = process.env.OPENCLAW_STATE_DIR;
69
+ if (stateDir) {
70
+ return path.join(stateDir, "workspace", "USER.md");
71
+ }
72
+
73
+ return path.join(homedir(), ".openclaw", "workspace", "USER.md");
74
+ }
75
+
62
76
  function isTemplateText(value: string): boolean {
63
77
  const trimmed = value.trim();
64
78
  return trimmed.length === 0 || TEMPLATE_PATTERN.test(trimmed) || /^\[[^\]]+\]$/.test(trimmed);
@@ -236,7 +250,7 @@ export function extractUserMdTags(markdown: string): UserPublicAttribute[] {
236
250
  export function createUserMdAttributeSource(options?: UserMdAttributeSource): {
237
251
  loadTags(): Promise<UserPublicAttribute[]>;
238
252
  } {
239
- const filePath = options?.path ?? path.join(process.cwd(), "USER.md");
253
+ const filePath = resolveUserMdPath(options?.path);
240
254
  const logger = options?.logger;
241
255
 
242
256
  return {