@clawchatsai/connector 0.0.78 → 0.0.80

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 (3) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
  3. package/server.js +31 -12
package/dist/index.js CHANGED
@@ -448,7 +448,7 @@ function normalizeGatewayPayload(raw) {
448
448
  const sk = parsed.params.sessionKey || '';
449
449
  if (sk.includes(':chat:') && !_hintedSessions.has(sk)) {
450
450
  _hintedSessions.add(sk);
451
- parsed.params.message += '\n[ClawChats: after using Write tool, run exec with: echo "MEDIA:/path/to/file" to surface it in chat]';
451
+ parsed.params.message += '\n[ClawChats: exec stdout lines starting with MEDIA:/path/to/file are displayed inline use this after Write tool or when sharing a file location with the user]';
452
452
  console.log(`[clawchats] capability-note injected for session ${sk}`);
453
453
  return JSON.stringify(parsed);
454
454
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawchatsai/connector",
3
- "version": "0.0.78",
3
+ "version": "0.0.80",
4
4
  "type": "module",
5
5
  "description": "ClawChats OpenClaw plugin — P2P tunnel + local API bridge",
6
6
  "main": "dist/index.js",
package/server.js CHANGED
@@ -395,7 +395,7 @@ function _createFtsTables(db) {
395
395
  content,
396
396
  content=messages,
397
397
  content_rowid=rowid,
398
- tokenize='porter unicode61'
398
+ tokenize='porter unicode61 tokenchars ''''
399
399
  );
400
400
  CREATE TRIGGER messages_ai AFTER INSERT ON messages BEGIN
401
401
  INSERT INTO messages_fts(rowid, content) VALUES (new.rowid, new.content);
@@ -484,20 +484,39 @@ function migrate(db) {
484
484
  if (!hasFts) {
485
485
  _createFtsTables(db);
486
486
  } else {
487
- // Integrity check: corruption causes all message writes to 500.
488
- // Attempt rebuild first; if that fails, drop entirely for graceful degradation
489
- // (messages still save, search returns empty until next restart recreates the table).
490
- try {
491
- db.prepare("INSERT INTO messages_fts(messages_fts) VALUES('integrity-check')").run();
492
- } catch (err) {
493
- console.warn('[DB] messages_fts integrity check failed, attempting rebuild:', err.message);
487
+ // Migration: rebuild FTS table if tokenizer is outdated (missing tokenchars for apostrophe support).
488
+ // Old tokenizer split "there's" into ["there", "s"] causing contraction searches to return 0 results.
489
+ const ftsSchema = db.prepare(
490
+ "SELECT sql FROM sqlite_master WHERE type='table' AND name='messages_fts'"
491
+ ).get();
492
+ const needsTokenizerUpgrade = ftsSchema && !ftsSchema.sql.includes('tokenchars');
493
+ if (needsTokenizerUpgrade) {
494
+ console.log('[DB] messages_fts tokenizer upgrade required (apostrophe support) — rebuilding index...');
494
495
  try {
496
+ _dropFtsTables(db);
497
+ _createFtsTables(db);
495
498
  db.prepare("INSERT INTO messages_fts(messages_fts) VALUES('rebuild')").run();
496
- console.log('[DB] messages_fts rebuilt successfullysearch index restored');
497
- } catch (rebuildErr) {
498
- console.error('[DB] messages_fts rebuild failed, dropping FTS for graceful degradation:', rebuildErr.message);
499
+ console.log('[DB] messages_fts tokenizer upgrade complete apostrophes in contractions now searchable');
500
+ } catch (upgradeErr) {
501
+ console.error('[DB] messages_fts tokenizer upgrade failed, dropping for graceful degradation:', upgradeErr.message);
499
502
  _dropFtsTables(db);
500
- // On the next gateway restart the table will be recreated fresh via the !hasFts path
503
+ }
504
+ } else {
505
+ // Integrity check: corruption causes all message writes to 500.
506
+ // Attempt rebuild first; if that fails, drop entirely for graceful degradation
507
+ // (messages still save, search returns empty until next restart recreates the table).
508
+ try {
509
+ db.prepare("INSERT INTO messages_fts(messages_fts) VALUES('integrity-check')").run();
510
+ } catch (err) {
511
+ console.warn('[DB] messages_fts integrity check failed, attempting rebuild:', err.message);
512
+ try {
513
+ db.prepare("INSERT INTO messages_fts(messages_fts) VALUES('rebuild')").run();
514
+ console.log('[DB] messages_fts rebuilt successfully — search index restored');
515
+ } catch (rebuildErr) {
516
+ console.error('[DB] messages_fts rebuild failed, dropping FTS for graceful degradation:', rebuildErr.message);
517
+ _dropFtsTables(db);
518
+ // On the next gateway restart the table will be recreated fresh via the !hasFts path
519
+ }
501
520
  }
502
521
  }
503
522
  }