@heybox/hb-sdk 0.7.4-alpha.4 → 0.7.4-alpha.6
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.
- package/CHANGELOG.md +18 -0
- package/README.md +19 -1
- package/dist/cli-chunks/{build-BqGFRLe-.cjs → build-DF74IHGR.cjs} +2 -2
- package/dist/cli-chunks/{context-DTr3hRTv.cjs → context-QemmshdY.cjs} +26 -1
- package/dist/cli-chunks/{create-OkiiiH4I.cjs → create-Ch9m8w8M.cjs} +1 -1
- package/dist/cli-chunks/dev-D2DwLxXW.cjs +15682 -0
- package/dist/cli-chunks/{doctor-BO0vkDny.cjs → doctor-B9xJ2j20.cjs} +1 -1
- package/dist/cli-chunks/{index-CZuvk1Rg.cjs → index-Cv36miWx.cjs} +83 -83
- package/dist/cli-chunks/{index-CyEqCbeu.cjs → index-DxQgKWRT.cjs} +31 -32
- package/dist/cli-chunks/index.esm-DZQrllrR.cjs +5212 -0
- package/dist/cli-chunks/{login-CuAGltGs.cjs → login-DEKhX1Vf.cjs} +2 -2
- package/dist/cli-chunks/{project-vite-BUY9DgYo.cjs → project-vite-D_NNB_Ib.cjs} +1 -1
- package/dist/cli-chunks/{remote-tPMcxgpi.cjs → remote-B_Bn4v81.cjs} +4 -4
- package/dist/cli-chunks/{session-BUjFX2U2.cjs → session-C2zY7XHn.cjs} +2 -1
- package/dist/cli.cjs +1 -1
- package/dist/devtools/browser-dev-host/index.html +128 -151
- package/dist/devtools/browser-dev-host/main.js +2591 -345
- package/dist/index.cjs.js +1187 -3
- package/dist/index.esm.js +1187 -3
- package/dist/protocol.cjs.js +3 -0
- package/dist/protocol.esm.js +3 -1
- package/dist/vite.cjs.js +1 -1
- package/dist/vite.esm.js +1 -1
- package/package.json +16 -8
- package/skill/SKILL.md +7 -6
- package/skill/references/api-protocol.md +6 -3
- package/skill/references/api-root.md +6 -2
- package/skill/references/cli.md +16 -20
- package/skill/references/examples.md +2 -2
- package/skill/references/recipes.md +37 -0
- package/skill/references/safety-boundaries.md +1 -1
- package/skill/references/smoke-evaluation.md +1 -1
- package/skill/scripts/sync-references.mjs +6 -6
- package/skill/skill.json +4 -4
- package/types/index.d.ts +1 -1
- package/types/modules/share/copy-link.d.ts +16 -0
- package/types/modules/share/extra.d.ts +3 -0
- package/types/modules/share/index.d.ts +8 -2
- package/types/modules/share/types.d.ts +11 -0
- package/types/protocol/capabilities.d.ts +1 -1
- package/types/protocol/dev-session.d.ts +13 -0
- package/types/protocol.d.ts +2 -2
- package/dist/cli-chunks/dev-j7W9R7ew.cjs +0 -2769
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
var promises = require('node:readline/promises');
|
|
4
4
|
var node_crypto = require('node:crypto');
|
|
5
5
|
var node_http = require('node:http');
|
|
6
|
-
var session = require('./session-
|
|
6
|
+
var session = require('./session-C2zY7XHn.cjs');
|
|
7
7
|
var browser = require('./browser-RAy8e8cV.cjs');
|
|
8
|
-
var index = require('./index-
|
|
8
|
+
var index = require('./index-DxQgKWRT.cjs');
|
|
9
9
|
require('node:path');
|
|
10
10
|
require('fs');
|
|
11
11
|
require('constants');
|
|
@@ -5,7 +5,7 @@ var fs$1 = require('node:fs/promises');
|
|
|
5
5
|
var node_module = require('node:module');
|
|
6
6
|
var path = require('node:path');
|
|
7
7
|
var node_url = require('node:url');
|
|
8
|
-
var index = require('./index-
|
|
8
|
+
var index = require('./index-DxQgKWRT.cjs');
|
|
9
9
|
|
|
10
10
|
function findProjectRoot(startDir) {
|
|
11
11
|
let current = path.resolve(startDir);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var promises = require('node:readline/promises');
|
|
4
|
-
var index = require('./index-
|
|
5
|
-
var session = require('./session-
|
|
4
|
+
var index = require('./index-DxQgKWRT.cjs');
|
|
5
|
+
var session = require('./session-C2zY7XHn.cjs');
|
|
6
6
|
var childProcess = require('node:child_process');
|
|
7
7
|
var fs = require('node:fs');
|
|
8
8
|
var fs$1 = require('node:fs/promises');
|
|
@@ -10,7 +10,7 @@ var path = require('node:path');
|
|
|
10
10
|
var runtimePermissionEnv = require('./runtime-permission-env-D-8_jPG3.cjs');
|
|
11
11
|
var runtimeGate = require('./runtime-gate-CtV7rWyX.cjs');
|
|
12
12
|
var node_crypto = require('node:crypto');
|
|
13
|
-
var context = require('./context-
|
|
13
|
+
var context = require('./context-QemmshdY.cjs');
|
|
14
14
|
require('node:module');
|
|
15
15
|
require('path');
|
|
16
16
|
require('os');
|
|
@@ -271,7 +271,7 @@ function createDefaultCosClient(uploadToken, COS) {
|
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
273
|
async function loadCosConstructor() {
|
|
274
|
-
const cosModule = await Promise.resolve().then(function () { return require('./index-
|
|
274
|
+
const cosModule = await Promise.resolve().then(function () { return require('./index-Cv36miWx.cjs'); }).then(function (n) { return n.index; });
|
|
275
275
|
return cosModule.default;
|
|
276
276
|
}
|
|
277
277
|
function formatSize(bytes) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-DxQgKWRT.cjs');
|
|
4
4
|
var node_crypto = require('node:crypto');
|
|
5
5
|
var path = require('node:path');
|
|
6
6
|
var require$$0$2 = require('fs');
|
|
@@ -3327,6 +3327,7 @@ exports.createHeyboxAuthSession = createHeyboxAuthSession;
|
|
|
3327
3327
|
exports.createHeyboxOpenPlatformRequestContext = createHeyboxOpenPlatformRequestContext;
|
|
3328
3328
|
exports.getAuthCacheFilePath = getAuthCacheFilePath;
|
|
3329
3329
|
exports.readHeyboxApiEnvelope = readHeyboxApiEnvelope;
|
|
3330
|
+
exports.readHeyboxAuthSession = readHeyboxAuthSession;
|
|
3330
3331
|
exports.readRedactedHeyboxAuthStatus = readRedactedHeyboxAuthStatus;
|
|
3331
3332
|
exports.requireHeyboxAuthSession = requireHeyboxAuthSession;
|
|
3332
3333
|
exports.resolveHeyboxApiBaseUrl = resolveHeyboxApiBaseUrl;
|
package/dist/cli.cjs
CHANGED
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
box-sizing: border-box;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
[hidden] {
|
|
13
|
+
display: none !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
body {
|
|
13
17
|
margin: 0;
|
|
14
18
|
height: 100vh;
|
|
@@ -32,6 +36,14 @@
|
|
|
32
36
|
min-height: 0;
|
|
33
37
|
}
|
|
34
38
|
|
|
39
|
+
html[data-screenshot-chrome-hidden='true'] .layout {
|
|
40
|
+
grid-template-columns: minmax(0, 1fr);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
html[data-screenshot-chrome-hidden='true'] .panel {
|
|
44
|
+
display: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
35
47
|
.panel {
|
|
36
48
|
display: flex;
|
|
37
49
|
flex-direction: column;
|
|
@@ -51,19 +63,6 @@
|
|
|
51
63
|
line-height: 1.25;
|
|
52
64
|
}
|
|
53
65
|
|
|
54
|
-
.panel p {
|
|
55
|
-
margin: 0;
|
|
56
|
-
color: #64748b;
|
|
57
|
-
line-height: 1.5;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.status {
|
|
61
|
-
display: grid;
|
|
62
|
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
63
|
-
gap: 8px;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.status div,
|
|
67
66
|
.block {
|
|
68
67
|
min-width: 0;
|
|
69
68
|
border: 1px solid #d7dee8;
|
|
@@ -72,14 +71,12 @@
|
|
|
72
71
|
background: #f8fafc;
|
|
73
72
|
}
|
|
74
73
|
|
|
75
|
-
.status span,
|
|
76
74
|
.block span {
|
|
77
75
|
display: block;
|
|
78
76
|
color: #64748b;
|
|
79
77
|
font-size: 12px;
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
.status strong,
|
|
83
80
|
.block strong {
|
|
84
81
|
display: block;
|
|
85
82
|
margin-top: 6px;
|
|
@@ -87,29 +84,7 @@
|
|
|
87
84
|
word-break: break-word;
|
|
88
85
|
}
|
|
89
86
|
|
|
90
|
-
.
|
|
91
|
-
display: flex;
|
|
92
|
-
flex-wrap: wrap;
|
|
93
|
-
gap: 8px;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.actions button {
|
|
97
|
-
min-height: 36px;
|
|
98
|
-
border: 1px solid #cad5e2;
|
|
99
|
-
border-radius: 6px;
|
|
100
|
-
padding: 0 12px;
|
|
101
|
-
color: #1f2933;
|
|
102
|
-
background: #fff;
|
|
103
|
-
cursor: pointer;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.actions button.primary {
|
|
107
|
-
border-color: #2563eb;
|
|
108
|
-
color: #fff;
|
|
109
|
-
background: #2563eb;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.mac-app-status {
|
|
87
|
+
.status {
|
|
113
88
|
display: grid;
|
|
114
89
|
gap: 8px;
|
|
115
90
|
margin-top: 10px;
|
|
@@ -118,49 +93,47 @@
|
|
|
118
93
|
line-height: 1.5;
|
|
119
94
|
}
|
|
120
95
|
|
|
121
|
-
.
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.debug-page-url {
|
|
96
|
+
.account,
|
|
97
|
+
.mini-program {
|
|
126
98
|
display: grid;
|
|
127
|
-
grid-template-columns: minmax(0, 1fr)
|
|
99
|
+
grid-template-columns: 40px minmax(0, 1fr);
|
|
128
100
|
align-items: center;
|
|
129
|
-
gap:
|
|
101
|
+
gap: 10px;
|
|
102
|
+
margin-top: 10px;
|
|
130
103
|
}
|
|
131
104
|
|
|
132
|
-
.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
105
|
+
.account:has(img[hidden]),
|
|
106
|
+
.mini-program:has(img[hidden]) {
|
|
107
|
+
grid-template-columns: minmax(0, 1fr);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.account__avatar,
|
|
111
|
+
.mini-program__icon {
|
|
112
|
+
width: 40px;
|
|
113
|
+
height: 40px;
|
|
136
114
|
border: 1px solid #d7dee8;
|
|
137
|
-
border-radius:
|
|
138
|
-
|
|
139
|
-
color: #1f2933;
|
|
115
|
+
border-radius: 50%;
|
|
116
|
+
object-fit: cover;
|
|
140
117
|
background: #fff;
|
|
141
118
|
}
|
|
142
119
|
|
|
143
|
-
.
|
|
144
|
-
|
|
145
|
-
place-items: center;
|
|
146
|
-
width: 32px;
|
|
147
|
-
height: 32px;
|
|
148
|
-
border: 1px solid #cad5e2;
|
|
149
|
-
border-radius: 6px;
|
|
150
|
-
padding: 0;
|
|
151
|
-
color: #475569;
|
|
152
|
-
background: #fff;
|
|
153
|
-
cursor: pointer;
|
|
120
|
+
.mini-program__icon {
|
|
121
|
+
border-radius: 8px;
|
|
154
122
|
}
|
|
155
123
|
|
|
156
|
-
.
|
|
157
|
-
|
|
158
|
-
|
|
124
|
+
.account__meta,
|
|
125
|
+
.mini-program__meta {
|
|
126
|
+
min-width: 0;
|
|
159
127
|
}
|
|
160
128
|
|
|
161
|
-
.
|
|
162
|
-
|
|
163
|
-
|
|
129
|
+
.account__meta strong,
|
|
130
|
+
.mini-program__meta strong {
|
|
131
|
+
margin-top: 0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.account__meta span,
|
|
135
|
+
.mini-program__meta span {
|
|
136
|
+
margin-top: 2px;
|
|
164
137
|
}
|
|
165
138
|
|
|
166
139
|
.copy-status {
|
|
@@ -191,23 +164,6 @@
|
|
|
191
164
|
background: #fff;
|
|
192
165
|
}
|
|
193
166
|
|
|
194
|
-
.release-diagnostics {
|
|
195
|
-
display: grid;
|
|
196
|
-
gap: 6px;
|
|
197
|
-
margin: 10px 0 0;
|
|
198
|
-
padding: 0;
|
|
199
|
-
list-style: none;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.release-diagnostics li {
|
|
203
|
-
border-left: 3px solid #d97706;
|
|
204
|
-
padding: 7px 8px;
|
|
205
|
-
color: #92400e;
|
|
206
|
-
background: #fffbeb;
|
|
207
|
-
font-size: 12px;
|
|
208
|
-
line-height: 1.5;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
167
|
.mobile-qr {
|
|
212
168
|
display: grid;
|
|
213
169
|
justify-items: center;
|
|
@@ -328,6 +284,73 @@
|
|
|
328
284
|
color: #991b1b;
|
|
329
285
|
}
|
|
330
286
|
|
|
287
|
+
.placeholder {
|
|
288
|
+
display: grid;
|
|
289
|
+
place-items: center;
|
|
290
|
+
height: 100%;
|
|
291
|
+
padding: 24px;
|
|
292
|
+
color: #64748b;
|
|
293
|
+
text-align: center;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.hb-sdk-auth-dialog {
|
|
297
|
+
position: fixed;
|
|
298
|
+
inset: 0;
|
|
299
|
+
z-index: 40;
|
|
300
|
+
display: grid;
|
|
301
|
+
place-items: center;
|
|
302
|
+
padding: 24px;
|
|
303
|
+
background: rgba(15, 23, 42, 0.45);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.hb-sdk-auth-dialog__panel {
|
|
307
|
+
width: min(360px, 100%);
|
|
308
|
+
border-radius: 12px;
|
|
309
|
+
padding: 20px;
|
|
310
|
+
background: #fff;
|
|
311
|
+
box-shadow: 0 20px 45px rgba(15, 23, 42, 0.2);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.hb-sdk-auth-dialog__panel h2 {
|
|
315
|
+
margin: 0 0 8px;
|
|
316
|
+
font-size: 18px;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.hb-sdk-auth-dialog__app,
|
|
320
|
+
.hb-sdk-auth-dialog__profile {
|
|
321
|
+
margin: 0 0 12px;
|
|
322
|
+
color: #475569;
|
|
323
|
+
line-height: 1.5;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.hb-sdk-auth-dialog__scopes {
|
|
327
|
+
margin: 0 0 16px;
|
|
328
|
+
padding-left: 18px;
|
|
329
|
+
color: #1f2933;
|
|
330
|
+
line-height: 1.6;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.hb-sdk-auth-dialog__actions {
|
|
334
|
+
display: flex;
|
|
335
|
+
justify-content: flex-end;
|
|
336
|
+
gap: 8px;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.hb-sdk-auth-dialog__actions button {
|
|
340
|
+
min-height: 36px;
|
|
341
|
+
border: 1px solid #cad5e2;
|
|
342
|
+
border-radius: 6px;
|
|
343
|
+
padding: 0 12px;
|
|
344
|
+
background: #fff;
|
|
345
|
+
cursor: pointer;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.hb-sdk-auth-dialog__actions .primary {
|
|
349
|
+
border-color: #2563eb;
|
|
350
|
+
color: #fff;
|
|
351
|
+
background: #2563eb;
|
|
352
|
+
}
|
|
353
|
+
|
|
331
354
|
@media (max-width: 860px) {
|
|
332
355
|
body {
|
|
333
356
|
height: auto;
|
|
@@ -357,71 +380,30 @@
|
|
|
357
380
|
<body>
|
|
358
381
|
<div class="layout">
|
|
359
382
|
<aside class="panel">
|
|
360
|
-
<
|
|
361
|
-
<h1>HB SDK Browser Dev Host</h1>
|
|
362
|
-
<p>本地浏览器宿主通过 iframe 加载小程序,使用真实 @heybox/hb-sdk bridge。</p>
|
|
363
|
-
</div>
|
|
364
|
-
|
|
365
|
-
<section class="status">
|
|
366
|
-
<div>
|
|
367
|
-
<span>Bridge</span>
|
|
368
|
-
<strong id="bridge-status">waiting</strong>
|
|
369
|
-
</div>
|
|
370
|
-
<div>
|
|
371
|
-
<span>User</span>
|
|
372
|
-
<strong id="user-status">未登录</strong>
|
|
373
|
-
</div>
|
|
374
|
-
</section>
|
|
383
|
+
<h1>HB SDK Browser Dev Host</h1>
|
|
375
384
|
|
|
376
385
|
<section class="block">
|
|
377
|
-
<span
|
|
378
|
-
<
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
<label class="field" style="margin-top: 10px">
|
|
385
|
-
<span>network.request</span>
|
|
386
|
-
<select id="network-permission-select">
|
|
387
|
-
<option value="disabled">拒绝</option>
|
|
388
|
-
<option value="enabled">允许</option>
|
|
389
|
-
</select>
|
|
390
|
-
</label>
|
|
391
|
-
<div class="actions" style="margin-top: 10px">
|
|
392
|
-
<button id="reset-permissions-button" type="button">恢复初始权限</button>
|
|
386
|
+
<span>开发者</span>
|
|
387
|
+
<div class="account">
|
|
388
|
+
<img class="account__avatar" id="developer-avatar" alt="" hidden />
|
|
389
|
+
<div class="account__meta">
|
|
390
|
+
<strong id="developer-name"></strong>
|
|
391
|
+
<span id="developer-hint"></span>
|
|
392
|
+
</div>
|
|
393
393
|
</div>
|
|
394
|
-
<div class="mac-app-status" id="permission-persistence-status"></div>
|
|
395
|
-
<ul class="release-diagnostics" id="release-diagnostics"></ul>
|
|
396
|
-
</section>
|
|
397
|
-
|
|
398
|
-
<section class="csp-violations" id="csp-violations" hidden>
|
|
399
|
-
<strong>网络或资源请求已被 CSP 阻止</strong>
|
|
400
394
|
</section>
|
|
401
395
|
|
|
402
396
|
<section class="block">
|
|
403
|
-
<span
|
|
404
|
-
<div class="
|
|
405
|
-
<
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
<div class="debug-page-url">
|
|
410
|
-
<code id="debug-page-url"></code>
|
|
411
|
-
<button
|
|
412
|
-
class="copy-icon-button"
|
|
413
|
-
id="copy-debug-page-url-button"
|
|
414
|
-
type="button"
|
|
415
|
-
aria-label="复制调试页面地址"
|
|
416
|
-
title="复制调试页面地址"
|
|
417
|
-
>
|
|
418
|
-
<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2">
|
|
419
|
-
<rect x="9" y="9" width="13" height="13" rx="2" />
|
|
420
|
-
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
|
|
421
|
-
</svg>
|
|
422
|
-
</button>
|
|
397
|
+
<span>小程序</span>
|
|
398
|
+
<div class="mini-program" id="mini-program-summary" hidden>
|
|
399
|
+
<img class="mini-program__icon" id="mini-program-icon" alt="" hidden />
|
|
400
|
+
<div class="mini-program__meta">
|
|
401
|
+
<strong id="mini-program-name"></strong>
|
|
402
|
+
<span id="mini-program-id"></span>
|
|
423
403
|
</div>
|
|
424
|
-
|
|
404
|
+
</div>
|
|
405
|
+
<div class="status" id="mini-program-empty" hidden>
|
|
406
|
+
当前项目未绑定小程序,请运行 hb-sdk remote create 或 hb-sdk remote bind <mini-program-id>。
|
|
425
407
|
</div>
|
|
426
408
|
</section>
|
|
427
409
|
|
|
@@ -437,13 +419,8 @@
|
|
|
437
419
|
</div>
|
|
438
420
|
</section>
|
|
439
421
|
|
|
440
|
-
<section class="
|
|
441
|
-
<
|
|
442
|
-
<button class="primary" id="login-button" type="button">登录</button>
|
|
443
|
-
<button id="logout-button" type="button">登出</button>
|
|
444
|
-
<button id="show-button" type="button">show</button>
|
|
445
|
-
<button id="hide-button" type="button">hide</button>
|
|
446
|
-
</div>
|
|
422
|
+
<section class="csp-violations" id="csp-violations" hidden>
|
|
423
|
+
<strong>网络或资源请求已被 CSP 阻止</strong>
|
|
447
424
|
</section>
|
|
448
425
|
|
|
449
426
|
<section class="block">
|