@xmoxmo/bncr 0.1.6 → 0.1.8

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/index.ts CHANGED
@@ -4,6 +4,7 @@ import { createRequire } from 'node:module';
4
4
  import path from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { BncrConfigSchema } from './src/core/config-schema.ts';
7
+ import { emitBncrLogLine } from './src/core/logging.ts';
7
8
 
8
9
  const pluginFile = fileURLToPath(import.meta.url);
9
10
  const pluginDir = path.dirname(pluginFile);
@@ -254,12 +255,12 @@ const ensureGatewayMethodRegistered = (
254
255
  ) => {
255
256
  const meta = getRegisterMeta(api);
256
257
  if (meta.methods?.has(name)) {
257
- debugLog(`bncr register method skip ${name} (already registered on this api)`);
258
+ debugLog(`register method skip ${name} (already registered on this api)`);
258
259
  return;
259
260
  }
260
261
  api.registerGatewayMethod(name, handler);
261
262
  meta.methods?.add(name);
262
- debugLog(`bncr register method ok ${name}`);
263
+ debugLog(`register method ok ${name}`);
263
264
  };
264
265
 
265
266
  const getBridgeSingleton = (api: OpenClawPluginApi) => {
@@ -291,14 +292,20 @@ const plugin = {
291
292
  registryFingerprint: meta.registryFingerprint,
292
293
  });
293
294
  const debugLog = (...args: any[]) => {
294
- if (!bridge.isDebugEnabled?.()) return;
295
- api.logger.info?.(...args);
295
+ const rendered = args
296
+ .map((arg) => (typeof arg === 'string' ? arg : JSON.stringify(arg)))
297
+ .join(' ')
298
+ .trim();
299
+ if (!rendered) return;
300
+ emitBncrLogLine('info', `[bncr] debug ${rendered}`, { debugOnly: true }, () =>
301
+ Boolean(bridge.isDebugEnabled?.()),
302
+ );
296
303
  };
297
304
 
298
305
  debugLog(
299
- `bncr plugin register begin bridge=${bridge.getBridgeId?.() || 'unknown'} created=${created}`,
306
+ `register begin bridge=${bridge.getBridgeId?.() || 'unknown'} created=${created}`,
300
307
  );
301
- if (!created) debugLog('bncr bridge api rebound');
308
+ if (!created) debugLog('bridge api rebound');
302
309
 
303
310
  const resolveDebug = async () => {
304
311
  try {
@@ -319,17 +326,17 @@ const plugin = {
319
326
  stop: bridge.stopService,
320
327
  });
321
328
  meta.service = true;
322
- debugLog('bncr register service ok');
329
+ debugLog('register service ok');
323
330
  } else {
324
- debugLog('bncr register service skip (already registered on this api)');
331
+ debugLog('register service skip (already registered on this api)');
325
332
  }
326
333
 
327
334
  if (!meta.channel) {
328
335
  api.registerChannel({ plugin: runtime.createBncrChannelPlugin(bridge) });
329
336
  meta.channel = true;
330
- debugLog('bncr register channel ok');
337
+ debugLog('register channel ok');
331
338
  } else {
332
- debugLog('bncr register channel skip (already registered on this api)');
339
+ debugLog('register channel skip (already registered on this api)');
333
340
  }
334
341
 
335
342
  ensureGatewayMethodRegistered(
@@ -387,7 +394,7 @@ const plugin = {
387
394
  (opts) => bridge.handleFileAck(opts),
388
395
  debugLog,
389
396
  );
390
- debugLog('bncr plugin register done');
397
+ debugLog('register done');
391
398
  },
392
399
  };
393
400
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmoxmo/bncr",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",