wtt-connect 0.1.8 → 0.1.9

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/package.json +1 -1
  2. package/src/runner.js +9 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wtt-connect",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "private": false,
5
5
  "description": "WTT-native connector daemon for Codex, Claude Code, Cursor, Gemini, ACP, and other coding agent surfaces.",
6
6
  "type": "module",
package/src/runner.js CHANGED
@@ -305,7 +305,7 @@ export class Runner {
305
305
  type: 'opendesign',
306
306
  metadata: { message_id: message.id || message.message_id || '', generated_by: adapter.name },
307
307
  });
308
- const previewUrl = artifact.preview_url || artifact.url;
308
+ const previewUrl = webPreviewUrl(artifact.preview_url || artifact.url);
309
309
  if (previewUrl) {
310
310
  const title = artifact.title || 'OpenDesign artifact';
311
311
  await this.wtt.publish(topicId, `[opendesign:${title}](${previewUrl})`, 'TASK_ARTIFACT');
@@ -370,6 +370,14 @@ function inferLocale(text) {
370
370
  return /[\u4e00-\u9fff]/.test(String(text || '')) ? 'zh' : 'en';
371
371
  }
372
372
 
373
+ function webPreviewUrl(url) {
374
+ const text = String(url || '').trim();
375
+ if (!text) return '';
376
+ if (text.startsWith('/api/wtt/')) return text;
377
+ if (text.startsWith('/artifacts/')) return `/api/wtt${text}`;
378
+ return text;
379
+ }
380
+
373
381
  function messageTopicType(m) {
374
382
  return String(m.topic_type || metadataValue(m.metadata, 'topic_type') || metadataValue(m.metadata, 'topicType') || '').toLowerCase();
375
383
  }