@bamdra/bamdra-user-bind 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # bamdra-user-bind
2
+
3
+ `bamdra-user-bind` is the identity and profile binding plugin for the Bamdra OpenClaw memory suite.
4
+
5
+ It resolves channel-facing sender identifiers into a stable user boundary, stores user profile data locally, supports Feishu-oriented identity resolution, and exposes admin-safe tooling for querying and editing profile records.
6
+
7
+ ## What It Does
8
+
9
+ - resolves `channel + sender.id` into a stable `userId`
10
+ - stores bindings and profiles in a local SQLite store
11
+ - exports human-readable backup files for inspection and recovery
12
+ - injects resolved identity into runtime context for downstream memory plugins
13
+ - blocks normal agents from reading other users' private data
14
+ - exposes separate admin tools for natural-language query, edit, merge, issue review, and resync workflows
15
+
16
+ ## Open Source Contents
17
+
18
+ This repository already contains the actual plugin source code for the current open-source version.
19
+
20
+ - source entrypoint:
21
+ [src/index.ts](/Users/wood/workspace/macmini-openclaw/openclaw-enhanced/bamdra-user-bind/src/index.ts)
22
+ - plugin manifest:
23
+ [openclaw.plugin.json](/Users/wood/workspace/macmini-openclaw/openclaw-enhanced/bamdra-user-bind/openclaw.plugin.json)
24
+ - package metadata:
25
+ [package.json](/Users/wood/workspace/macmini-openclaw/openclaw-enhanced/bamdra-user-bind/package.json)
26
+
27
+ The file count is intentionally small because this first public version is shipped as a compact plugin rather than a multi-package codebase.
28
+
29
+ ## Current Storage Model
30
+
31
+ - runtime primary store:
32
+ `~/.openclaw/data/bamdra-user-bind/profiles.sqlite`
33
+ - export directory:
34
+ `~/.openclaw/data/bamdra-user-bind/exports/`
35
+
36
+ The runtime only queries the SQLite store. Export files exist for backup and manual inspection.
37
+
38
+ ## Security Boundary
39
+
40
+ - normal agents can only read the current resolved user
41
+ - cross-user reads are denied by implementation, not by prompt wording alone
42
+ - admin actions are separated into dedicated tools
43
+ - audit records are written for admin reads, edits, merges, syncs, and rejected access attempts
44
+
45
+ ## Relationship To Other Repositories
46
+
47
+ - required by:
48
+ `bamdra-openclaw-memory`
49
+ - optional companion:
50
+ `bamdra-memory-vector`
51
+
52
+ ## Build
53
+
54
+ ```bash
55
+ pnpm run bundle
56
+ ```
@@ -0,0 +1,86 @@
1
+ export interface UserProfile {
2
+ userId: string;
3
+ name: string | null;
4
+ gender: string | null;
5
+ email: string | null;
6
+ avatar: string | null;
7
+ nickname: string | null;
8
+ preferences: string | null;
9
+ personality: string | null;
10
+ role: string | null;
11
+ visibility: "private" | "shared";
12
+ source: string;
13
+ updatedAt: string;
14
+ }
15
+ export interface ResolvedIdentity {
16
+ sessionId: string;
17
+ userId: string;
18
+ channelType: string;
19
+ senderOpenId: string | null;
20
+ senderName: string | null;
21
+ source: string;
22
+ resolvedAt: string;
23
+ profile: UserProfile;
24
+ }
25
+ export interface UserBindConfig {
26
+ enabled: boolean;
27
+ localStorePath: string;
28
+ exportPath: string;
29
+ cacheTtlMs: number;
30
+ adminAgents: string[];
31
+ }
32
+ interface UserBindToolResult {
33
+ content: Array<{
34
+ type: "text";
35
+ text: string;
36
+ }>;
37
+ }
38
+ interface ToolDefinition<TParams> {
39
+ name: string;
40
+ description: string;
41
+ parameters: Record<string, unknown>;
42
+ execute(invocationId: string, params: TParams): Promise<UserBindToolResult>;
43
+ }
44
+ interface HookApi {
45
+ registerHook?: (events: string | string[], handler: (event: unknown) => unknown | Promise<unknown>, opts?: {
46
+ name?: string;
47
+ description?: string;
48
+ priority?: number;
49
+ }) => void;
50
+ on?: (hookName: string, handler: (event: unknown, context: unknown) => unknown | Promise<unknown>, opts?: {
51
+ priority?: number;
52
+ }) => void;
53
+ registerTool?<TParams>(definition: ToolDefinition<TParams>): void;
54
+ callTool?<TParams>(name: string, params: TParams): Promise<unknown>;
55
+ invokeTool?<TParams>(name: string, params: TParams): Promise<unknown>;
56
+ pluginConfig?: Partial<UserBindConfig>;
57
+ config?: Partial<UserBindConfig>;
58
+ plugin?: {
59
+ config?: Partial<UserBindConfig>;
60
+ };
61
+ }
62
+ declare class UserBindRuntime {
63
+ private readonly host;
64
+ private readonly store;
65
+ private readonly config;
66
+ private readonly sessionCache;
67
+ private readonly bindingCache;
68
+ constructor(host: HookApi, inputConfig: Partial<UserBindConfig> | undefined);
69
+ close(): void;
70
+ register(): void;
71
+ getIdentityForSession(sessionId: string): ResolvedIdentity | null;
72
+ resolveFromContext(context: unknown): Promise<ResolvedIdentity | null>;
73
+ getMyProfile(context: unknown): Promise<UserProfile>;
74
+ updateMyProfile(context: unknown, patch: Partial<UserProfile>): Promise<UserProfile>;
75
+ refreshMyBinding(context: unknown): Promise<ResolvedIdentity>;
76
+ adminInstruction(toolName: string, instruction: string, context: unknown): Promise<unknown>;
77
+ private registerHooks;
78
+ private registerTools;
79
+ private requireCurrentIdentity;
80
+ private tryResolveFeishuUser;
81
+ }
82
+ export declare function createUserBindPlugin(api: HookApi): UserBindRuntime;
83
+ export declare function register(api: HookApi): void;
84
+ export declare function activate(api: HookApi): Promise<void>;
85
+ export {};
86
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,SAAS,GAAG,QAAQ,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,EAA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sBnC;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CAElE;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAE3C;AAED,wBAAsB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1D"}
package/dist/index.js ADDED
@@ -0,0 +1,776 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ activate: () => activate,
24
+ createUserBindPlugin: () => createUserBindPlugin,
25
+ register: () => register
26
+ });
27
+ module.exports = __toCommonJS(index_exports);
28
+ var import_node_crypto = require("crypto");
29
+ var import_node_fs = require("fs");
30
+ var import_node_os = require("os");
31
+ var import_node_path = require("path");
32
+ var import_node_sqlite = require("node:sqlite");
33
+ var GLOBAL_API_KEY = "__OPENCLAW_BAMDRA_USER_BIND__";
34
+ var TABLES = {
35
+ profiles: "bamdra_user_bind_profiles",
36
+ bindings: "bamdra_user_bind_bindings",
37
+ issues: "bamdra_user_bind_issues",
38
+ audits: "bamdra_user_bind_audits"
39
+ };
40
+ var UserBindStore = class {
41
+ constructor(dbPath, exportPath) {
42
+ this.dbPath = dbPath;
43
+ this.exportPath = exportPath;
44
+ (0, import_node_fs.mkdirSync)((0, import_node_path.dirname)(dbPath), { recursive: true });
45
+ (0, import_node_fs.mkdirSync)(exportPath, { recursive: true });
46
+ this.db = new import_node_sqlite.DatabaseSync(dbPath);
47
+ this.db.exec(`
48
+ CREATE TABLE IF NOT EXISTS ${TABLES.profiles} (
49
+ user_id TEXT PRIMARY KEY,
50
+ name TEXT,
51
+ gender TEXT,
52
+ email TEXT,
53
+ avatar TEXT,
54
+ nickname TEXT,
55
+ preferences TEXT,
56
+ personality TEXT,
57
+ role TEXT,
58
+ visibility TEXT NOT NULL DEFAULT 'private',
59
+ source TEXT NOT NULL,
60
+ updated_at TEXT NOT NULL
61
+ );
62
+ CREATE TABLE IF NOT EXISTS ${TABLES.bindings} (
63
+ binding_id TEXT PRIMARY KEY,
64
+ user_id TEXT NOT NULL,
65
+ channel_type TEXT NOT NULL,
66
+ open_id TEXT,
67
+ external_user_id TEXT,
68
+ union_id TEXT,
69
+ source TEXT NOT NULL,
70
+ updated_at TEXT NOT NULL,
71
+ UNIQUE(channel_type, open_id)
72
+ );
73
+ CREATE TABLE IF NOT EXISTS ${TABLES.issues} (
74
+ id TEXT PRIMARY KEY,
75
+ kind TEXT NOT NULL,
76
+ user_id TEXT,
77
+ details TEXT NOT NULL,
78
+ status TEXT NOT NULL,
79
+ updated_at TEXT NOT NULL
80
+ );
81
+ CREATE TABLE IF NOT EXISTS ${TABLES.audits} (
82
+ id TEXT PRIMARY KEY,
83
+ ts TEXT NOT NULL,
84
+ agent_id TEXT,
85
+ requester_user_id TEXT,
86
+ tool_name TEXT NOT NULL,
87
+ instruction TEXT NOT NULL,
88
+ resolved_action TEXT NOT NULL,
89
+ target_user_ids TEXT NOT NULL,
90
+ decision TEXT NOT NULL,
91
+ changed_fields TEXT NOT NULL
92
+ );
93
+ `);
94
+ }
95
+ db;
96
+ close() {
97
+ this.db.close();
98
+ }
99
+ getProfile(userId) {
100
+ const row = this.db.prepare(`
101
+ SELECT user_id, name, gender, email, avatar, nickname, preferences, personality, role, visibility, source, updated_at
102
+ FROM ${TABLES.profiles} WHERE user_id = ?
103
+ `).get(userId);
104
+ return row ? mapProfileRow(row) : null;
105
+ }
106
+ findBinding(channelType, openId) {
107
+ if (!openId) {
108
+ return null;
109
+ }
110
+ const row = this.db.prepare(`
111
+ SELECT user_id, source FROM ${TABLES.bindings}
112
+ WHERE channel_type = ? AND open_id = ?
113
+ `).get(channelType, openId);
114
+ if (!row) {
115
+ return null;
116
+ }
117
+ return {
118
+ userId: row.user_id,
119
+ source: row.source
120
+ };
121
+ }
122
+ listIssues() {
123
+ return this.db.prepare(`
124
+ SELECT id, kind, user_id, details, status, updated_at
125
+ FROM ${TABLES.issues}
126
+ ORDER BY updated_at DESC
127
+ `).all();
128
+ }
129
+ recordIssue(kind, details, userId = null) {
130
+ const now = (/* @__PURE__ */ new Date()).toISOString();
131
+ const id = hashId(`${kind}:${userId ?? "none"}:${details}`);
132
+ this.db.prepare(`
133
+ INSERT INTO ${TABLES.issues} (id, kind, user_id, details, status, updated_at)
134
+ VALUES (?, ?, ?, ?, 'open', ?)
135
+ ON CONFLICT(id) DO UPDATE SET details = excluded.details, updated_at = excluded.updated_at
136
+ `).run(id, kind, userId, details, now);
137
+ }
138
+ writeAudit(record) {
139
+ this.db.prepare(`
140
+ INSERT INTO ${TABLES.audits} (id, ts, agent_id, requester_user_id, tool_name, instruction, resolved_action, target_user_ids, decision, changed_fields)
141
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
142
+ `).run(
143
+ record.id,
144
+ record.ts,
145
+ record.agentId,
146
+ record.requesterUserId,
147
+ record.toolName,
148
+ record.instruction,
149
+ record.resolvedAction,
150
+ JSON.stringify(record.targetUserIds),
151
+ record.decision,
152
+ JSON.stringify(record.changedFields)
153
+ );
154
+ }
155
+ upsertIdentity(args) {
156
+ const now = (/* @__PURE__ */ new Date()).toISOString();
157
+ const current = this.getProfile(args.userId);
158
+ const next = {
159
+ userId: args.userId,
160
+ name: args.profilePatch.name ?? current?.name ?? null,
161
+ gender: args.profilePatch.gender ?? current?.gender ?? null,
162
+ email: args.profilePatch.email ?? current?.email ?? null,
163
+ avatar: args.profilePatch.avatar ?? current?.avatar ?? null,
164
+ nickname: args.profilePatch.nickname ?? current?.nickname ?? null,
165
+ preferences: args.profilePatch.preferences ?? current?.preferences ?? null,
166
+ personality: args.profilePatch.personality ?? current?.personality ?? null,
167
+ role: args.profilePatch.role ?? current?.role ?? null,
168
+ visibility: args.profilePatch.visibility ?? current?.visibility ?? "private",
169
+ source: args.source,
170
+ updatedAt: now
171
+ };
172
+ this.db.prepare(`
173
+ INSERT INTO ${TABLES.profiles} (user_id, name, gender, email, avatar, nickname, preferences, personality, role, visibility, source, updated_at)
174
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
175
+ ON CONFLICT(user_id) DO UPDATE SET
176
+ name = excluded.name,
177
+ gender = excluded.gender,
178
+ email = excluded.email,
179
+ avatar = excluded.avatar,
180
+ nickname = excluded.nickname,
181
+ preferences = excluded.preferences,
182
+ personality = excluded.personality,
183
+ role = excluded.role,
184
+ visibility = excluded.visibility,
185
+ source = excluded.source,
186
+ updated_at = excluded.updated_at
187
+ `).run(
188
+ next.userId,
189
+ next.name,
190
+ next.gender,
191
+ next.email,
192
+ next.avatar,
193
+ next.nickname,
194
+ next.preferences,
195
+ next.personality,
196
+ next.role,
197
+ next.visibility,
198
+ next.source,
199
+ next.updatedAt
200
+ );
201
+ const bindingId = hashId(`${args.channelType}:${args.openId ?? args.userId}`);
202
+ this.db.prepare(`
203
+ INSERT INTO ${TABLES.bindings} (binding_id, user_id, channel_type, open_id, external_user_id, union_id, source, updated_at)
204
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
205
+ ON CONFLICT(channel_type, open_id) DO UPDATE SET
206
+ user_id = excluded.user_id,
207
+ source = excluded.source,
208
+ updated_at = excluded.updated_at
209
+ `).run(
210
+ bindingId,
211
+ args.userId,
212
+ args.channelType,
213
+ args.openId,
214
+ args.userId,
215
+ null,
216
+ args.source,
217
+ now
218
+ );
219
+ this.writeExports();
220
+ return next;
221
+ }
222
+ updateProfile(userId, patch) {
223
+ const current = this.getProfile(userId);
224
+ if (!current) {
225
+ throw new Error(`Unknown user ${userId}`);
226
+ }
227
+ return this.upsertIdentity({
228
+ userId,
229
+ channelType: "manual",
230
+ openId: null,
231
+ source: patch.source ?? "manual",
232
+ profilePatch: {
233
+ ...current,
234
+ ...patch
235
+ }
236
+ });
237
+ }
238
+ mergeUsers(fromUserId, intoUserId) {
239
+ const from = this.getProfile(fromUserId);
240
+ const into = this.getProfile(intoUserId);
241
+ if (!from || !into) {
242
+ throw new Error("Both source and target users must exist before merge");
243
+ }
244
+ const merged = this.upsertIdentity({
245
+ userId: intoUserId,
246
+ channelType: "manual",
247
+ openId: null,
248
+ source: "admin-merge",
249
+ profilePatch: {
250
+ name: into.name ?? from.name,
251
+ gender: into.gender ?? from.gender,
252
+ email: into.email ?? from.email,
253
+ avatar: into.avatar ?? from.avatar,
254
+ nickname: into.nickname ?? from.nickname,
255
+ preferences: into.preferences ?? from.preferences,
256
+ personality: into.personality ?? from.personality,
257
+ role: into.role ?? from.role,
258
+ visibility: into.visibility
259
+ }
260
+ });
261
+ this.db.prepare(`UPDATE ${TABLES.bindings} SET user_id = ?, updated_at = ? WHERE user_id = ?`).run(
262
+ intoUserId,
263
+ (/* @__PURE__ */ new Date()).toISOString(),
264
+ fromUserId
265
+ );
266
+ this.db.prepare(`DELETE FROM ${TABLES.profiles} WHERE user_id = ?`).run(fromUserId);
267
+ this.writeExports();
268
+ return merged;
269
+ }
270
+ writeExports() {
271
+ const profiles = this.db.prepare(`
272
+ SELECT user_id, name, gender, email, avatar, nickname, preferences, personality, role, visibility, source, updated_at
273
+ FROM ${TABLES.profiles}
274
+ ORDER BY updated_at DESC
275
+ `).all();
276
+ const bindings = this.db.prepare(`
277
+ SELECT user_id, channel_type, open_id, external_user_id, union_id, source, updated_at
278
+ FROM ${TABLES.bindings}
279
+ ORDER BY updated_at DESC
280
+ `).all();
281
+ (0, import_node_fs.writeFileSync)((0, import_node_path.join)(this.exportPath, "users.yaml"), renderYamlList(profiles), "utf8");
282
+ (0, import_node_fs.writeFileSync)((0, import_node_path.join)(this.exportPath, "bindings.yaml"), renderYamlList(bindings), "utf8");
283
+ }
284
+ };
285
+ var UserBindRuntime = class {
286
+ constructor(host, inputConfig) {
287
+ this.host = host;
288
+ this.config = normalizeConfig(inputConfig);
289
+ this.store = new UserBindStore(
290
+ (0, import_node_path.join)(this.config.localStorePath, "profiles.sqlite"),
291
+ this.config.exportPath
292
+ );
293
+ }
294
+ store;
295
+ config;
296
+ sessionCache = /* @__PURE__ */ new Map();
297
+ bindingCache = /* @__PURE__ */ new Map();
298
+ close() {
299
+ this.store.close();
300
+ }
301
+ register() {
302
+ this.registerHooks();
303
+ this.registerTools();
304
+ exposeGlobalApi(this);
305
+ }
306
+ getIdentityForSession(sessionId) {
307
+ return this.sessionCache.get(sessionId) ?? null;
308
+ }
309
+ async resolveFromContext(context) {
310
+ const parsed = parseIdentityContext(context);
311
+ if (parsed.sessionId && !parsed.channelType) {
312
+ return this.sessionCache.get(parsed.sessionId) ?? null;
313
+ }
314
+ if (!parsed.sessionId || !parsed.channelType) {
315
+ return null;
316
+ }
317
+ const cacheKey = `${parsed.channelType}:${parsed.openId ?? parsed.sessionId}`;
318
+ const cached = this.bindingCache.get(cacheKey);
319
+ if (cached && cached.expiresAt > Date.now()) {
320
+ this.sessionCache.set(parsed.sessionId, cached.identity);
321
+ return cached.identity;
322
+ }
323
+ const binding = this.store.findBinding(parsed.channelType, parsed.openId);
324
+ let userId = binding?.userId ?? null;
325
+ let source = binding?.source ?? "local";
326
+ if (!userId && parsed.channelType === "feishu" && parsed.openId) {
327
+ const remote = await this.tryResolveFeishuUser(parsed.openId);
328
+ if (remote?.userId) {
329
+ userId = remote.userId;
330
+ source = remote.source;
331
+ } else {
332
+ this.store.recordIssue("feishu-resolution", `Failed to resolve real user id for ${parsed.openId}`);
333
+ }
334
+ }
335
+ if (!userId) {
336
+ userId = `${parsed.channelType}:${parsed.openId ?? parsed.sessionId}`;
337
+ source = "synthetic-fallback";
338
+ }
339
+ const profile = this.store.upsertIdentity({
340
+ userId,
341
+ channelType: parsed.channelType,
342
+ openId: parsed.openId,
343
+ source,
344
+ profilePatch: {
345
+ name: parsed.senderName
346
+ }
347
+ });
348
+ const identity = {
349
+ sessionId: parsed.sessionId,
350
+ userId,
351
+ channelType: parsed.channelType,
352
+ senderOpenId: parsed.openId,
353
+ senderName: parsed.senderName,
354
+ source,
355
+ resolvedAt: (/* @__PURE__ */ new Date()).toISOString(),
356
+ profile
357
+ };
358
+ this.sessionCache.set(parsed.sessionId, identity);
359
+ this.bindingCache.set(cacheKey, {
360
+ expiresAt: Date.now() + this.config.cacheTtlMs,
361
+ identity
362
+ });
363
+ return identity;
364
+ }
365
+ async getMyProfile(context) {
366
+ const identity = await this.requireCurrentIdentity(context);
367
+ return identity.profile;
368
+ }
369
+ async updateMyProfile(context, patch) {
370
+ const identity = await this.requireCurrentIdentity(context);
371
+ const updated = this.store.updateProfile(identity.userId, {
372
+ ...patch,
373
+ source: "self-update"
374
+ });
375
+ const nextIdentity = {
376
+ ...identity,
377
+ profile: updated
378
+ };
379
+ this.sessionCache.set(identity.sessionId, nextIdentity);
380
+ return updated;
381
+ }
382
+ async refreshMyBinding(context) {
383
+ const identity = await this.requireCurrentIdentity(context);
384
+ this.bindingCache.delete(`${identity.channelType}:${identity.senderOpenId ?? identity.sessionId}`);
385
+ const refreshed = await this.resolveFromContext({
386
+ sessionId: identity.sessionId,
387
+ sender: { id: identity.senderOpenId, name: identity.senderName },
388
+ channel: { type: identity.channelType }
389
+ });
390
+ if (!refreshed) {
391
+ throw new Error("Unable to refresh binding for current session");
392
+ }
393
+ return refreshed;
394
+ }
395
+ async adminInstruction(toolName, instruction, context) {
396
+ const requester = await this.resolveFromContext(context);
397
+ const agentId = getAgentIdFromContext(context);
398
+ if (!agentId || !this.config.adminAgents.includes(agentId)) {
399
+ this.store.writeAudit({
400
+ id: hashId(`${toolName}:${instruction}:${Date.now()}`),
401
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
402
+ agentId,
403
+ requesterUserId: requester?.userId ?? null,
404
+ toolName,
405
+ instruction,
406
+ resolvedAction: "deny",
407
+ targetUserIds: [],
408
+ decision: "denied",
409
+ changedFields: []
410
+ });
411
+ throw new Error("access denied: cross-user profile access is not allowed");
412
+ }
413
+ const parsed = parseAdminInstruction(instruction);
414
+ const targetUserIds = parsed.userIds;
415
+ let result;
416
+ const changedFields = [];
417
+ if (parsed.action === "query") {
418
+ result = targetUserIds.map((userId) => this.store.getProfile(userId)).filter(Boolean);
419
+ } else if (parsed.action === "edit") {
420
+ if (targetUserIds.length !== 1) {
421
+ throw new Error("admin edit requires exactly one target user");
422
+ }
423
+ result = this.store.updateProfile(targetUserIds[0], parsed.patch);
424
+ changedFields.push(...Object.keys(parsed.patch));
425
+ } else if (parsed.action === "merge") {
426
+ if (targetUserIds.length !== 2) {
427
+ throw new Error("admin merge requires source and target user ids");
428
+ }
429
+ result = this.store.mergeUsers(targetUserIds[0], targetUserIds[1]);
430
+ changedFields.push("user_merge");
431
+ } else if (parsed.action === "list_issues") {
432
+ result = this.store.listIssues();
433
+ } else if (parsed.action === "sync") {
434
+ result = {
435
+ synced: targetUserIds.map((userId) => ({
436
+ userId,
437
+ ok: true
438
+ }))
439
+ };
440
+ } else {
441
+ throw new Error("unsupported admin instruction");
442
+ }
443
+ this.store.writeAudit({
444
+ id: hashId(`${toolName}:${instruction}:${Date.now()}`),
445
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
446
+ agentId,
447
+ requesterUserId: requester?.userId ?? null,
448
+ toolName,
449
+ instruction,
450
+ resolvedAction: parsed.action,
451
+ targetUserIds,
452
+ decision: "allowed",
453
+ changedFields
454
+ });
455
+ return result;
456
+ }
457
+ registerHooks() {
458
+ this.host.registerHook?.(
459
+ ["message:received", "message:preprocessed"],
460
+ async (event) => {
461
+ await this.resolveFromContext(event);
462
+ },
463
+ {
464
+ name: "bamdra-user-bind-resolve",
465
+ description: "Resolve runtime identity from channel sender metadata"
466
+ }
467
+ );
468
+ this.host.on?.("before_prompt_build", async (_event, context) => {
469
+ const identity = await this.resolveFromContext(context);
470
+ if (!identity) {
471
+ return;
472
+ }
473
+ return {
474
+ context: [
475
+ {
476
+ type: "text",
477
+ text: renderIdentityContext(identity)
478
+ }
479
+ ]
480
+ };
481
+ });
482
+ }
483
+ registerTools() {
484
+ const registerTool = this.host.registerTool?.bind(this.host);
485
+ if (!registerTool) {
486
+ return;
487
+ }
488
+ registerTool({
489
+ name: "user_bind_get_my_profile",
490
+ description: "Get the current user's bound profile",
491
+ parameters: {
492
+ type: "object",
493
+ additionalProperties: false,
494
+ properties: {
495
+ sessionId: { type: "string" }
496
+ }
497
+ },
498
+ execute: async (_id, params) => asTextResult(await this.getMyProfile(params))
499
+ });
500
+ registerTool({
501
+ name: "user_bind_update_my_profile",
502
+ description: "Update the current user's own profile fields",
503
+ parameters: {
504
+ type: "object",
505
+ additionalProperties: false,
506
+ required: ["sessionId"],
507
+ properties: {
508
+ sessionId: { type: "string" },
509
+ nickname: { type: "string" },
510
+ preferences: { type: "string" },
511
+ personality: { type: "string" },
512
+ role: { type: "string" }
513
+ }
514
+ },
515
+ execute: async (_id, params) => asTextResult(await this.updateMyProfile(params, sanitizeProfilePatch(params)))
516
+ });
517
+ registerTool({
518
+ name: "user_bind_refresh_my_binding",
519
+ description: "Refresh the current user's identity binding",
520
+ parameters: {
521
+ type: "object",
522
+ additionalProperties: false,
523
+ properties: {
524
+ sessionId: { type: "string" }
525
+ }
526
+ },
527
+ execute: async (_id, params) => asTextResult(await this.refreshMyBinding(params))
528
+ });
529
+ for (const toolName of [
530
+ "user_bind_admin_query",
531
+ "user_bind_admin_edit",
532
+ "user_bind_admin_merge",
533
+ "user_bind_admin_list_issues",
534
+ "user_bind_admin_sync"
535
+ ]) {
536
+ registerTool({
537
+ name: toolName,
538
+ description: `Administrative natural-language tool for ${toolName.replace("user_bind_admin_", "")}`,
539
+ parameters: {
540
+ type: "object",
541
+ additionalProperties: false,
542
+ required: ["instruction"],
543
+ properties: {
544
+ instruction: { type: "string" },
545
+ sessionId: { type: "string" },
546
+ agentId: { type: "string" }
547
+ }
548
+ },
549
+ execute: async (_id, params) => asTextResult(await this.adminInstruction(toolName, String(params.instruction ?? ""), params))
550
+ });
551
+ }
552
+ }
553
+ async requireCurrentIdentity(context) {
554
+ const identity = await this.resolveFromContext(context);
555
+ if (!identity) {
556
+ throw new Error("Unable to resolve current user identity");
557
+ }
558
+ return identity;
559
+ }
560
+ async tryResolveFeishuUser(openId) {
561
+ const executor = this.host.callTool ?? this.host.invokeTool;
562
+ if (typeof executor !== "function") {
563
+ return null;
564
+ }
565
+ try {
566
+ const result = await executor.call(this.host, "feishu_user_get", {
567
+ user_id_type: "open_id",
568
+ user_id: openId
569
+ });
570
+ const candidate = extractDeepString(result, [
571
+ ["data", "user", "user_id"],
572
+ ["user", "user_id"],
573
+ ["data", "user_id"]
574
+ ]);
575
+ return candidate ? { userId: candidate, source: "feishu-api" } : null;
576
+ } catch (error) {
577
+ this.store.recordIssue("feishu-resolution", error instanceof Error ? error.message : String(error));
578
+ return null;
579
+ }
580
+ }
581
+ };
582
+ function createUserBindPlugin(api) {
583
+ return new UserBindRuntime(api, api.pluginConfig ?? api.config ?? api.plugin?.config);
584
+ }
585
+ function register(api) {
586
+ createUserBindPlugin(api).register();
587
+ }
588
+ async function activate(api) {
589
+ createUserBindPlugin(api).register();
590
+ }
591
+ function normalizeConfig(input) {
592
+ const root = (0, import_node_path.join)((0, import_node_os.homedir)(), ".openclaw", "data", "bamdra-user-bind");
593
+ return {
594
+ enabled: input?.enabled ?? true,
595
+ localStorePath: input?.localStorePath ?? root,
596
+ exportPath: input?.exportPath ?? (0, import_node_path.join)(root, "exports"),
597
+ cacheTtlMs: input?.cacheTtlMs ?? 30 * 60 * 1e3,
598
+ adminAgents: input?.adminAgents ?? []
599
+ };
600
+ }
601
+ function exposeGlobalApi(runtime) {
602
+ globalThis[GLOBAL_API_KEY] = {
603
+ getIdentityForSession(sessionId) {
604
+ return runtime.getIdentityForSession(sessionId);
605
+ },
606
+ async resolveIdentity(context) {
607
+ return runtime.resolveFromContext(context);
608
+ }
609
+ };
610
+ }
611
+ function mapProfileRow(row) {
612
+ return {
613
+ userId: String(row.user_id),
614
+ name: asNullableString(row.name),
615
+ gender: asNullableString(row.gender),
616
+ email: asNullableString(row.email),
617
+ avatar: asNullableString(row.avatar),
618
+ nickname: asNullableString(row.nickname),
619
+ preferences: asNullableString(row.preferences),
620
+ personality: asNullableString(row.personality),
621
+ role: asNullableString(row.role),
622
+ visibility: row.visibility === "shared" ? "shared" : "private",
623
+ source: String(row.source ?? "local"),
624
+ updatedAt: String(row.updated_at ?? (/* @__PURE__ */ new Date(0)).toISOString())
625
+ };
626
+ }
627
+ function parseIdentityContext(context) {
628
+ const record = context && typeof context === "object" ? context : {};
629
+ const sender = record.sender && typeof record.sender === "object" ? record.sender : {};
630
+ const message = record.message && typeof record.message === "object" ? record.message : {};
631
+ const sessionId = asNullableString(record.sessionId) ?? asNullableString(record.sessionKey) ?? asNullableString(record.session?.id) ?? asNullableString(record.context?.sessionId);
632
+ const channelType = asNullableString(record.channelType) ?? asNullableString(record.channel?.type) ?? asNullableString(message.channel?.type) ?? asNullableString(record.provider);
633
+ const openId = asNullableString(sender.id) ?? asNullableString(sender.open_id) ?? asNullableString(sender.openId) ?? asNullableString(message.sender?.id);
634
+ const senderName = asNullableString(sender.name) ?? asNullableString(sender.display_name) ?? asNullableString(message.sender?.name);
635
+ return {
636
+ sessionId,
637
+ channelType,
638
+ openId,
639
+ senderName
640
+ };
641
+ }
642
+ function getAgentIdFromContext(context) {
643
+ const record = context && typeof context === "object" ? context : {};
644
+ return asNullableString(record.agentId) ?? asNullableString(record.agent?.id);
645
+ }
646
+ function sanitizeProfilePatch(params) {
647
+ return {
648
+ nickname: asNullableString(params.nickname),
649
+ preferences: asNullableString(params.preferences),
650
+ personality: asNullableString(params.personality),
651
+ role: asNullableString(params.role)
652
+ };
653
+ }
654
+ function parseAdminInstruction(instruction) {
655
+ const normalized = instruction.trim();
656
+ if (/issue|问题|失败/i.test(normalized)) {
657
+ return { action: "list_issues", userIds: [], patch: {} };
658
+ }
659
+ if (/merge|合并/i.test(normalized)) {
660
+ const userIds = normalized.match(/user[:=]([A-Za-z0-9:_-]+)/g)?.map((item) => item.split(/[:=]/)[1]) ?? [];
661
+ return { action: "merge", userIds, patch: {} };
662
+ }
663
+ if (/sync|重同步|同步/i.test(normalized)) {
664
+ return { action: "sync", userIds: extractUserIds(normalized), patch: {} };
665
+ }
666
+ if (/edit|修改|改成|更新/i.test(normalized)) {
667
+ return {
668
+ action: "edit",
669
+ userIds: extractUserIds(normalized),
670
+ patch: extractProfilePatch(normalized)
671
+ };
672
+ }
673
+ return {
674
+ action: "query",
675
+ userIds: extractUserIds(normalized),
676
+ patch: {}
677
+ };
678
+ }
679
+ function extractUserIds(input) {
680
+ return [...input.matchAll(/(?:user[:=]|用户[::]?)([A-Za-z0-9:_-]+)/g)].map((match) => match[1]);
681
+ }
682
+ function extractProfilePatch(input) {
683
+ const patch = {};
684
+ const nickname = input.match(/(?:nickname|称呼)[=:: ]([^,,]+)$/i) ?? input.match(/(?:nickname|称呼)[=:: ]([^,,]+)/i);
685
+ const role = input.match(/(?:role|职责|角色)[=:: ]([^,,]+)/i);
686
+ const preferences = input.match(/(?:preferences|偏好)[=:: ]([^,,]+)/i);
687
+ const personality = input.match(/(?:personality|性格)[=:: ]([^,,]+)/i);
688
+ if (nickname) {
689
+ patch.nickname = nickname[1].trim();
690
+ }
691
+ if (role) {
692
+ patch.role = role[1].trim();
693
+ }
694
+ if (preferences) {
695
+ patch.preferences = preferences[1].trim();
696
+ }
697
+ if (personality) {
698
+ patch.personality = personality[1].trim();
699
+ }
700
+ return patch;
701
+ }
702
+ function renderIdentityContext(identity) {
703
+ const lines = [
704
+ `Resolved user id: ${identity.userId}`,
705
+ `Channel: ${identity.channelType}`
706
+ ];
707
+ if (identity.profile.name) {
708
+ lines.push(`Name: ${identity.profile.name}`);
709
+ }
710
+ if (identity.profile.nickname) {
711
+ lines.push(`Preferred address: ${identity.profile.nickname}`);
712
+ }
713
+ if (identity.profile.preferences) {
714
+ lines.push(`Preferences: ${identity.profile.preferences}`);
715
+ }
716
+ if (identity.profile.personality) {
717
+ lines.push(`Personality: ${identity.profile.personality}`);
718
+ }
719
+ if (identity.profile.role) {
720
+ lines.push(`Role: ${identity.profile.role}`);
721
+ }
722
+ return lines.join("\n");
723
+ }
724
+ function renderYamlList(rows) {
725
+ if (rows.length === 0) {
726
+ return "[]\n";
727
+ }
728
+ return `${rows.map((row) => {
729
+ const lines = ["-"];
730
+ for (const [key, value] of Object.entries(row)) {
731
+ const rendered = value == null ? "null" : JSON.stringify(value);
732
+ lines.push(` ${key}: ${rendered}`);
733
+ }
734
+ return lines.join("\n");
735
+ }).join("\n")}
736
+ `;
737
+ }
738
+ function extractDeepString(value, paths) {
739
+ for (const path of paths) {
740
+ let current = value;
741
+ for (const key of path) {
742
+ if (!current || typeof current !== "object") {
743
+ current = null;
744
+ break;
745
+ }
746
+ current = current[key];
747
+ }
748
+ const candidate = asNullableString(current);
749
+ if (candidate) {
750
+ return candidate;
751
+ }
752
+ }
753
+ return null;
754
+ }
755
+ function asTextResult(value) {
756
+ return {
757
+ content: [
758
+ {
759
+ type: "text",
760
+ text: typeof value === "string" ? value : JSON.stringify(value, null, 2)
761
+ }
762
+ ]
763
+ };
764
+ }
765
+ function asNullableString(value) {
766
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
767
+ }
768
+ function hashId(value) {
769
+ return (0, import_node_crypto.createHash)("sha1").update(value).digest("hex").slice(0, 24);
770
+ }
771
+ // Annotate the CommonJS export names for ESM import in node:
772
+ 0 && (module.exports = {
773
+ activate,
774
+ createUserBindPlugin,
775
+ register
776
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,SAAS,GAAG,kBAAkB,CAAC;AACrC,MAAM,cAAc,GAAG,+BAA+B,CAAC;AACvD,MAAM,MAAM,GAAG;IACb,QAAQ,EAAE,2BAA2B;IACrC,QAAQ,EAAE,2BAA2B;IACrC,MAAM,EAAE,yBAAyB;IACjC,MAAM,EAAE,yBAAyB;CACzB,CAAC;AA+EX,MAAM,aAAa;IAIE;IACA;IAJV,EAAE,CAAe;IAE1B,YACmB,MAAc,EACd,UAAkB;QADlB,WAAM,GAAN,MAAM,CAAQ;QACd,eAAU,GAAV,UAAU,CAAQ;QAEnC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,EAAE,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;mCACkB,MAAM,CAAC,QAAQ;;;;;;;;;;;;;;mCAcf,MAAM,CAAC,QAAQ;;;;;;;;;;;mCAWf,MAAM,CAAC,MAAM;;;;;;;;mCAQb,MAAM,CAAC,MAAM;;;;;;;;;;;;KAY3C,CAAC,CAAC;IACL,CAAC;IAED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gB,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;aACzE;SACF;KACF,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACpF,CAAC;AAED,SAAS,MAAM,CAAC,KAAa;IAC3B,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACrE,CAAC"}
@@ -0,0 +1,12 @@
1
+ {
2
+ "id": "bamdra-user-bind",
3
+ "type": "tool",
4
+ "name": "Bamdra User Bind",
5
+ "description": "Identity resolution, user profile binding, and admin profile tools for OpenClaw channels.",
6
+ "version": "0.1.0",
7
+ "main": "./index.js",
8
+ "configSchema": {
9
+ "type": "object",
10
+ "additionalProperties": true
11
+ }
12
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@bamdra/bamdra-user-bind",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "commonjs",
6
+ "main": "./index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "scripts": {
9
+ "bundle": "node ../../scripts/run-local-bin.mjs tsup && node ../../scripts/prepare-plugin-dist.mjs bamdra-user-bind"
10
+ },
11
+ "openclaw": {
12
+ "id": "bamdra-user-bind",
13
+ "type": "tool",
14
+ "manifest": "./openclaw.plugin.json",
15
+ "extensions": [
16
+ "./index.js"
17
+ ]
18
+ },
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
23
+ }
24
+ },
25
+ "dependencies": {},
26
+ "devDependencies": {
27
+ "@types/node": "^24.5.2"
28
+ }
29
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "id": "bamdra-user-bind",
3
+ "type": "tool",
4
+ "name": "Bamdra User Bind",
5
+ "description": "Identity resolution, user profile binding, and admin profile tools for OpenClaw channels.",
6
+ "version": "0.1.0",
7
+ "main": "./dist/index.js",
8
+ "configSchema": {
9
+ "type": "object",
10
+ "additionalProperties": true
11
+ }
12
+ }
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@bamdra/bamdra-user-bind",
3
+ "version": "0.1.0",
4
+ "description": "Identity resolution, user profile binding, and admin-safe profile tools for OpenClaw channels.",
5
+ "license": "MIT",
6
+ "homepage": "https://www.bamdra.com",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/bamdra/bamdra-user-bind.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/bamdra/bamdra-user-bind/issues"
13
+ },
14
+ "type": "module",
15
+ "main": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "files": [
18
+ "dist",
19
+ "openclaw.plugin.json",
20
+ "README.md",
21
+ "LICENSE"
22
+ ],
23
+ "keywords": [
24
+ "openclaw",
25
+ "openclaw-plugin",
26
+ "identity",
27
+ "user-profile",
28
+ "feishu",
29
+ "memory"
30
+ ],
31
+ "engines": {
32
+ "node": ">=22"
33
+ },
34
+ "scripts": {
35
+ "bundle": "node ../bamdra-openclaw-memory/scripts/run-local-bin.mjs tsup && node -e \"const fs=require('node:fs');const path='./dist/index.js';const text=fs.readFileSync(path,'utf8').replace(/require\\\\(\\\"sqlite\\\"\\\\)/g,'require(\\\"node:sqlite\\\")');fs.writeFileSync(path,text);\"",
36
+ "prepublishOnly": "pnpm run bundle"
37
+ },
38
+ "openclaw": {
39
+ "id": "bamdra-user-bind",
40
+ "type": "tool",
41
+ "manifest": "./openclaw.plugin.json",
42
+ "extensions": [
43
+ "./dist/index.js"
44
+ ]
45
+ },
46
+ "exports": {
47
+ ".": {
48
+ "types": "./dist/index.d.ts",
49
+ "default": "./dist/index.js"
50
+ }
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "dependencies": {},
56
+ "devDependencies": {
57
+ "@types/node": "^24.5.2"
58
+ }
59
+ }