dsclaw 0.1.2 → 0.1.4

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.
@@ -170,8 +170,8 @@ body{display:flex;flex-direction:column}
170
170
  </div>
171
171
  </div>
172
172
 
173
- <script src="https://cdn.jsdelivr.net/npm/marked@15/marked.min.js"></script>
174
- <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/highlight.min.js"></script>
173
+ <script src="https://cdn.jsdelivr.net/npm/marked@15/marked.min.js" async></script>
174
+ <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/highlight.min.js" async></script>
175
175
  <script>
176
176
  (function(){
177
177
  const $ = s => document.querySelector(s);
@@ -186,17 +186,24 @@ body{display:flex;flex-direction:column}
186
186
  let streaming = false, streamBuf = '', streamEl = null;
187
187
  let inputMode = 'text';
188
188
  let reconnectTimer = null, reconnectDelay = 1000;
189
-
190
- marked.setOptions({
191
- breaks: true,
192
- gfm: true,
193
- highlight: function(code, lang) {
194
- if (lang && hljs.getLanguage(lang)) {
195
- return hljs.highlight(code, { language: lang }).value;
189
+ let markedReady = false;
190
+
191
+ function initMarked() {
192
+ if (markedReady) return;
193
+ try {
194
+ if (typeof marked !== 'undefined') {
195
+ marked.setOptions({ breaks: true, gfm: true,
196
+ highlight: function(code, lang) {
197
+ if (typeof hljs !== 'undefined' && lang && hljs.getLanguage(lang))
198
+ return hljs.highlight(code, { language: lang }).value;
199
+ if (typeof hljs !== 'undefined') return hljs.highlightAuto(code).value;
200
+ return code;
201
+ }
202
+ });
203
+ markedReady = true;
196
204
  }
197
- return hljs.highlightAuto(code).value;
198
- }
199
- });
205
+ } catch {}
206
+ }
200
207
 
201
208
  /* ─── WebSocket ─── */
202
209
  function connect() {
@@ -385,7 +392,9 @@ body{display:flex;flex-direction:column}
385
392
  }
386
393
 
387
394
  function md(text) {
388
- try { return marked.parse(text); } catch { return esc(text); }
395
+ initMarked();
396
+ try { return typeof marked !== 'undefined' ? marked.parse(text) : esc(text); }
397
+ catch { return esc(text); }
389
398
  }
390
399
 
391
400
  function esc(t) {
@@ -395,6 +404,7 @@ body{display:flex;flex-direction:column}
395
404
  }
396
405
 
397
406
  function hlAll() {
407
+ if (typeof hljs === 'undefined') return;
398
408
  document.querySelectorAll('.msg-body pre code').forEach(b => {
399
409
  if (!b.dataset.hl) { hljs.highlightElement(b); b.dataset.hl = '1'; }
400
410
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsclaw",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "AI-powered dropshipping agent system built on OpenClaw. Two agents (Navigator + Claw-Ops) automate DSers workflows via Telegram, WhatsApp, and Feishu.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",