@clawchatsai/connector 0.0.95 → 0.0.96

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.
Files changed (2) hide show
  1. package/dist/index.js +25 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -39,6 +39,8 @@ let healthServer = null;
39
39
  let _stopRequested = false;
40
40
  /** Model IDs that have 'input' explicitly set without 'image' support. */
41
41
  let _imageRestrictedModels = [];
42
+ /** True if session.reset config risks wiping ClawChats history (daily reset or short idle). */
43
+ let _sessionResetWarning = false;
42
44
  let _uploadsDir = null;
43
45
  // ---------------------------------------------------------------------------
44
46
  // Config helpers
@@ -174,6 +176,22 @@ async function startClawChats(ctx, api, mediaStash) {
174
176
  ctx.logger.error('No gateway token available. Re-run: openclaw clawchats setup <token>');
175
177
  return;
176
178
  }
179
+ // Check session.reset config — warn if daily reset or short idle could wipe ClawChats history.
180
+ _sessionResetWarning = false;
181
+ try {
182
+ const sessionReset = gwCfg?.['session']?.['reset'];
183
+ if (sessionReset) {
184
+ const mode = sessionReset['mode'];
185
+ const idleMinutes = sessionReset['idleMinutes'];
186
+ if (mode === 'daily' || (mode === 'idle' && typeof idleMinutes === 'number' && idleMinutes < 43200)) {
187
+ _sessionResetWarning = true;
188
+ ctx.logger.warn(`[clawchats] session.reset may wipe chat history (mode=${mode}, idleMinutes=${idleMinutes ?? 'unset'}) — set mode=idle + idleMinutes=999999`);
189
+ }
190
+ }
191
+ }
192
+ catch {
193
+ // Non-fatal
194
+ }
177
195
  // Check for model definitions with 'input' set but missing 'image' — they silently drop attachments.
178
196
  _imageRestrictedModels = [];
179
197
  try {
@@ -489,6 +507,13 @@ function setupDataChannelHandler(dc, connectionId, ctx) {
489
507
  payload: JSON.stringify({ type: 'clawchats', event: 'image-capability-warning', models: _imageRestrictedModels }),
490
508
  }));
491
509
  }
510
+ // Warn if session.reset config risks wiping ClawChats history
511
+ if (_sessionResetWarning) {
512
+ dc.send(JSON.stringify({
513
+ type: 'gateway-event',
514
+ payload: JSON.stringify({ type: 'clawchats', event: 'session-reset-warning' }),
515
+ }));
516
+ }
492
517
  // Persist backup code changes if any were consumed
493
518
  if (authConfig.backupCodeHashes && config.backupCodeHashes) {
494
519
  config.backupCodeHashes = authConfig.backupCodeHashes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawchatsai/connector",
3
- "version": "0.0.95",
3
+ "version": "0.0.96",
4
4
  "type": "module",
5
5
  "description": "ClawChats OpenClaw plugin — P2P tunnel + local API bridge",
6
6
  "main": "dist/index.js",