@aiyiran/myclaw 1.1.47 → 1.1.49

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.
@@ -2237,23 +2237,40 @@
2237
2237
  var rightFooter = document.createElement('div');
2238
2238
  rightFooter.style.cssText = 'padding:10px 14px;background:#1a1a2a;border-top:1px solid rgba(255,255,255,0.07);flex-shrink:0;display:flex;align-items:center;gap:10px;';
2239
2239
 
2240
- var copyLocalBtn = document.createElement('button');
2241
- copyLocalBtn.textContent = '📂 复制到本地';
2242
- copyLocalBtn.style.cssText = 'padding:6px 18px;background:rgba(255,255,255,0.07);border:1px solid rgba(255,255,255,0.15);border-radius:4px;color:#cdd6f4;font-size:12px;font-family:monospace;cursor:pointer;transition:all 0.15s;';
2243
- copyLocalBtn.onmouseenter = function () { copyLocalBtn.style.background = 'rgba(255,255,255,0.14)'; };
2244
- copyLocalBtn.onmouseleave = function () { copyLocalBtn.style.background = 'rgba(255,255,255,0.07)'; };
2240
+ var _btnBase = 'padding:5px 12px;border-radius:4px;font-size:11px;font-family:monospace;cursor:pointer;transition:all 0.15s;white-space:nowrap;';
2245
2241
 
2246
2242
  var deployBtn = document.createElement('button');
2247
- deployBtn.textContent = '🚀 创建';
2248
- deployBtn.style.cssText = 'padding:6px 18px;background:#a78bfa;border:none;border-radius:4px;color:#fff;font-size:12px;font-family:monospace;cursor:pointer;transition:background 0.15s;';
2243
+ deployBtn.textContent = 'workspace-playgrounds ';
2244
+ deployBtn.style.cssText = _btnBase + 'background:#a78bfa;border:none;color:#fff;';
2249
2245
  deployBtn.onmouseenter = function () { deployBtn.style.background = '#8b5cf6'; };
2250
2246
  deployBtn.onmouseleave = function () { deployBtn.style.background = '#a78bfa'; };
2251
2247
 
2248
+ var copyLocalBtn = document.createElement('button');
2249
+ copyLocalBtn.textContent = getWorkspaceId() + ' ⬇';
2250
+ copyLocalBtn.style.cssText = _btnBase + 'background:rgba(255,255,255,0.07);border:1px solid rgba(255,255,255,0.15);color:#cdd6f4;';
2251
+ copyLocalBtn.onmouseenter = function () { copyLocalBtn.style.background = 'rgba(255,255,255,0.14)'; };
2252
+ copyLocalBtn.onmouseleave = function () { copyLocalBtn.style.background = 'rgba(255,255,255,0.07)'; };
2253
+
2254
+ var promptBtn = document.createElement('button');
2255
+ promptBtn.textContent = '复制提示词';
2256
+ promptBtn.style.cssText = _btnBase + 'background:rgba(255,255,255,0.07);border:1px solid rgba(255,255,255,0.15);color:#cdd6f4;';
2257
+ promptBtn.onmouseenter = function () { promptBtn.style.background = 'rgba(255,255,255,0.14)'; };
2258
+ promptBtn.onmouseleave = function () { promptBtn.style.background = 'rgba(255,255,255,0.07)'; };
2259
+ promptBtn.onclick = function () {
2260
+ if (!currentTpl) return;
2261
+ var promptText = '我要使用' + currentTpl['系列'] + currentTpl['编号'] + '模板:' + currentTpl['名称'] + '。' + currentTpl['一句话说明'];
2262
+ navigator.clipboard.writeText(promptText).then(function () {
2263
+ promptBtn.textContent = '✓ 已复制';
2264
+ setTimeout(function () { promptBtn.textContent = '复制提示词'; }, 2000);
2265
+ });
2266
+ };
2267
+
2252
2268
  var footerStatus = document.createElement('span');
2253
2269
  footerStatus.style.cssText = 'font-size:11px;color:rgba(205,214,244,0.45);flex:1;';
2254
2270
 
2255
- rightFooter.appendChild(copyLocalBtn);
2256
2271
  rightFooter.appendChild(deployBtn);
2272
+ rightFooter.appendChild(copyLocalBtn);
2273
+ rightFooter.appendChild(promptBtn);
2257
2274
  rightFooter.appendChild(footerStatus);
2258
2275
 
2259
2276
  // currentTpl 在 setActive 时更新,按钮 onclick 通过闭包读取
@@ -2323,8 +2340,8 @@
2323
2340
  if (deploy.agent && deploy.session) {
2324
2341
  var sessionParam = 'agent:' + deploy.agent + ':' + deploy.session;
2325
2342
  setTimeout(function () {
2326
- window.location.href = 'http://127.0.0.1:18789/chat?session=' + encodeURIComponent(sessionParam);
2327
- }, 4000);
2343
+ window.open('/chat?session=' + encodeURIComponent(sessionParam), '_blank');
2344
+ }, 10000);
2328
2345
  }
2329
2346
  } else if (res.code === 'not_ready') {
2330
2347
  setFooterStatus('⟳ 模板文件下载中,完成后即可使用', '#f59e0b');
@@ -2395,22 +2412,8 @@
2395
2412
  if (previewIframe.src) window.open(previewIframe.src, '_blank');
2396
2413
  };
2397
2414
 
2398
- var useBtn = document.createElement('button');
2399
- useBtn.textContent = '✨ 使用模板';
2400
- useBtn.style.cssText = 'flex-shrink:0;padding:5px 14px;background:#a78bfa;border:none;border-radius:4px;color:#fff;font-size:12px;font-family:monospace;cursor:pointer;transition:background 0.15s;white-space:nowrap;';
2401
- useBtn.onmouseenter = function () { useBtn.style.background = '#8b5cf6'; };
2402
- useBtn.onmouseleave = function () { useBtn.style.background = '#a78bfa'; };
2403
- useBtn.onclick = function () {
2404
- var promptText = '我要使用' + tpl['系列'] + tpl['编号'] + '模板:' + tpl['名称'] + '。' + tpl['一句话说明'];
2405
- navigator.clipboard.writeText(promptText).then(function () {
2406
- useBtn.textContent = '✓ 提示词已复制';
2407
- useBtn.style.background = '#10b981';
2408
- setTimeout(function () { useBtn.textContent = '✨ 使用模板'; useBtn.style.background = '#a78bfa'; }, 2000);
2409
- });
2410
- };
2411
2415
  rightHeader.appendChild(infoSpan);
2412
2416
  rightHeader.appendChild(openNewBtn);
2413
- rightHeader.appendChild(useBtn);
2414
2417
  previewIframe.src = TEMPLATE_CDN_BASE + '/' + encodeURIComponent(tpl['文件夹名']) + '/' + (tpl['version'] || 'v1') + '/__student-view__.html?t=' + Date.now();
2415
2418
  }
2416
2419
 
package/index.js CHANGED
@@ -2479,6 +2479,8 @@ if (!command) {
2479
2479
  runServer(args[1]); // args[1] 是可选的 name
2480
2480
  } else if (command === 'sync') {
2481
2481
  runSync(args[1]); // args[1] 是可选的 workspace 名称
2482
+ } else if (command === 'init') {
2483
+ console.log('init 还没实现,后续添加钩子');
2482
2484
  } else {
2483
2485
  console.error('[' + colors.red + '错误' + colors.nc + '] 未知命令: ' + command);
2484
2486
  showHelp();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.1.47",
3
+ "version": "1.1.49",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {