@aiyiran/myclaw 1.0.254 → 1.0.255

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.
@@ -502,7 +502,7 @@
502
502
  }
503
503
 
504
504
  if (isImageAsset(asset)) {
505
- // ── 图片模式:img 弹框,自适应尺寸 ──
505
+ // ── 图片模式:先显示固定大小的容器,img 异步加载渐显 ──
506
506
  var imgBox = document.createElement('div');
507
507
  imgBox.style.cssText = [
508
508
  'display: flex',
@@ -510,26 +510,55 @@
510
510
  'background: #1e1e2e',
511
511
  'border-radius: 8px',
512
512
  'box-shadow: 0 8px 32px rgba(0,0,0,0.6)',
513
- 'max-width: 92vw',
514
- 'max-height: 92vh',
513
+ 'width: min(88vw, 920px)',
515
514
  'overflow: hidden',
516
515
  ].join(';');
517
516
 
518
517
  imgBox.appendChild(makeHeader('\uD83D\uDDBC\uFE0F ' + (asset.name || asset.path)));
519
518
 
519
+ // 固定尺寸的占位区域,立即可见
520
+ var imgArea = document.createElement('div');
521
+ imgArea.style.cssText = [
522
+ 'position: relative',
523
+ 'width: 100%',
524
+ 'height: min(65vh, 600px)',
525
+ 'display: flex',
526
+ 'align-items: center',
527
+ 'justify-content: center',
528
+ 'background: #252536',
529
+ ].join(';');
530
+
531
+ // 加载中提示
532
+ var hint = document.createElement('div');
533
+ hint.textContent = '\u52A0\u8F7D\u4E2D...';
534
+ hint.style.cssText = 'color:#666;font-size:13px;font-family:monospace;position:absolute;';
535
+ imgArea.appendChild(hint);
536
+
537
+ // img 在占位区内加载,opacity 0 → 1
520
538
  var img = document.createElement('img');
521
539
  img.src = previewUrl;
522
540
  img.alt = asset.name || asset.path;
523
541
  img.style.cssText = [
524
- 'display: block',
525
- 'max-width: 92vw',
526
- 'max-height: calc(92vh - 44px)',
542
+ 'max-width: 100%',
543
+ 'max-height: 100%',
527
544
  'width: auto',
528
545
  'height: auto',
529
546
  'object-fit: contain',
547
+ 'opacity: 0',
548
+ 'transition: opacity 0.25s ease',
549
+ 'position: relative',
550
+ 'z-index: 1',
530
551
  ].join(';');
552
+ img.onload = function () {
553
+ img.style.opacity = '1';
554
+ hint.style.display = 'none';
555
+ };
556
+ img.onerror = function () {
557
+ hint.textContent = '\u52A0\u8F7D\u5931\u8D25';
558
+ };
531
559
 
532
- imgBox.appendChild(img);
560
+ imgArea.appendChild(img);
561
+ imgBox.appendChild(imgArea);
533
562
  overlay.appendChild(imgBox);
534
563
  } else {
535
564
  // ── 非图片:iframe 全屏模式 ──
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.254",
3
+ "version": "1.0.255",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -163,16 +163,14 @@ function patchAgents() {
163
163
 
164
164
  const alreadyExists = fs.existsSync(destWorkspace);
165
165
 
166
- // auto → 已存在则跳过
167
- if (strategy === 'auto' && alreadyExists) {
168
- console.log('[myclaw-agent] ⊘ 已存在: ' + agentId + ' (' + desc + ') [auto, 跳过]');
166
+ // auto → 已存在则跳过文件复制,但仍需检查 sessions
167
+ if (strategy !== 'auto' || !alreadyExists) {
168
+ copyDirSync(srcWorkspace, destWorkspace);
169
+ } else {
170
+ console.log('[myclaw-agent] ⊘ 已存在: ' + agentId + ' (' + desc + ') [auto, 跳过复制]');
169
171
  skipped++;
170
- continue;
171
172
  }
172
173
 
173
- // 执行复制
174
- copyDirSync(srcWorkspace, destWorkspace);
175
-
176
174
  // 确保 agent 目录结构存在
177
175
  if (!fs.existsSync(agentDir)) {
178
176
  fs.mkdirSync(agentDir, { recursive: true });
@@ -212,8 +210,8 @@ function patchAgents() {
212
210
  updated++;
213
211
  console.log('[myclaw-agent] ✅ 已覆盖更新: ' + agentId + ' (' + desc + ') [' + strategy + ']');
214
212
 
215
- // strategy=on 且 sessions 为空 → 补发出生消息(agent 存在但从未激活)
216
- if (strategy === 'on') {
213
+ // sessions 为空 → 补发出生消息(agent 存在但从未激活)
214
+ {
217
215
  const sessionFiles = fs.readdirSync(sessionsDir).filter(f => !f.startsWith('.'));
218
216
  if (sessionFiles.length === 0) {
219
217
  try {