@qqbrowser/qbot-claw-launcher 0.9.32 → 0.9.33

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 -2
  2. package/debug.html +0 -440
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qqbrowser/qbot-claw-launcher",
3
- "version": "0.9.32",
3
+ "version": "0.9.33",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -9,7 +9,6 @@
9
9
  "types": "dist/index.d.ts",
10
10
  "files": [
11
11
  "dist",
12
- "debug.html",
13
12
  "node_modules"
14
13
  ],
15
14
  "bundledDependencies": [
package/debug.html DELETED
@@ -1,440 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="zh-CN">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>claw-launcher 调试面板</title>
7
- <style>
8
- * { box-sizing: border-box; margin: 0; padding: 0; }
9
- body {
10
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
11
- background: #0f1117;
12
- color: #e2e8f0;
13
- min-height: 100vh;
14
- padding: 24px;
15
- }
16
- h1 {
17
- font-size: 22px;
18
- font-weight: 700;
19
- color: #7dd3fc;
20
- margin-bottom: 6px;
21
- }
22
- .subtitle {
23
- font-size: 13px;
24
- color: #64748b;
25
- margin-bottom: 28px;
26
- }
27
- .port-bar {
28
- display: flex;
29
- align-items: center;
30
- gap: 10px;
31
- margin-bottom: 28px;
32
- background: #1e2330;
33
- border: 1px solid #2d3748;
34
- border-radius: 10px;
35
- padding: 12px 16px;
36
- }
37
- .port-bar label { font-size: 13px; color: #94a3b8; white-space: nowrap; }
38
- .port-bar input {
39
- width: 100px;
40
- background: #0f1117;
41
- border: 1px solid #374151;
42
- border-radius: 6px;
43
- color: #e2e8f0;
44
- padding: 5px 10px;
45
- font-size: 14px;
46
- }
47
- .port-bar input:focus { outline: none; border-color: #7dd3fc; }
48
- .base-url-display {
49
- font-size: 13px;
50
- color: #7dd3fc;
51
- font-family: monospace;
52
- }
53
- .grid {
54
- display: grid;
55
- grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
56
- gap: 18px;
57
- }
58
- .card {
59
- background: #1e2330;
60
- border: 1px solid #2d3748;
61
- border-radius: 12px;
62
- padding: 20px;
63
- display: flex;
64
- flex-direction: column;
65
- gap: 12px;
66
- }
67
- .card-header {
68
- display: flex;
69
- align-items: center;
70
- gap: 10px;
71
- }
72
- .method-badge {
73
- font-size: 11px;
74
- font-weight: 700;
75
- padding: 3px 8px;
76
- border-radius: 5px;
77
- letter-spacing: 0.5px;
78
- }
79
- .get { background: #064e3b; color: #34d399; }
80
- .post { background: #1e3a5f; color: #60a5fa; }
81
- .card-title {
82
- font-size: 14px;
83
- font-weight: 600;
84
- color: #e2e8f0;
85
- font-family: monospace;
86
- }
87
- .card-desc {
88
- font-size: 12px;
89
- color: #64748b;
90
- line-height: 1.5;
91
- }
92
- .form-row {
93
- display: flex;
94
- flex-direction: column;
95
- gap: 6px;
96
- }
97
- .form-row label {
98
- font-size: 12px;
99
- color: #94a3b8;
100
- }
101
- .form-row input, .form-row textarea {
102
- background: #0f1117;
103
- border: 1px solid #374151;
104
- border-radius: 6px;
105
- color: #e2e8f0;
106
- padding: 7px 10px;
107
- font-size: 13px;
108
- font-family: monospace;
109
- resize: vertical;
110
- }
111
- .form-row input:focus, .form-row textarea:focus {
112
- outline: none;
113
- border-color: #7dd3fc;
114
- }
115
- .btn {
116
- padding: 8px 18px;
117
- border: none;
118
- border-radius: 7px;
119
- font-size: 13px;
120
- font-weight: 600;
121
- cursor: pointer;
122
- transition: opacity 0.15s;
123
- align-self: flex-start;
124
- }
125
- .btn:hover { opacity: 0.85; }
126
- .btn:disabled { opacity: 0.4; cursor: not-allowed; }
127
- .btn-primary { background: #2563eb; color: #fff; }
128
- .btn-warning { background: #d97706; color: #fff; }
129
- .btn-danger { background: #dc2626; color: #fff; }
130
- .output-box {
131
- background: #0a0d14;
132
- border: 1px solid #1e2330;
133
- border-radius: 8px;
134
- padding: 12px;
135
- font-size: 12px;
136
- font-family: 'Menlo', 'Consolas', monospace;
137
- color: #a3e635;
138
- white-space: pre-wrap;
139
- word-break: break-all;
140
- max-height: 260px;
141
- overflow-y: auto;
142
- min-height: 48px;
143
- line-height: 1.6;
144
- }
145
- .output-box.error { color: #f87171; }
146
- .output-box.info { color: #7dd3fc; }
147
- .status-dot {
148
- width: 8px; height: 8px;
149
- border-radius: 50%;
150
- display: inline-block;
151
- margin-right: 6px;
152
- }
153
- .dot-idle { background: #64748b; }
154
- .dot-loading { background: #f59e0b; animation: pulse 1s infinite; }
155
- .dot-ok { background: #34d399; }
156
- .dot-err { background: #f87171; }
157
- @keyframes pulse {
158
- 0%, 100% { opacity: 1; }
159
- 50% { opacity: 0.3; }
160
- }
161
- .divider {
162
- border: none;
163
- border-top: 1px solid #2d3748;
164
- }
165
- </style>
166
- </head>
167
- <body>
168
-
169
- <h1>🛠 claw-launcher 调试面板</h1>
170
- <p class="subtitle">本地接口调试工具 · 直接在浏览器中触发各 API</p>
171
-
172
- <div class="port-bar">
173
- <label>服务地址:</label>
174
- <span class="base-url-display" id="baseUrlDisplay"></span>
175
- </div>
176
-
177
- <div class="grid">
178
-
179
- <!-- GET /api/version -->
180
- <div class="card">
181
- <div class="card-header">
182
- <span class="method-badge get">GET</span>
183
- <span class="card-title">/api/version</span>
184
- <span class="status-dot dot-idle" id="dot-version"></span>
185
- </div>
186
- <p class="card-desc">获取 launcher 自身版本、Node.js 版本、qbotclaw 版本、mcporter 版本。</p>
187
- <button class="btn btn-primary" onclick="callVersion()">发送请求</button>
188
- <div class="output-box" id="out-version">— 等待请求 —</div>
189
- </div>
190
-
191
- <!-- GET /api/port -->
192
- <div class="card">
193
- <div class="card-header">
194
- <span class="method-badge get">GET</span>
195
- <span class="card-title">/api/port</span>
196
- <span class="status-dot dot-idle" id="dot-port"></span>
197
- </div>
198
- <p class="card-desc">获取各服务的端口信息,包括 launcher 当前监听端口和 qbotclaw gateway 端口。</p>
199
- <button class="btn btn-primary" onclick="callPort()">发送请求</button>
200
- <div class="output-box" id="out-port">— 等待请求 —</div>
201
- </div>
202
-
203
- <!-- GET /api/install -->
204
- <div class="card">
205
- <div class="card-header">
206
- <span class="method-badge get">GET</span>
207
- <span class="card-title">/api/install</span>
208
- <span class="status-dot dot-idle" id="dot-install"></span>
209
- </div>
210
- <p class="card-desc">触发安装流程,流式返回安装日志(chunked)。可指定版本号,留空则使用默认版本。</p>
211
- <div class="form-row">
212
- <label>version(可选,如 0.0.22)</label>
213
- <input id="installVersion" type="text" placeholder="留空使用默认版本" />
214
- </div>
215
- <button class="btn btn-warning" onclick="callInstall()">开始安装</button>
216
- <div class="output-box" id="out-install">— 等待请求 —</div>
217
- </div>
218
-
219
- <!-- GET /api/self/update -->
220
- <div class="card">
221
- <div class="card-header">
222
- <span class="method-badge get">GET</span>
223
- <span class="card-title">/api/self/update</span>
224
- <span class="status-dot dot-idle" id="dot-self-update"></span>
225
- </div>
226
- <p class="card-desc">更新 launcher 自身到最新版本,完成后自动用新版重启服务。<br/>⚠️ 执行后服务会重启,连接会断开。</p>
227
- <button class="btn btn-danger" onclick="callSelfUpdate()">执行更新</button>
228
- <div class="output-box" id="out-self-update">— 等待请求 —</div>
229
- </div>
230
-
231
- <!-- GET /api/uninstall -->
232
- <div class="card">
233
- <div class="card-header">
234
- <span class="method-badge get">GET</span>
235
- <span class="card-title">/api/uninstall</span>
236
- <span class="status-dot dot-idle" id="dot-uninstall"></span>
237
- </div>
238
- <p class="card-desc">卸载 QBotClaw:停止进程 → npm uninstall → 清理目录。流式返回进度。<br/>⚠️ 此操作不可逆,请谨慎执行。</p>
239
- <div class="form-row">
240
- <label style="display:flex;align-items:center;gap:8px;">
241
- <input type="checkbox" id="keepWorkspace" checked />
242
- 保留 workspace 目录(keepWorkspace=true)
243
- </label>
244
- </div>
245
- <button class="btn btn-danger" onclick="callUninstall()">执行卸载</button>
246
- <div class="output-box" id="out-uninstall">— 等待请求 —</div>
247
- </div>
248
-
249
- <!-- POST /api/qbotclaw -->
250
- <div class="card" style="grid-column: span 2;">
251
- <div class="card-header">
252
- <span class="method-badge post">POST</span>
253
- <span class="card-title">/api/qbotclaw</span>
254
- <span class="status-dot dot-idle" id="dot-qbotclaw"></span>
255
- </div>
256
- <p class="card-desc">执行任意 qbotclaw 命令,流式返回输出。请求体为 JSON,<code>args</code> 为命令参数数组。</p>
257
- <div class="form-row">
258
- <label>args 数组(JSON 格式,如 ["gateway", "install", "--force"])</label>
259
- <textarea id="qbotclawArgs" rows="3">["gateway", "install", "--force"]</textarea>
260
- </div>
261
- <div style="display:flex;gap:8px;flex-wrap:wrap;">
262
- <button class="btn btn-primary" onclick="callQbotclaw()">发送请求</button>
263
- <button class="btn btn-primary" style="background:#4f46e5" onclick="setArgs(['gateway','list'])">gateway list</button>
264
- <button class="btn btn-primary" style="background:#4f46e5" onclick="setArgs(['gateway','install','--force'])">gateway install --force</button>
265
- <button class="btn btn-primary" style="background:#4f46e5" onclick="setArgs(['--version'])">--version</button>
266
- <button class="btn btn-primary" style="background:#4f46e5" onclick="setArgs(['--help'])">--help</button>
267
- </div>
268
- <div class="output-box" id="out-qbotclaw">— 等待请求 —</div>
269
- </div>
270
-
271
- </div>
272
-
273
- <script>
274
- function getBaseUrl() {
275
- const port = window.location.port || '80';
276
- return `http://127.0.0.1:${port}`;
277
- }
278
-
279
- // 页面加载时自动显示当前服务地址
280
- document.getElementById('baseUrlDisplay').textContent = getBaseUrl();
281
-
282
- function setDot(id, state) {
283
- const el = document.getElementById('dot-' + id);
284
- el.className = 'status-dot dot-' + state;
285
- }
286
-
287
- function setOutput(id, text, cls) {
288
- const el = document.getElementById('out-' + id);
289
- el.textContent = text;
290
- el.className = 'output-box' + (cls ? ' ' + cls : '');
291
- el.scrollTop = el.scrollHeight;
292
- }
293
-
294
- function appendOutput(id, text) {
295
- const el = document.getElementById('out-' + id);
296
- el.textContent += text;
297
- el.scrollTop = el.scrollHeight;
298
- }
299
-
300
- // GET /api/version
301
- async function callVersion() {
302
- setDot('version', 'loading');
303
- setOutput('version', '请求中...');
304
- try {
305
- const res = await fetch(getBaseUrl() + '/api/version');
306
- const data = await res.json();
307
- setOutput('version', JSON.stringify(data, null, 2), 'info');
308
- setDot('version', 'ok');
309
- } catch (e) {
310
- setOutput('version', '请求失败: ' + e.message, 'error');
311
- setDot('version', 'err');
312
- }
313
- }
314
-
315
- // GET /api/install(流式)
316
- async function callInstall() {
317
- const version = document.getElementById('installVersion').value.trim();
318
- const url = getBaseUrl() + '/api/install' + (version ? '?version=' + encodeURIComponent(version) : '');
319
- setDot('install', 'loading');
320
- setOutput('install', '连接中...\n');
321
- try {
322
- const res = await fetch(url);
323
- const reader = res.body.getReader();
324
- const decoder = new TextDecoder();
325
- setOutput('install', '');
326
- while (true) {
327
- const { done, value } = await reader.read();
328
- if (done) break;
329
- appendOutput('install', decoder.decode(value, { stream: true }));
330
- }
331
- setDot('install', 'ok');
332
- } catch (e) {
333
- appendOutput('install', '\n请求失败: ' + e.message);
334
- setDot('install', 'err');
335
- }
336
- }
337
-
338
- // GET /api/port
339
- async function callPort() {
340
- setDot('port', 'loading');
341
- setOutput('port', '请求中...');
342
- try {
343
- const res = await fetch(getBaseUrl() + '/api/port');
344
- const data = await res.json();
345
- setOutput('port', JSON.stringify(data, null, 2), 'info');
346
- setDot('port', 'ok');
347
- } catch (e) {
348
- setOutput('port', '请求失败: ' + e.message, 'error');
349
- setDot('port', 'err');
350
- }
351
- }
352
-
353
- // GET /api/self/update
354
- async function callSelfUpdate() {
355
- setDot('self-update', 'loading');
356
- setOutput('self-update', '请求中...');
357
- try {
358
- const res = await fetch(getBaseUrl() + '/api/self/update');
359
- const data = await res.json();
360
- setOutput('self-update', JSON.stringify(data, null, 2), data.status === '成功' ? 'info' : 'error');
361
- setDot('self-update', data.status === '成功' ? 'ok' : 'err');
362
- } catch (e) {
363
- setOutput('self-update', '请求失败(服务可能已重启): ' + e.message, 'error');
364
- setDot('self-update', 'err');
365
- }
366
- }
367
-
368
- // POST /api/qbotclaw(流式)
369
- async function callQbotclaw() {
370
- let args;
371
- try {
372
- args = JSON.parse(document.getElementById('qbotclawArgs').value);
373
- } catch (e) {
374
- setOutput('qbotclaw', 'args 格式错误,请输入合法 JSON 数组', 'error');
375
- return;
376
- }
377
- setDot('qbotclaw', 'loading');
378
- setOutput('qbotclaw', '连接中...\n');
379
- try {
380
- const res = await fetch(getBaseUrl() + '/api/qbotclaw', {
381
- method: 'POST',
382
- headers: { 'Content-Type': 'application/json' },
383
- body: JSON.stringify({ args }),
384
- });
385
- const reader = res.body.getReader();
386
- const decoder = new TextDecoder();
387
- setOutput('qbotclaw', '');
388
- while (true) {
389
- const { done, value } = await reader.read();
390
- if (done) break;
391
- appendOutput('qbotclaw', decoder.decode(value, { stream: true }));
392
- }
393
- setDot('qbotclaw', 'ok');
394
- } catch (e) {
395
- appendOutput('qbotclaw', '\n请求失败: ' + e.message);
396
- setDot('qbotclaw', 'err');
397
- }
398
- }
399
-
400
- // GET /api/uninstall(流式)
401
- async function callUninstall() {
402
- const keepWorkspace = document.getElementById('keepWorkspace').checked;
403
- const url = getBaseUrl() + '/api/uninstall?keepWorkspace=' + keepWorkspace;
404
- setDot('uninstall', 'loading');
405
- setOutput('uninstall', '连接中...\n');
406
- try {
407
- const res = await fetch(url);
408
- const reader = res.body.getReader();
409
- const decoder = new TextDecoder();
410
- setOutput('uninstall', '');
411
- while (true) {
412
- const { done, value } = await reader.read();
413
- if (done) break;
414
- const text = decoder.decode(value, { stream: true });
415
- // 逐行解析 JSON 并格式化显示
416
- const lines = text.split('\n').filter(l => l.trim());
417
- for (const line of lines) {
418
- try {
419
- const obj = JSON.parse(line);
420
- const icon = obj.status === '成功' ? '✅' : '❌';
421
- const filePart = obj.file ? ` [${obj.file}]` : '';
422
- appendOutput('uninstall', icon + filePart + ' ' + obj.msg + '\n');
423
- } catch {
424
- appendOutput('uninstall', line + '\n');
425
- }
426
- }
427
- }
428
- setDot('uninstall', 'ok');
429
- } catch (e) {
430
- appendOutput('uninstall', '\n请求失败: ' + e.message);
431
- setDot('uninstall', 'err');
432
- }
433
- }
434
-
435
- function setArgs(arr) {
436
- document.getElementById('qbotclawArgs').value = JSON.stringify(arr);
437
- }
438
- </script>
439
- </body>
440
- </html>