@clawchatsai/connector 0.0.53 → 0.0.54

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 +22 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -163,6 +163,26 @@ async function startClawChats(ctx, api, mediaStash) {
163
163
  ctx.logger.error('No gateway token available. Re-run: openclaw clawchats setup <token>');
164
164
  return;
165
165
  }
166
+ // Check for model definitions with 'input' set but missing 'image' — they silently drop attachments.
167
+ _imageRestrictedModels = [];
168
+ try {
169
+ const providers = gwCfg?.['models']?.['providers'] ?? {};
170
+ for (const provider of Object.values(providers)) {
171
+ if (Array.isArray(provider.models)) {
172
+ for (const m of provider.models) {
173
+ if (Array.isArray(m.input) && !m.input.includes('image')) {
174
+ _imageRestrictedModels.push(m.id ?? '(unknown)');
175
+ }
176
+ }
177
+ }
178
+ }
179
+ if (_imageRestrictedModels.length > 0) {
180
+ ctx.logger.warn(`[clawchats] image-restricted models detected (missing "image" input): ${_imageRestrictedModels.join(', ')}`);
181
+ }
182
+ }
183
+ catch {
184
+ // Non-fatal: config parse issue, just skip the check
185
+ }
166
186
  // 3. Ensure native modules are built (OpenClaw installs with --ignore-scripts)
167
187
  await ensureNativeModules(ctx);
168
188
  // 4. Import server.js and create app instance with plugin paths
@@ -412,9 +432,8 @@ function setupDataChannelHandler(dc, connectionId, ctx) {
412
432
  // Warn if any models have image support disabled in openclaw.json
413
433
  if (_imageRestrictedModels.length > 0) {
414
434
  dc.send(JSON.stringify({
415
- type: 'clawchats',
416
- event: 'image-capability-warning',
417
- models: _imageRestrictedModels,
435
+ type: 'gateway-event',
436
+ payload: JSON.stringify({ type: 'clawchats', event: 'image-capability-warning', models: _imageRestrictedModels }),
418
437
  }));
419
438
  }
420
439
  // Persist backup code changes if any were consumed
@@ -700,14 +719,6 @@ async function handleSetup(token) {
700
719
  const openclawConfigPath = path.join(process.env.HOME || '/root', '.openclaw', 'openclaw.json');
701
720
  const openclawConfig = JSON.parse(fs.readFileSync(openclawConfigPath, 'utf8'));
702
721
  gatewayToken = openclawConfig.gateway?.auth?.token || openclawConfig.auth?.token || openclawConfig.token || '';
703
- // Check for model definitions that have 'input' set without 'image' — these silently drop image attachments.
704
- const modelDefs = openclawConfig?.models?.definitions ?? [];
705
- _imageRestrictedModels = modelDefs
706
- .filter(def => Array.isArray(def.input) && !def.input.includes('image'))
707
- .map(def => def.id ?? '(unknown)');
708
- if (_imageRestrictedModels.length > 0) {
709
- console.warn(`[clawchats] image-restricted models detected: ${_imageRestrictedModels.join(', ')}`);
710
- }
711
722
  }
712
723
  catch {
713
724
  console.error('Could not read gateway token from ~/.openclaw/openclaw.json');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawchatsai/connector",
3
- "version": "0.0.53",
3
+ "version": "0.0.54",
4
4
  "type": "module",
5
5
  "description": "ClawChats OpenClaw plugin — P2P tunnel + local API bridge",
6
6
  "main": "dist/index.js",