@clawchatsai/connector 0.1.47 → 0.1.48

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawchatsai/connector",
3
- "version": "0.1.47",
3
+ "version": "0.1.48",
4
4
  "type": "module",
5
5
  "description": "ClawChats OpenClaw plugin — P2P tunnel + local API bridge",
6
6
  "main": "dist/index.js",
@@ -54,7 +54,17 @@ export function createTitleHandler(llm) {
54
54
  if (typeof llm?.complete !== 'function') return sendError(res, 501, 'This OpenClaw version has no plugin model completion');
55
55
  const { message } = await parseBody(req);
56
56
  if (typeof message !== 'string' || !message.trim()) return sendError(res, 400, 'Missing message');
57
- const result = await complete(Array.from(message.trim()).slice(0, SOURCE_MAX_CHARS).join(''));
58
- return send(res, 200, { title: normalizeTitle(result?.text), model: result?.provider && result?.model ? `${result.provider}/${result.model}` : undefined });
57
+ const source = Array.from(message.trim()).slice(0, SOURCE_MAX_CHARS).join('');
58
+ let result;
59
+ try {
60
+ result = await complete(source);
61
+ } catch (err) {
62
+ console.warn(`[title] completion failed (source ${source.length} chars): ${err?.code || ''} ${err?.stack || err}`);
63
+ throw err;
64
+ }
65
+ const title = normalizeTitle(result?.text);
66
+ // The reason a retitle comes back empty: which model answered, and what it actually returned.
67
+ if (!title) console.warn(`[title] no title from ${result?.provider}/${result?.model} (source ${source.length} chars, reply ${JSON.stringify(String(result?.text ?? '').slice(0, 200))}, keys ${Object.keys(result || {}).join(',')})`);
68
+ return send(res, 200, { title, model: result?.provider && result?.model ? `${result.provider}/${result.model}` : undefined });
59
69
  };
60
70
  }